Andrey
Andrey

Reputation: 479

How to dynamically fill controls on a selection changed in a aspxgridview

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?

Upvotes: 0

Views: 3488

Answers (3)

Mikhail
Mikhail

Reputation: 9300

Take a look at this demo to learn more on how to achieve this task on the client side.

Upvotes: 0

Filip
Filip

Reputation: 3347

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.

Upvotes: 1

dexter
dexter

Reputation: 1227

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

Upvotes: 0

Related Questions