Reputation: 7318
I used asp.net server side control to display and modify data in database, the control is just like this one: http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/alleditablecolumns/defaultcs.aspx what I want to do is after I click the "edit" button it will display a "edit" ui, and I want everytime I modify the data in the text box, asp.net will automatically click the "update" button for me to update the data i entered.
I tried to call the event handler, but failed. There is a update command in asp.net, and how to programmatically call it ?
Upvotes: 0
Views: 1269
Reputation: 1351
Set the autopostback attribute to "true"
<asp:TextBox AutoPostBack="True" ID="somethingID" OnTextChanged="CallSomeMethod" />
Look here : http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.textbox.autopostback.aspx
Upvotes: 0
Reputation: 19598
Try this. You can get the event refernce via this code
string postbackEvent = this.ClientScript.GetPostBackEventReference(this.button,"");
the postbackEvent will contains a __doPostback() function, which will invoke the button click in the server side. Assign this to some event, like onBlur of textbox.
this.txtSample.Attributes.Add("onBlur",postbackEvent);
Upvotes: 0
Reputation: 9942
Probably you will have to use the onTextChanged event of your TextBox control.
Upvotes: 0