J
jerrygp
Hello:
my problem resides on the following, off course I do dataBinding to a
gridview by a class created under Vs2005 c#.
I do databinding to my gridview smooth and works fine when i call the
method to databind to my gridview, but when I allowPaging = true by
code or by designer, and after calling the same method listed right
below, I get no data.
please see my code. Any help will be appreciated and shared with
anyone.
public Boolean gridViewDataBind(ref System.Web.UI.WebControls.GridView
myGv, string mySqlStr, string[] PkFields )
{
Boolean result = false;
if (mySqlConn.State != ConnectionState.Open)
getConnected();
try
{
SqlCommand sqlCommand = new SqlCommand(mySqlStr,
mySqlConn);
SqlDataReader dr = sqlCommand.ExecuteReader();
myGv.DataSource = dr;
myGv.DataKeyNames = PkFields; // PK field
myGv.DataBind();
myGv.AllowPaging = true;
myGv.PageSize = 10;
dr.Dispose();
sqlCommand.Dispose();
result = true;
}
catch { result = false; }
return result;
}
my problem resides on the following, off course I do dataBinding to a
gridview by a class created under Vs2005 c#.
I do databinding to my gridview smooth and works fine when i call the
method to databind to my gridview, but when I allowPaging = true by
code or by designer, and after calling the same method listed right
below, I get no data.
please see my code. Any help will be appreciated and shared with
anyone.
public Boolean gridViewDataBind(ref System.Web.UI.WebControls.GridView
myGv, string mySqlStr, string[] PkFields )
{
Boolean result = false;
if (mySqlConn.State != ConnectionState.Open)
getConnected();
try
{
SqlCommand sqlCommand = new SqlCommand(mySqlStr,
mySqlConn);
SqlDataReader dr = sqlCommand.ExecuteReader();
myGv.DataSource = dr;
myGv.DataKeyNames = PkFields; // PK field
myGv.DataBind();
myGv.AllowPaging = true;
myGv.PageSize = 10;
dr.Dispose();
sqlCommand.Dispose();
result = true;
}
catch { result = false; }
return result;
}