gridview on a tab control

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
 
M

Mark Rae [MVP]

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();
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,067
Latest member
HunterTere

Latest Threads

Top