T
tshad
I have a GridView object that is using an ObjectDataSource, but when I get I
do a GridView1.DataBind(), the following method gets called:
<asp:ObjectDataSource ID="ObjectDataSource1" EnablePaging="true"
runat="server" SelectCountMethod="GetRowCount"
SelectMethod="BindControl" TypeName="AutoUPS.AutoUPS"
StartRowIndexParameterName="startRowIndex"
MaximumRowsParameterName="maximumRows">
</asp:ObjectDataSource>
public DataTable BindControl(int startRowIndex, int maximumRows)
{
SqlConnection con = new
SqlConnection(ConfigurationManager.ConnectionStrings["ConnectString"].ConnectionString);
SqlCommand com = new SqlCommand("GetValidFileDetails2", con);
com.CommandType = CommandType.StoredProcedure;
com.Parameters.Add("@RowIndex", SqlDbType.Int, 4).Value =
startRowIndex;
com.Parameters.Add("@MaxRows", SqlDbType.Int, 4).Value =
maximumRows;
SetData(ObjectDataSource1);
SqlDataAdapter ada = new SqlDataAdapter(com);
DataTable dt = new DataTable();
ada.Fill(dt);
return dt;
}
At this point both GridView1 and ObjectDataSource1 are null????
They weren't before when I did my GridView1.DataBind() and they weren't when
I went into my PageLoad.
So because of that I can't pass ObjectDataSource1 to my SetData program from
this method.
Why is that?
Thanks,
Tom
do a GridView1.DataBind(), the following method gets called:
<asp:ObjectDataSource ID="ObjectDataSource1" EnablePaging="true"
runat="server" SelectCountMethod="GetRowCount"
SelectMethod="BindControl" TypeName="AutoUPS.AutoUPS"
StartRowIndexParameterName="startRowIndex"
MaximumRowsParameterName="maximumRows">
</asp:ObjectDataSource>
public DataTable BindControl(int startRowIndex, int maximumRows)
{
SqlConnection con = new
SqlConnection(ConfigurationManager.ConnectionStrings["ConnectString"].ConnectionString);
SqlCommand com = new SqlCommand("GetValidFileDetails2", con);
com.CommandType = CommandType.StoredProcedure;
com.Parameters.Add("@RowIndex", SqlDbType.Int, 4).Value =
startRowIndex;
com.Parameters.Add("@MaxRows", SqlDbType.Int, 4).Value =
maximumRows;
SetData(ObjectDataSource1);
SqlDataAdapter ada = new SqlDataAdapter(com);
DataTable dt = new DataTable();
ada.Fill(dt);
return dt;
}
At this point both GridView1 and ObjectDataSource1 are null????
They weren't before when I did my GridView1.DataBind() and they weren't when
I went into my PageLoad.
So because of that I can't pass ObjectDataSource1 to my SetData program from
this method.
Why is that?
Thanks,
Tom