I can not make WebDataGrid to fire any of these events on PostBack.
Scenario is pretty simple.
In CreateChildControls I add UpdatePanel and add WebDataGrid into it
UpdatePanel container = new UpdatePanel { ID = "c", ChildrenAsTriggers = true }; this.Controls.Add(container);
this.grid1 = new WebDataGrid { ID = "grid1", EnableAjax = false, EnableAjaxViewState = false, EnableViewState = false }; container.ContentTemplateContainer.Controls.Add(this.grid1);
this.grid1.Behaviors.Add(new Selection { RowSelectType = SelectType.Single, CellClickAction = CellClickAction.Row, Enabled = true }); this.grid1.RowSelectionChanged += grid1_RowSelectionChanged; this.grid1.Behaviors.Selection.RowSelectionChanged += Selection_RowSelectionChanged; this.grid1.Behaviors.Selection.AutoPostBackFlags.RowSelectionChanged = true;
Then I add columns manually and populate grid with my data (this.grid1.DataSource = ds; this.grid1.DataBind();). I tried to do this (add columns & DataBind) in Page_Load and in CreateChildControls methods and did not succseed in any of them?
Watching postback arguments I noticed changes and can determine row index from here(bold below)
grid1_clientState = [[null,[[[[[5]],[],null],[null,null],[null]],[[null,[],null],[{},[{}]],null],[[null,[],null],[{"1":[6,[{"index":1,"key":[1]}]]},
[[null,[[[[[5]],[],null],[null,null],[null]],[[null,[],null],[{},[{}]],null],[[null,[],null],[{"1":[6
,[{"index":1,"key":[1]}]]},
but I do not think it is the way it should work.
Can anyone suggest how WebDataGrid should properly be populated with custom data to make at least one of RowSelectionChanged events fire?
Or what flags/options/settings are missing?
Version I'm using: 10.3 SR2120 for ASP.Net
P.S.
I looked through these posts
http://news.infragistics.com/forums/p/58009/295833.aspxhttp://community.infragistics.com/forums/p/54773/282447.aspxand did not find anything helpful there unfortunately.
Hi Andrey,From what I see your question is related to the WebDataGrid control, not the WebGrid. Please try to make sure you post your questions in the correct forum section.Regarding your question, I have tested your scenario and noticed that you have EnableViewState set to false. When view state is disabled, your forms data is not persisting through postbacks, hence that is why your RowSelectionChanged handler is not firing.Therefore in order to get the index of your selected row, you would need to set either of the EnableViewState or EnableAjaxtViewState properties to true.Please let me know if this helps.Best Regards,Petar IvanovDeveloper Support EngineerInfragistics, Inc.http://es.infragistics.com/support
Thanks a lot, Petar
I did not find WebDataGrid section here http://community.infragistics.com/forums/427.aspx and posted to WebGrid. Sorry, can you show me where is proepr section for WebDataGrid?
You answer is just I wanted to hear. ViewState is mandatory for almost all server events of WebDataGrid to fire in my case (
Thanks again,Andrey
Hi Andrey,
I am glad everything worked out for you. For future reference the forum section, for the WebDataGrid can be found at:
http://community.infragistics.com/forums/196.aspx
Best Regards,
Petar IvanovDeveloper Support EngineerInfragistics, Inc.http://es.infragistics.com/support