hello everyone... i will fill my page (containing controls) with all gridview's data (without selecting)...but how?
thanks for your respond, kind regards
hello everyone... i will fill my page (containing controls) with all gridview's data (without selecting)...but how?
thanks for your respond, kind regards
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Mohammad HussainRank #513 · 4.8K reputationPosted Jul 25, 2023, 6:19 AM EDT
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { // Your code to fetch data and bind the GridView DataTable dt = GetGridViewData(); // Replace this with your data retrieval logic GridView1.DataSource = dt; GridView1.DataBind(); } }protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { // Get the data item from the current row DataRowView dataItem = (DataRowView)e.Row.DataItem; // Check if the row is not selected (You can use your own logic to determine unselected rows) // For example, if you have a boolean column named "IsSelected", you can check its value here bool isSelected = Convert.ToBoolean(dataItem["IsSelected"]); if (!isSelected) { // Populate the controls with unselected data txtColumn1.Text = dataItem["Column1"].ToString(); txtColumn2.Text = dataItem["Column2"].ToString(); // Populate more controls as needed } } }