You must Sign In to post a response.
  • Category: ASP.NET

    How to add dropdownlist selected value to gridview

    In run mode as follows

    Course Code AMC (Dropdownlist) Major Code AFF (Dropdownlist) Button(ADD)

    When i click ADD button i want add the dropdownlist list selected value AMC and AFF to be added in gridview.

    I have one gridview as follows

    Course Code Major Code

    for that how can i do in using c#.

    Narasiman P.
  • #762200
    Hi rao,

    Without saving the records into database you want to show it into gridview...?

    If this is the case then maintain data into one table and store that information into ViewState and based on view state data you can bind your gridview. You can achieve this by following below code.

    protected void btnAdd_Click(object sender, EventArgs e)
    //Create DataTable with columns whatever you want to bind in grid.

    DataRow dr= dt.NewRow();

    //now row is inserted into your temporary table, store that into one state object.

    Whenever you want to bind data to gridview bind it from viewstate object.

    Hope this will helpful to you...

    Give respect to your work, Instead of trying to impress your boss.

    Blog :

Sign In to post your comments