1
votes

I have an ASPxGridView and 2 radio buttons on my project. When I change selection of the radio button group, it changes the select command of the data source. After that, when I clicked on 2nd page, the data source's select command changes into previous situation.

Here is the example.. http://www.2shared.com/file/HwnBYcFS/WebApplication8.html

Note: When the page loads data source filters 'Neo's, click on the "All" radio button, and change the page.

Thanks for answers..

1
Prehaps it is not stored in the Viewstate? Or is it excuting a piece code to return it to the previous situation? - Ruben
It should not execute, but I didn't understand is it executing. Did you try the example? - Erdinç Özdemir
No i can't try it on this pc. Have you tried looking if it is saved in viewstate? - Ruben
I have no idea how to do it. Can you explain it for me? - Erdinç Özdemir
btw the 2 radio buttons you use are those devexpress controls aswell? - Ruben

1 Answers

2
votes

1.add init event handler to grid
2.implement init event handler

protected void Grid_Init(object sender, EventArgs e)
{
    if (!IsCallback)
        Page.Session["selectCommand"] = null;

    if (Page.Session["selectCommand"] != null)
        AccessDataSource1.SelectCommand = (string)Page.Session["selectCommand"];
    grid.DataBind();
}

3.Change custom callback handler

protected void grid_CustomCallback(object sender, ASPxGridViewCustomCallbackEventArgs e)
{
    if (e.Parameters == "Neo")
    {
        AccessDataSource1.SelectCommand = "select Name,Surname from Person where Name='Neo'";
    }
    else if (e.Parameters == "All")
    {
        AccessDataSource1.SelectCommand = "select Name, Surname from Person";
    }
    Page.Session["selectCommand"] = AccessDataSource1.SelectCommand;
    grid.DataBind();
}

4.use CheckedChange client side event instead of gotfocus

<ClientSideEvents CheckedChanged="
    function(s, e)         
    {
        if(s.GetValue())
            grid.PerformCallback(&quot;Neo&quot;);
    }" />