I am new to infragistics and am trying to find the grid row that fires when a change is made to a dropdown on the row, in the grid. I know when the dropdown changes, but can't find correct event to get the grid row's other column info.
So far I've tried updaterowbatch, updaterow, updategrid, updatecellbatch, updatecell and none seem to fire on postback.
I'm sure I'm missing something simple that someone has found long ago...
Thanks!
You can get the row which cell's been updated within the arguments of the UpdateCell event
protected void grid1_UpdateCell(object sender, CellEventArgs e)
{
UltraGridRow row = e.Cell.Row;
}
i'm just not seeing this event fire when the drropdown changes or on postback
<igtbl:UltraWebGrid ID="gridx" OnUpdateCell="gridx_UpdateCell" ... ....
which sets the function you'll be calling when that event fires.. taht's usually set automatically.. That's the last thing I could think of
my final question...just wonder if the grid doesn't recognize a celltemplate dropdown in a templatedcolumn when it is changed?
I just tested it out and it does recognize it.. this is the code that i wrote
tc.Key = "TemplatedColumn";
UltraWebGrid1.Columns.Add(tc);
listaValores.ValueListItems.Add(1, "One");
tc.ValueList = listaValores;
UltraWebGrid1.UpdateCell += new Infragistics.WebUI.UltraWebGrid.UpdateCellEventHandler(UltraWebGrid1_UpdateCell);
and the function itself
void UltraWebGrid1_UpdateCell(object sender, Infragistics.WebUI.UltraWebGrid.CellEventArgs e)
OnUpdateCell="UltraWebGrid1_UpdateCell"
and change de protection level to public
public void UltraWebGrid1_UpdateCell(object sender, Infragistics.WebUI.UltraWebGrid.CellEventArgs e)
Hope this helps if you haven't found the answer yet.
Hello All,
I think I might have a suggestion here that could probably here a little. The ASPX template is parsed at the very beginning of the lifecycle of the Page (OnInit). This btw coincides with where Visual Studio places all event hooking by default. If you want to respond to a changed event, you need to wire the event as early as OnInit - doing so in Page_Load or in a postback event handler like button click may not work in all cases.
So if you are witing events programmatically, just make sure you do so in OnInit.
yes, apparently that is true and thanks for the follow-up...i'm getting the row cell data i need when the OnSelectedIndexChanged fires for the dropdown (celltemplate) in the above code...works very nicely, its been an interesting learning journey
thanks again to all who responded
I think I've just figured out why this is happening, and what you're doing here is the best solution I know of.
When you have a templated column, you no longer have a direct connection between what's displayed in the cell and the value of the cell.
Why is this? Column templates may have more than one control, and the cell may not know which of those controls to use for its value, how to retrieve the value from any one of those controls, or if indeed it should use any of those controls at all to determine its value.
An alternate solution is to listen to client-side events of the controls on your column template and use these to update the value of the corresponding cell. However, this is a lot of work to implement. The solution of using the server-side events of the controls in the column template is often just as effective, and is usually easier to do.
so much for getting the data through a grid event i'm doing this in the dropdown event and it works perfect:
DropDownList dropdownlist = (DropDownList)sender; CellItem ci = (CellItem)dropdownlist.Parent; int rownumber = ci.Cell.Row.Index;
datastore = gridx.Rows[rownumber].Cells[0].Text;
the only events that i see firing are the "active" events (row and cell) selected and update events are not
so one solution is to postback every time they change a dropdown, but i was hoping to do this in updatebatch because i have a row with 5 dropdowns and could have (usually do have) multiple rows
thanks everyone for their help so far...i have done all of the above...here is what i still can't figure out...the OnSelectedIndexChanged event fires when i change an item in the dropdown that is a celltemplate in the grid...that is good because i need the value from the new item changed too, but i also need an id from the row of the grid and the "grid row"event don't seem to fire
any other ideas?