Quantcast
Channel: Web Forms
Viewing all articles
Browse latest Browse all 23244

Binding Checkbox itemTemplate with different dataset inside the Gridview

$
0
0
<Columns><asp:TemplateField><ItemTemplate><asp:CheckBox ID="chkStatus" AutoPostBack="true"  runat="server"/></ItemTemplate></asp:TemplateField><asp:BoundField DataField="DocGuid" HeaderText="Doc Name " /></Column>

i have a gridview with single BoundField DataField="DocGuid"

i have code bhind

private void LoadAllUsers()
        {
            using (SqlConnection conn = new SqlConnection(myConnection))
            {
                string myID = dpwUser.SelectedItem.Value.ToString();

                string query = "Select DocGuid from myTable p  where p.DocGuid IS NOT NULL";

                using (SqlCommand cmd = new SqlCommand(query, conn))
                {
                    SqlDataAdapter da = new SqlDataAdapter(query, conn);
                    DataTable table = new DataTable();
                    da.Fill(table);
                    gvUserData.DataSource = table;
                    gvUserData.DataBind();

                }
                

            }           


        }

Everything is fin e so far. My Gridview is binding on Page Load

but i have another table based on that i have to bind checkbox inside the gridview .

How can i bind that Checkbox with separate query or any other idea you can provide me.

Here is my table structure

User    

UserID

DocGuid

Document

DocGuisd

DocName


Two tables are not normalized.

Any suggesstion would be great

 



 


Viewing all articles
Browse latest Browse all 23244

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>