ASP.NETでSQLテーブルからデータを読み込んでグリッドビューで表示し、行データバインドEvent.Butを使用してプログラムを実行すると、この例外が発生するコードの指定された声明の中で「型 『System.StackOverflowException』の未処理の例外がmscorlib.dllで発生したが、」:mscorlib.dllでSystem.StackOverflowException型の未処理例外が発生しました
private void BindAllUsers()
{
SqlDataAdapter da = new SqlDataAdapter("SELECT ID, Name, Email, Password, Contact, CreatedOn, CreatedBy,CreatedIP From tbl_Users",con);
DataSet ds = new DataSet();
da.Fill(ds); <------(Error occurs in this line)
gdv_Users.DataSource = ds;
gdv_Users.DataBind();
}
をRowDataBoundEventハンドラは次のとおりです。
protected void gdv_Users_RowDataBound(object sender, GridViewRowEventArgs e)
{
e.Row.Cells[0].Style["Cursor"] = "hand";
e.Row.Cells[0].ToolTip = "Click Here";
e.Row.Cells[0].Attributes.Add("onclick","window.open('Details.aspx'?ID=" + e.Row.Cells[0].Text.ToString()+"'Details';'width = 735,height= 350,left = 220,top = 300,resizable = 0,scrollbars = 0,status = no')");
}
BindAllUser機能がありますここに呼び出される:
protected void Page_Load(object sender, EventArgs e)
{
BindAllUsers();
BindDropDown();
}
あなたは、Visual Studioのコールスタックに何を見ていますか? – SLaks
私はあなたがOnRowDataBoundEventのBindAllUsersを呼び出していると思います。また、グリッドを再び無限ループに陥らせているためです。 RowDataaBoundイベントハンドラを投稿できますか? – Chandu
@Rachit:BindAllUsersメソッドを呼び出す場所にコードを投稿することはできますか? – Chandu