This is very useful for instances where there is a Child grid with a datasource that requires a value from the Parent grid.
In this example, we will begin with a Parent grid (gridParent) which is databound to a SQL Database. We are retrieving several values, but the most important for this demo is AppID
In the SettingsBehaviour properties we will need to set AllowFocusedRow to True. Also, we need to set ProcessFocusedRowChangedOnServer to True, as this stops the event being handled client side, and will process the event on the server side.
Next, we need to add the method to handle the FocusedRowChanged event. To get the AppID field we need to feed into the gridChild, we need to call the GetRowValues method, which requires a row index and a column ID.
To get the row index, we create a new aspxGridView instance from the Sender object arguement, which will give us the ability to call the FocusedRowIndex() method.
Then we need to give it the name of the column we require, in this case "AppID"
Ridiculous!
ReplyDeleteNo single line of code. Please do us mere mortals a favor by writing some code. Thanks:)