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
510
get rowid (server side) & manipulate column data
posted

Is there a way to get rowID and identify cell (column) values based on that whenever a checkbox template column is checked in Ultrawebgrid?

I don't want this to  be done inside any webgrid event. I would like to loop through the rows to see the checkbox selected ones and then read the other column values based on that.

Thanks!

Parents
No Data
Reply
  • 12679
    Suggested Answer
    posted

    Hello,

    Assume that you have declared the checkbox in the aspx. page like this:

    <igtbl:TemplatedColumn Key="TemplateCheckBox">
       <CellTemplate>
          <asp:CheckBox ID="CheckBox1" runat="server" />
       </CellTemplate>
    </igtbl:TemplatedColumn>
    
    
    
    

    You can loop through all grid rows first cast the column that has  been declared as TemplatedColumn then check the CellItemes collection by index and invoke FindControl method which will return the checkbox associated with particular cell. 

    protected void Button2_Click(object sender, EventArgs e)

      {

        foreach (UltraGridRow row in UltraWebGrid1.Rows)

        {

            TemplatedColumn column = (TemplatedColumn)

                UltraWebGrid1.Columns.FromKey("TemplateCheckBox");

     

            CheckBox checkBox =

             ((CellItem)column.CellItems[row.Index]).FindControl("CheckBox1") as       CheckBox;

            if (checkBox.Checked)

            {

                //Do some stuff here

            }

        } 

      }

    Hope this helps.

Children