473,396 Members | 1,961 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How to get text of gridview buttonfield

I have a gridview. One of the columns is a buttonfield. I use the
datatextfield property of buttonfield to show my bound value as a hyperlink
in each buttonfield cell. I then want to get that text in the rowdatabound
event. I can get it easily for each boundfield cell but not for the
buttonfield. Please help. Thanks.
Dec 14 '05 #1
1 4858
void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
//use this syntax to get the text from the dataitem that was bound
to the grid
string myText = ((DataRowView)e.Row.DataItem)[FieldName].ToString ();
//use this syntax to get the text from the ViewState of the GridView
string myText2 =
((LinkButton)e.Row.Cells[ColNumWhereTheLinkIs].Controls[0]).Text;
}
}
--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"lanem" wrote:
I have a gridview. One of the columns is a buttonfield. I use the
datatextfield property of buttonfield to show my bound value as a hyperlink
in each buttonfield cell. I then want to get that text in the rowdatabound
event. I can get it easily for each boundfield cell but not for the
buttonfield. Please help. Thanks.

Dec 14 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Edwin Knoppert | last post by:
I post this again, no answer before. During the beta version it worked, the same code does no longer work in the new release. I have a simple gridview with ButtonField, the button deletes a...
0
by: Krish | last post by:
Hello, I have GridView and after binding data i can see cells empty only (empty row is created), but i checked database there is data available. I just started using GridView, trying to learn...
6
by: Terry | last post by:
Good morning! How do I determine which SELECT button was clicked in a GridView? The multiple SELECT buttons will be used for an application approval process. Thank you in advance for your...
1
by: Jeff | last post by:
Hey asp.net 2.0 I have this GridView in my web page. My problem is that it get populated with all the fields of the MembershipUser class. I thought only UserName would be displayed, but it...
3
by: GaryDean | last post by:
I have a button field in a gridview defined as follows: <asp:ButtonField ButtonType="Button" CommandName="AcceptOrder" Text="Accept Whole Order"> <ControlStyle Font-Size="X-Small" />...
1
by: moni | last post by:
Hi, I was hoping to know how I could get the text value of a gridview row. My code is this way: <asp:GridView ID="GridView1" runat="server" AllowSorting="True" AutoGenerateColumns="False"...
0
by: aj123 | last post by:
I have Table News NewsID, int NewsHeadLint, varcahr(200) OrderNews, int I gridView Display as following query Select ID,NewsHeadLine from News order By OrderNews DESC ---- <asp:GridView...
0
by: jrnail23 | last post by:
I have a user control which contains an UpdatePanel, which contains a MultiView inside, with a GridView in one of the views. In my GridView, I have a ButtonField which is supposed to trigger a...
1
by: silpa | last post by:
Hi, I have a gridview. It has two columns.first column contains a thread. Second column contains an image which is of type buttonfield to close this thread which is shown below. The image is a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.