handle a selected row on C1Grid

Posted by: fbalbi on 10 September 2017, 11:34 am EST

  • Posted 10 September 2017, 11:34 am EST

    I would like to be able to select a row from a c1gridview and based on a column value go to another page. I am having a hard time to trigger the row selection avoiding using the AutoGenerateSelectButton option (users might click anywhere in the row). I would either double click the row to redirect the browser to the new page or maybe have a button I can click after I select the row.


    Thanks

  • Replied 10 September 2017, 11:34 am EST

    Hi,


     
    void C1GridView1_RowCreated(object sender, C1GridViewRowEventArgs e)
    {
    if (e.Row.RowType == C1GridViewRowType.DataRow)
    {
    e.Row.Attributes.Add("onclick", string.Format("__doPostBack('C1GridView1','Select:{0}')", e.Row.RowIndex));
    }
    }



    Then in the SelectedIndexChanged event handler you can get the needed value from C1GridView.SelectedRow.DataItem and perform redirect.


    Regards,


    Sergey.

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels