|
digimanus i tried all methods u gave me, which i alresdy tried it before
String Value2 = ((TextBox)tr.Cells[1].Controls[0]).Text;
an error occured it gives me: specified cast is not valid, do you think textbox is the control which has to be specified for this cell ?
thank you for your help
|
|
|
|
|
IS the row in Edit mode? (EditIndex > -1 in GridView)
Than use the above code
Else
String Value2 = tr.Cells[1].Text;
Otherwise.
Set a breakpoint on the line with the (TextBox) cast.
When reaching the breakpoint (Build = debug)
add a watch on
tr.Cells[1].Controls
See how many controls the Count gives. If larger than 1 try in the watch
all other controls in the array like
tr.Cells[1].Controls[1]
tr.Cells[1].Controls[2]
tr.Cells[1].Controls[and so on]
In that case you can see in which control your data exists.
Have Fun
|
|
|
|
|
it's alright i was populationg the cell by this method:
tablecell.Controls.Add(new LiteralControl(SomeString));
when i used tablecell.Text=SomeString;
it's working fine
Thanks for the help
|
|
|
|
|
Hi,
I have a DataGrid that have a dataset as a data source.
The dataset is being returned from a web service.
The code:
webservice.service1 srv = new webservice.service1();
DataSet ds = srv.GetDataSet();
Session["dataset"] = ds;
datagrid1.DataSource = Session["dataset"];
datagrid1.DataMember = "SomeTable";
datagrid1.DataBind();
When editing a row in the DataGrid the DataGrid is affected by the changes
but the DataSource remains the same as before the edit.
What is the problem ?
|
|
|
|
|
after setting the SelectedIndex, reload the DataSet again and bind it again to the datagrid.
|
|
|
|
|
When I do that, the DataGrid shows the old DataSet (before the edit)
|
|
|
|
|
What do you use to update the data in the database?
Stored Procedures?
Or is stating the DataSource method ApplyChanges() enough because of using other ways to communicate with the database ?
In other words. First update the data in the database before retrieving it again otherwise you are stuck with the original data.
|
|
|
|
|
I guess I wasnt clear enough, Ill try to describe the problem again.
The web service has two functions the first one retrives a DataSet and the second one gets DataSet
as a parameter and save it to the DataBase with DataAdapter.
After I get the DataSet from the web service I bind it to the DataGrid (as decribed In my first message)
when I make changes throgh the DataGrid I expect that the DataSet will change but it doesnt,
that's why its irrelevant to save it back in the DB at this stage.
Why does the DataSet doesn't change when I'm changing the DataGrid ?
|
|
|
|
|
It is very simple.
You are in disconnected state with the database. So after changing data in the gridview you have to change the data in the database. The webservice retrieves it data from the database. So after a change your webservice seems to run a type of reload data from the database.
After a change in a gridview you have to update the data in database.
your working order is:
Load data from database
Bind it to the grid
Edit a row
Update the data from the row in the database (You can use .SelectedValue property to see the DataKeyName and/or DataKeyValue. In that case you can update the row with the SelectedValue als key for the where)
After updating you load data again from the database
|
|
|
|
|
I dont want to change the DB every time I edit the DataGrid, I want to update the DB only after I press on "save" button.
The question is what I need to do so that when I edit the DataGrid the DataSet will be updated (without updating the DB yet, until I press the save button).
|
|
|
|
|
I do not think it would be wise to store your datatable in a session object. Would cost way too much memory.
Better to add a Safe button in each row of the gridview. After they press that safe button upload the data and reload.
|
|
|
|
|
Hi Guys,
I recently finished a project which i now need to, rewrite to a console app, allowing it to be linked to windows scheduler.
Is there anyway to convert a web app to a console app?
Or is it amatter of creating a new console app and breaking down the code and re writting it into the console app?
Any help feed back would be greatly appreciated.
Regards
DMC
|
|
|
|
|
DeanCook wrote: Or is it amatter of creating a new console app and breaking down the code and re writting it into the console app?
Yes. However if you followed standard Object Oriented Design Principles and Best Practices there won't be any re-writing, there would just be adding the original source files containing all the code for the application behavior into the new console project.
So did you?
led mike
|
|
|
|
|
Nooblet question. how do i go about doing that?
Regards DMC
|
|
|
|
|
Here's a tip for you. Voting down my posts is NOT the way get me to help you.
led mike
|
|
|
|
|
led mike wrote: Here's a tip for you. Voting down my posts is NOT the way get me to help you.
But surely you're used to it by now.
|
|
|
|
|
I just assumed a large dyslexic membership here at CP, was I wrong?
led mike
|
|
|
|
|
Will you both stop using my post to chat crap please. if you have nothing productive to say about the matter at hand then please go forth and FYS.
Regards DMC
|
|
|
|
|
DeanCook wrote: Will you both stop using my post to chat crap please. if you have nothing productive to say about the matter at hand then please go forth and FYS.
f*** off a**hole
led mike
|
|
|
|
|
|
DeanCook wrote: Rude!
you mean this?
DeanCook wrote: Will you both stop using my post to chat crap please.
Yes it was.
led mike
|
|
|
|
|
I believe i have found a solution to my problem, quote me if im wrong, but if i convert my web app to a winform app, it should be alot simpler to convert into a console app. logic is sound not sure about the method of it all, ill keep ya posted.
|
|
|
|
|
I have a textbox inside a usercontrol that is part of a modal window. I would like to set the focus to that control once the modal window is displayed. I have tried calling the controls focus() method. I have also tried adding script. It is just not working.
this.mpe.Show();
this.EmployeeNumber1.resetControl();
this.Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "money", "document.getElementById('" + this.EmployeeNumber1.TextBoxEmployeeNumber.ClientID + "').focus();", true);
Any Ideas?
I didn't get any requirements for the signature
|
|
|
|
|
Try to use
TextBoxEmployeeNumber.UniqueID
instead of
TextBoxEmployeeNumber.ClientID
|
|
|
|
|
Still didn't work. This issue appears to be this.
the output renders my javascript but the modalpopupscript comes after my script and therefore the focus is reset to something else.
<script language="javascript"> document.getElementById('ctl00$EmployeeNumber1$txtEmployeeNumber').focus(); </script>
<script type="text/javascript">
(function() {var fn = function() {AjaxControlToolkit.ModalPopupBehavior.invokeViaServer('ctl00_mpe', true); Sys.Application.remove_load(fn);};Sys.Application.add_load(fn);})();Sys.Application.initialize();
Sys.Application.add_init(function() {
$create(AjaxControlToolkit.ModalPopupBehavior, {"PopupControlID":"ctl00_ModalPanel","dynamicServicePath":"/TankBookWeb/tanklist.aspx","id":"ctl00_mpe"}, null, null, $get("ctl00_btnX"));
});
</script>
I didn't get any requirements for the signature
|
|
|
|