且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Gridview找不到记录问题

更新时间:2023-11-18 17:30:52

克里希纳,

您必须设置属性
Hi krishna,

you have to set the property
GridView.EmptyDataText = "No Record". 



如果您没有记录



if you have no record


在您的代码中进行一些小的修改

In ur code just make a small modification

protected void SqlDataSource1_Selected(object sender, SqlDataSourceStatusEventArgs e)
    {
        if (e.AffectedRows == 0)
        {
            //Label1.Text = "Hai Krishna";
            LabelNoRecord.Visible=True;
            LabelNoRecord.Text = "No Record Found";

        }
       else
        {
        LabelNoRecord.Visible=False;

        }


    }