Click here to Skip to main content
12,702,596 members (34,548 online)
Rate this:
Please Sign up or sign in to vote.
See more: C# ADO.NET
I am working on three datagrid web applicaion on one web page (ASPX) which share on paramete which is Primarykey I like to insert parameter in textbox which populte three datagrid My parameter is INT datatype and I already wrote 3 store proc which has same serial number. Thank you in advance.
Posted 12-Jul-12 15:34pm
Updated 12-Jul-12 15:43pm
Wes Aday 12-Jul-12 21:04pm
I am quite sure that someone, somewhere is overjoyed that you have gainful employment. Do you have an actual question or did you just stop by to let us know that you have some work to do?

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1


find the sample code bellow:

<pre lang="c#">
bindGrids(GridView1, txtSerialNumber.Text, "procSample1", "@param");
bindGrids(GridView2, txtSerialNumber.Text, "procSample2", "@param");
bindGrids(GridView3, txtSerialNumber.Text, "procSample3", "@param");

The method deifnation is:
private void bindGrids(GridView gvControl, string serialNumber, string storedProcedure, string sqlParameterName)
            SqlConnection dbCon = new SqlConnection("Data Source = .; Initial Catalog=ContosoHR; Integrated Security=True");
            SqlCommand dbcmd = new SqlCommand(storedProcedure, dbCon);
            dbcmd.CommandType = CommandType.StoredProcedure;
            SqlParameter param = new SqlParameter(sqlParameterName, serialNumber);
            DataSet dSet = new DataSet();
            SqlDataAdapter dbAdp = new SqlDataAdapter(dbcmd);
            gvControl.DataSource = dSet;
        catch (Exception ex)



This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170118.1 | Last Updated 13 Jul 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100