Hi,
I have a RadGrid and "Next" button in a user control and the user control is one of the wizard steps. The website is built in Sitefinity CMS.
I have a requirement to validate no.of records in RadGrid and display a message to user if there are no records. To put in another way, something like RequiredFiledValiation: the user should not be able to proceed to Next step if there are 0 records.
I tried the following.
1.
protected void RadGrid1_PreRender(object sender, EventArgs e)
{
RadGrid1.MasterTableView.AllowPaging = false;
RadGrid1.Rebind();
Label1.Text = RadGrid1.MasterTableView.Items.Count.ToString();
RadGrid1.MasterTableView.AllowPaging = true;
RadGrid1.Rebind();
}
2. Below code in ItemDataBound
if TypeOf e.Item is GridFooterItem Then
Label1.Text = RadGrid1.MasterTableView.Items.Count.ToString();
End If
3. In Page_Load(): Label1.Text = RadGrid1.MasterTableView.Items.Count.ToString();
Nothing worked, the count is always 0.
Please suggest me something definite.
Regards,
Siva Karthik