C# Gridview Linkbutton Click Event
C# Gridview Linkbutton Click Event
1 of 5
http://www.dotnetspider.com/forum/279821-Asp-net-C-Gridview-linkbut...
Tutorials
Forum
Resources
Reviews
Jobs
Interview
Videos
Silverlight Games | Bookmarks | Mentor | Code Converter | IT Companies | Peer Appraisal | Members | Polls | Revenue Sharing
Looking for Max Asp? Find Max Asp on Facebook. Sign Up Free Now! www.Facebook.com
Need to translate? PROMT Standard 9.0 - an easy-to-use translation software.Try for free! promt.com
Web Designing Courses Find Top Web Designing Courses & Instiutes in India @ Shiksha.com www.Shiksha.com/Web-Designing
DotNetSpider
on Facebook
Like
2,327 people like
DotNetSpider.
Shweta
Sharath
Yogesh
Javaid
Abhishek
Shishir
Facebook social plugin
Online Members
Daby Schuurmans
More...
05-Apr-12 09:45 PM
2 of 5
http://www.dotnetspider.com/forum/279821-Asp-net-C-Gridview-linkbut...
Points: 1 Responses: 3
Hi all,
I am using linkbutton inside the gridview. and when i click the linkbutton i want to go to the next url with the query string of dropdown list that is in ouside of gridview. please anybody tell
.cs coding:
----------------protected void lbtnNext_Click(object sender, EventArgs e)
{
// [B]here i want to goto the detailed view page with the linkbutton value and querystring value of dropdown list name is ddlRooms that is outside of Gridview.[/B]
Response.Redirect("DetailedView.aspx?hn="+lbtnNext.Text+"&R="+ddlRooms.SelectedItem.ToString());
}
Error 4 The name 'lbtnNext' does not exist in the current context
thanks in advance
05-Apr-12 09:45 PM
3 of 5
http://www.dotnetspider.com/forum/279821-Asp-net-C-Gridview-linkbut...
Responses
#591158
Author:
Ravindran
Member Rank: 4
Date: 26/Feb/2011
Rating:
Points: 4
Hi refer my below code then only you clear grid view link button concept
Client side
I use grid view for show employee details..here employee no as link button
Server Side
You cannot get button text directly. You can get using gridview row command refer below code how can i get button text
using
using
using
using
using
using
using
using
System;
System.Collections.Generic;
System.Linq;
System.Web;
System.Web.UI;
System.Web.UI.WebControls;
System.Data;
System.Data.SqlClient;
05-Apr-12 09:45 PM
4 of 5
http://www.dotnetspider.com/forum/279821-Asp-net-C-Gridview-linkbut...
{
sqlcon.Open();
sqlcmd = new SqlCommand("select * from emp", sqlcon);
da = new SqlDataAdapter(sqlcmd);
da.Fill(dt);
GridView1.DataSource = dt;
GridView1.DataBind();
}
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "cmdBind")
{
LinkButton lb = (LinkButton)e.CommandSource;
Response.Redirect("GridHypher2.aspx?eno=" + lb.Text);
}
}
}
Regards
N.Ravindran
Your Hard work never fails
#591162
Author:
Anup
Date: 26/Feb/2011
Rating:
Points: 2
Hi,
#591247
Author:
Paritosh Mohapatra
Member Rank: 3
Date: 26/Feb/2011
Rating:
Points: 4
Paritosh Mohapatra
Microsoft MVP (ASP.Net/IIS)
DotNetSpider MVM
05-Apr-12 09:45 PM
5 of 5
http://www.dotnetspider.com/forum/279821-Asp-net-C-Gridview-linkbut...
Share
Tweet
Share
Like
Post Reply
This thread is locked for new responses. Please post your comments and questions as a separate thread.
If required, refer to the URL of this page in your new post.
Category: ASP.NET
Please Please help.................. tooo urgent
About Us
Trademark Disclaimer
Contact Us
Copyright
Privacy Policy
Terms Of Use
05-Apr-12 09:45 PM