Click here to Skip to main content
11,720,785 members (80,646 online)
Rate this: bad
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 14:34pm
Edited 12-Jul-12 14:43pm
Wes Aday at 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
0 Sergey Alexandrovich Kryukov 2,199
1 OriginalGriff 959
2 F-ES Sitecore 640
3 Maciej Los 609
4 Richard MacCutchan 540

Advertise | Privacy | Mobile
Web03 | 2.8.150901.1 | Last Updated 13 Jul 2012
Copyright © CodeProject, 1999-2015
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