how to get selected row value at server side
i uase ultrawebgrid and i want selected row value on one button click
UltraWebGrid1.DisplayLayout.SelectedRows; -> Gives you a collection of selected rows (can be more than one)
UltraWebGrid1.DisplayLayout.ActiveRow; -> Gives you te actual active row. This method always returns just one row.
i used that one but it's wan't wrok for me
can u give me some expamle of that coding
and any properties i have to set for that webgrid
Maybe there's no active row at that point. If you're not selecting any row before triggering that event you'd probable get this kind of exception.. I suggest you place a breakpoint when you try to get the active row to see if it return an actual row.
You can try something like
UltraGridRow row = grid.DIsplayLayout.ActiveRow;
if(row != null)
{
//and here get the value from the cell
}
Here is heml code
<bands>
<igtbl:UltraGridBand>
<Columns>
<igtbl:UltraGridColumn Type="Button">
<header caption="Select">
</header>
</igtbl:UltraGridColumn>
IsBound="True" Key="FirstName">
<header caption="FirstName">
<rowlayoutcolumninfo originx="1" />
<footer>
</footer>
IsBound="True" Key="LastName">
<header caption="LastName">
<rowlayoutcolumninfo originx="2" />
</Columns>
<addnewrow view="NotSet" visible="NotSet">
</addnewrow>
</igtbl:UltraGridBand>
</bands>
I don't seem to get what the problem could be.. If you have at least one row selected it should be already in the SelectedRows colection.. Have you tried with the ActiveRow too? As I told you this one returns the single row that has the focus at that moment. Althog by the code you provided, I also do not see the functionality you're trying to achieve. Maybe you could try to explain a little bit more your scenario and specify if there's any other control in te equation.
Hello,
I think the problem here is that databinding occurs prior to executing the postback event handler that gets the selected rows. The problem is that databinding essentially clears the selected rows collections (empties the grid and rebinds again).
You can try moving the code databinding the grid from Page_Load to the grid InitializeDataSource event. Also, you can check the lifecycle of the page.
I believe a very similar thread with a similar problem is discussed (SelectedRows.Count = 0 even when rows are selected) here:
http://forums.infragistics.com/forums/p/11104/42129.aspx
Hi all
Thanks for all these help
InitializeDataSource event it's wroks perfectly
i aprriciate all help from you guys
Thanks