Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
640
Neither RowSelectionChanged nor Selection.RowSelectionChanged is fired on PostBack
posted

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]}]]},

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.aspx
http://community.infragistics.com/forums/p/54773/282447.aspx

and did not find anything helpful there unfortunately.

Parents
No Data
Reply
  • 49378
    Verified Answer
    posted

    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 Ivanov
    Developer Support Engineer
    Infragistics, Inc.
    http://es.infragistics.com/support

Children