Click here to Skip to main content
12,401,654 members (57,861 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: Gridview checkbox buttons , +
Hi All,

I have a big clarification in grid view, this question something interesting and also little duff.

I have table of three field namely id, name and destination

I know already how to add and display this three columns in grid view including check box & button for each row generated and fetching third column in drop down list.

I need to know when i checked the check box of particular column,then the drop down list item is selected and last finally the button is click, the output needed is another grid view (nested grid view)displaying the select row information.

I know its very interesting and simple for experts?

aspx code

<<blockquote class="FQ"><div class="FQA">Quote:</div>%@ Page Language="C#" AutoEventWireup="true" CodeFile="ltest.aspx.cs" Inherits="ltest" %>


cs code

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
 
public partial class ltest : System.Web.UI.Page
{
    DropDownList bind_dropdownlist;
    
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            gv();
 
        }
 
    }
    public void gv()
    {
 
        SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["ltest"].ToString());
        con.Open();
        string str = "select * from ltest";
        SqlCommand cmd = new SqlCommand(str,con);
        DataTable dt = new DataTable();
        SqlDataAdapter da = new SqlDataAdapter(cmd);
        da.Fill(dt);
 
        if (dt.Rows.Count > 0)
        {
            GridView1.DataSource = dt;
            GridView1.DataBind();
            foreach (GridViewRow grdRow in GridView1.Rows)
            {
                bind_dropdownlist = (DropDownList)(GridView1.Rows[grdRow.RowIndex].Cells[2].FindControl("dd_desghnation"));
                bind_dropdownlist.DataSource = dt;
                bind_dropdownlist.DataValueField = "ID";
                bind_dropdownlist.DataTextField = "detination";
                bind_dropdownlist.DataBind();
            }
 
        }
 

    }
    }
Posted 16-Mar-12 14:28pm
nachia418

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.160721.1 | Last Updated 16 Mar 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