WebGrid RowChecker column not persisting on postback so GetCheckedRows is always empty

4 replies. Last post: June 19, 2011 10:44 PM by Lili Khiung
Tags :
  • New Discussion
  • New Question
  • New Product Feedback
Neil TurnerMember

Hi

I have a Webgrid with a RowChecker and a button to run an action on the checked rows.

However getCheckedRows always returs empty and on clickikg the button all the checkboxes in the grid are cleared.

I have coopied the code posted on this forum before but it still returns 0. I am using WebGrid 7

This is the op of my grid

    <ISWebGrid:WebGrid ID="wgArchive" runat="server" DataSourceID="sdsAppointments">

        <RootTable Caption="Visits" DataKeyField="EntityId">

            <Columns>

                <ISWebGrid:WebGridColumn ColumnType="CheckBox" IsRowChecker="True" Name="RowChecker">

                </ISWebGrid:WebGridColumn>


And this is the code the button runs

        protected void btnArchive_Click(object sender, EventArgs e)

        {

            lbMsg.Text = wgArchive.RootTable.Rows.Length.ToString() + " rows affected ";

            foreach (string keyValue in wgArchive.RootTable.GetCheckedRows())

            {

                lbMsg.Text += keyValue + " ; \n";

            }

        }


All times are GMT -5. The time now is 7:11 AM.
Previous Next