Click here to Skip to main content
12,547,231 members (64,529 online)
Rate this:
Please Sign up or sign in to vote.
See more: ASP.NET
I have created a one form which consits of various fields.
this fields data i have succesfully saved in the database.
Now i have created one more form which consits of one drop down list.
i want drop down list should contain a primary key value,and after selecting a particular value value from dropdown list the whole details of that associated primary key should be display in the gridview.

This is what i have done in the first page.
In the following code stdid is a Primary key of the table.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;
public partial class FillInformation : System.Web.UI.Page
    SqlConnection con;
    protected void Page_Load(object sender, EventArgs e)
    protected void Button1_Click(object sender, EventArgs e)
        SqlConnection con= new SqlConnection("server=SACHIN-5DDBFA03\\SACHIN;uid=sa;password=india;database=master");
        SqlCommand cmd = new SqlCommand("insert into Students_Details values(@stdid,@sfname,@slname,@Maths,@Science,@SocialScience,@Address)",con);
        cmd.Parameters.Add("@Maths", txtmath.Text);
        cmd.Parameters.Add("@Science", txtscience.Text);
        cmd.Parameters.Add("@SocialScience", txtsoscience.Text);
        Response.Write("One Record Inserted Succesfully");
    protected void next_Click(object sender, EventArgs e)
can any 1 give coding for the second page.
Please give me easy solution as much as possible.
Posted 14-Dec-12 21:44pm
Updated 14-Dec-12 21:48pm
01010RAJ 15-Dec-12 4:32am
Solution 1 is ur answer.

1 solution

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

Solution 1

No, we won't give you solution.. We can't work out for you like this.. You should try it by yourself.. If you got stuck somewhere, you can certainly come here.. But don't ask directly for code..

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
Web01 | 2.8.161018.1 | Last Updated 15 Dec 2012
Copyright © CodeProject, 1999-2016
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