gridview on a tab control

  • Thread starter Thread starter JohnE
  • Start date Start date
J

JohnE

I have a page that is using a tab control. This tab control is showing all
the information about a change request. Which includes other tables that are
the many to the one record. An example would be the change request being
initiated has an affect on ms office, sql server, ssrs, etc. One tab will
have a gridview that will show the areas the request affects. The PK and FK
are established between the tables. There is a dropdownlist above the tab
control that when the request is selected, all the fields in the tab control
(including the gridviews) show the info associated with the selected request.
The ddl is using a sqldatasource.

How do I go about having the gridview work along with the rest of the fields
to show the information associated with the selected request?

Thanks...John
 
I have a page that is using a tab control. This tab control is showing
all
the information about a change request. Which includes other tables that
are
the many to the one record. An example would be the change request being
initiated has an affect on ms office, sql server, ssrs, etc. One tab will
have a gridview that will show the areas the request affects. The PK and
FK
are established between the tables. There is a dropdownlist above the tab
control that when the request is selected, all the fields in the tab
control
(including the gridviews) show the info associated with the selected
request.
The ddl is using a sqldatasource.

How do I go about having the gridview work along with the rest of the
fields
to show the information associated with the selected request?

If I were doing this, I'd do the following:

1) Create a stored procedure to fetch the data for populating the GridView

CREATE PROCEDURE MyProc
@pID int
AS

SELECT * FROM MyTable
WHERE ID = COLLATE(pID, ID)


2) Add the following to the DropDownList SelectedIndexChanged event

protected void MyDDL_SelectedIndexChanged(object sender, EventArgs e)
{
SqlParameter objSqlParameter;
List<SqlParameter> lstSqlParameters = new List<SqlParameter>();

objSqlParameter = new SqlParameter("@pID", SqlDbType.Int);
objSqlParameter.IsNullable = true;
objSqlParameter.Value = Convert.ToInt32(MyDDL.SelectedValue);
lstSqlParameters .Add(objSqlParameter);

MyGridView.DataSource = DAL.GetDataSet("MyProc", lstSqlParameters);
MyGridView.DataBind();
}
 
Back
Top