Bind A Record from database to a form By Clicking hyper linkDawood Abbas11yAsked Mar 10, 2015, 12:04 AM EDTSolvedShareLinkedInXCopy linkSavehow to bind A Record from database to a form By Clicking hyper link in gridview row?
Bind A Record from database to a form By Clicking hyper linkDawood Abbas11yAsked Mar 10, 2015, 12:04 AM EDTSolvedShareLinkedInXCopy linkSavehow to bind A Record from database to a form By Clicking hyper link in gridview row?
Azaad Abbas127 reputation11y agoPosted Mar 10, 2015, 10:59 PM EDT✓ Accepted answer0Design Sideasp:GridView ID="gridCustomer" runat="server" AutoGenerateColumns="False" onrowcommand="gridCustomer_RowCommand"> Columns>Code Behind Sideprotected void gridCustomer_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "VIEW") { int row = Convert.ToInt32(e.CommandArgument); Session["UserId"] = row; Response.Redirect("~/Update Pages/RegCustUpdateAndDelete.aspx"); } } New Form's CodeBehind Side protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { try { //open the db connection if it is closed... if (connection.State == ConnectionState.Closed) connection.Open(); int uid = Convert.ToInt32(Session["UserId"]); command = new SqlCommand(); command.CommandText = "sp_Get_CustFields"; command.CommandType = CommandType.StoredProcedure; command.Connection = connection; command.Parameters.AddWithValue("@uid", uid); SqlDataAdapter daPack = new SqlDataAdapter(command); DataSet dsPack = new DataSet(); daPack.Fill(dsPack); txtName.Text = dsPack.Tables[0].Rows[0]["Name"].ToString(); txtSo.Text = dsPack.Tables[0].Rows[0]["SoDoWo"].ToString(); txtAdd.Text = dsPack.Tables[0].Rows[0]["Address"].ToString(); txtMobNo.Text = dsPack.Tables[0].Rows[0]["MobNo"].ToString(); catch (Exception ex) { lblMessage.Text =ex.Message; lblMessage.Visible = true; } finally //Close db Connection if it is open.... { if (connection.State == ConnectionState.Open) connection.Close(); } }0Manish Kumar ChoudharyRank #339 · 7.4K reputation11y agoPosted Mar 10, 2015, 1:20 AM EDT0 Go through following links it will help you http://www.aspsnippets.com/Articles/Convert-GridView-Column-into-HyperLink-Fields-in-ASPNet.aspx http://stackoverflow.com/questions/21930183/create-hyperlink-button-cells-in-gridview-using-c-sharp-asp-net 0Join to answer this questionEvery answer you publish earns 20 SHARP.Create free accountSign inKnow the answer?Answer a question in the forums and earn +20 SHARP for every answer.See unanswered questionsForumsTop experts01Arun PottiAnswers in the forums20answers02Tahir AnsariAnswers in the forums5answers03Kamlesh KumarAnswers in the forums5answers04Sam HobbsAnswers in the forums4answers05Željko PerićAnswers in the forums3answers?YouYour name goes here.Every answer: 20 SHARP.JoinFull leaderboard →2026DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Manish Kumar ChoudharyRank #339 · 7.4K reputation11y agoPosted Mar 10, 2015, 1:20 AM EDT0 Go through following links it will help you http://www.aspsnippets.com/Articles/Convert-GridView-Column-into-HyperLink-Fields-in-ASPNet.aspx http://stackoverflow.com/questions/21930183/create-hyperlink-button-cells-in-gridview-using-c-sharp-asp-net 0
Azaad Abbas127 reputationPosted Mar 10, 2015, 10:59 PM EDT
asp:GridView ID="gridCustomer" runat="server" AutoGenerateColumns="False" onrowcommand="gridCustomer_RowCommand">
Columns>
Code Behind Side
New Form's CodeBehind Side
try
Manish Kumar ChoudharyRank #339 · 7.4K reputationPosted Mar 10, 2015, 1:20 AM EDT
Go through following links it will help you
http://www.aspsnippets.com/Articles/Convert-GridView-Column-into-HyperLink-Fields-in-ASPNet.aspx
http://stackoverflow.com/questions/21930183/create-hyperlink-button-cells-in-gridview-using-c-sharp-asp-net
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questionsTop experts