我收到此错误。在'GridView1'上定义了DataSource和DataSourceID。删除一个定义 [英] I am getting this error.Both DataSource and DataSourceID are defined on 'GridView1'. Remove one definition
本文介绍了我收到此错误。在'GridView1'上定义了DataSource和DataSourceID。删除一个定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
try
{
SqlParameter[] check_login_details = new SqlParameter[]
{
new SqlParameter("@usertype","Distributor"),
new SqlParameter("@User_details","manit.ashish"),
new SqlParameter("@Password","12345"),
new SqlParameter("@ErrorResult",SqlDbType.Int),
};
check_login_details[3].Direction = ParameterDirection.Output;
DataSet ds = SqlHelper.GetDataSet(SqlHelper.mainConnectionString, CommandType.StoredProcedure, "UDP_CHECK_USERLOGIN_DETAILS", check_login_details);
GridView1.DataSource = ds;
GridView1.DataSourceID = String.Empty;
GridView1.DataBind();
ddl_type.SelectedItem.Text = "Select";
txt_pwd.Text = "";
txt_uname.Text = "";
}
catch (Exception ex)
{
lblerror.Text = Convert.ToString(ex);
}
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false">
<Columns>
<asp:BoundField HeaderText="loginid" DataField="LOGINID" />
<asp:BoundField HeaderText="EMAILID" DataField="EMAILID" />
</Columns>
</asp:GridView>
推荐答案
删除
Hi,
remove
GridView1.DataSourceID = String.Empty;
您不必同时指定DataSourceID和DataSource。
希望这会有所帮助。
you do not have to specify both DataSourceID and DataSource.
Hope that will help.
这篇关于我收到此错误。在'GridView1'上定义了DataSource和DataSourceID。删除一个定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文