Click here to Skip to main content
16,018,264 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi,
i am not getting how to retrive the data in griedview can you give me the solution of my problem
Posted
Updated 22-May-12 20:02pm
v2
Comments
Sandeep Mewara 23-May-12 11:42am    
What issue are you facing?

C#
protected void uxRoleCheckBoxSelector_CheckChanged(object sender, EventArgs e)
        {
            // Cast sender to CheckBox
            CheckBox activeCheckBox = (CheckBox)sender;
            // Retrieve the row where CheckBox is contained (NamingContainer used to retrive parent control
            GridViewRow row = (GridViewRow)activeCheckBox.NamingContainer; 
            // Retrive the Lable for an User name in a row
            Label myUserName = (Label)row.FindControl("uxUserNameLabelDisplayer");

            GridViewRow user = (GridViewRow)myUserName.NamingContainer;
            MembershipUser myUser = (MembershipUser)user.DataItem;


            if (activeCheckBox.Checked == true)
            {
                uxMessageDisplayer.Text = "T - Aproved User";
                myUser.IsApproved = true;
                Membership.UpdateUser(myUser);
            }
            else
            {
                uxMessageDisplayer.Text = "F - NOT Aproved User";
                myUser.IsApproved = false;
                Membership.UpdateUser(myUser);
            }
        }


this is the format more information visit http://stackoverflow.com/questions/3939942/asp-net-membershipuser-retrive-data-from-gridview[^]
 
Share this answer
 
v2
See this
http://msdn.microsoft.com/en-us/library/aa479341.aspx[^]
http://www.dotnetfunda.com/tutorials/controls/gridview.aspx[^]
you can bind gridview by code behind as

C#
 SqlConnection cn = new SqlConnection("Your ConnectionsString here");
SqlCommand cmd = new SqlCommand("Query to Retrieve data from                database",cn);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds, "Data");

gridview.DataSource = ds.Tables[0];
gridview.DataBind();
 
Share this answer
 
you need to click on "Add Data Source" from smart list.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900