I have a AspxGridView which is linked to a DataSource. Below the GridView there are some textBoxes which should be populated on a selection changed event. How can I achieve that? Maybe with a callback panel and the clientSide SelectionChanged to fires a custom callback or ... ? Or maybe the SelectionChange isn't the appropriate event? I can see that in the gridview there are Begin and EndCallback on the client sides but when are they actually executed?
Asked
Active
Viewed 3,259 times
3 Answers
1
You can do this:
1. Place your text boxes inside ASPxCallbackPanel
2. Set callback panel ClientInstanceName
to e.g. callbackPanel1
3. On ASPxGridView
client side selection changed event call callbackPanel1.PerformCallback
4. Set text boxes values in ASPxCallbackPanel.Callback event handler
The Concept of Callbacks knowledge base article is mandatory reading.

Filip
- 3,257
- 2
- 22
- 38
-
okey and on PerformCallback how I can pass the keyfield(in my case the id)? – Andrey Jun 20 '12 at 09:05
-
you can pass it as parameter of PerformCallback js method. – Filip Jun 20 '12 at 09:25
0
Since your textboxes are outside the grid, it should be easy:
void MyGridView_SelectedIndexChanged(Object sender, EventArgs e)
{
MyTextBox.Text = "You selected something.";
}
Check this out: http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.selectedindexchanged.aspx

dexter
- 1,217
- 9
- 12
-
Okey but isn't there any way to force the aspxgridview to cause a callback on SelectionChange, and to populate the required fields on that callback ? – Andrey Jun 18 '12 at 12:57
-
SecelctedIndexChanged generates a postback. I don't understand why you want custom callbacks since you use gridview and texboxes which are standard asp.net controls. As far as I understand you want to update some textboxes when the user selects an item in the gridview. – dexter Jun 18 '12 at 13:58