473,597 Members | 2,459 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 4907
void GridView1_RowDa taBound(object sender, GridViewRowEven tArgs e)
{
if (e.Row.RowType == DataControlRowT ype.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[ColNumWhereTheL inkIs].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
6217
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 records. So i want to add a confirm in javascript. How will i set the javascript function (OnClientClick) for this ButtonField?
0
1120
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 after using DataGrid, pardon my ignorance. Here is the code. public void ImageButtonSubmit(object sender, ImageClickEventArgs e) { string SQL;
6
10078
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 support in this matter.
1
1366
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 displays all fields <asp:GridView ID="gvwOnline" runat="server"> <Columns>
3
22517
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" /> </asp:ButtonField> In the RowCommand event I have the following code: if ((string)e.CommandName.ToLower() == "acceptorder") { int myRow = int.Parse(e.CommandArgument.ToString());
1
5475
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" BackColor="#8080FF" BorderColor="#0000C0" BorderStyle="None" BorderWidth="1px" CellPadding="3" CellSpacing="2" Font- Size="Large" Height="192px" Width="243px"
0
1296
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 ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="NewsID" EmptyDataText="There are no data records to display." DataSourceID="SqlDataSource1" Style="position: relative; left: 4px; top: 44px;"...
0
3159
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 server-side operation, using the RowCommand functionality. In IE, this all works great, but in Firefox (v2.0.0.6), clicking the above mentioned ButtonField fires off two similar AJAX requests, which is causing errors in my server-side code. ...
1
1006
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 key icon. <asp:ButtonField ButtonType="Image" ImageUrl="~/Images/key.gif" CommandName="Close"> <ItemStyle HorizontalAlign="Center" Width="20px" /> </asp:ButtonField>
0
7971
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8276
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8381
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8040
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6698
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5436
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2408
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1495
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1243
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.