Question

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 ?

Was it helpful?

Solution

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);

OTHER TIPS

Probably you will have to use the onTextChanged event of your TextBox control.

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top