473,382 Members | 1,252 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,382 software developers and data experts.

Button Text from a DataGrid?

Having a brain fart this morning :(

I need to take the text of a button in a datagrid. <Grid could be sorted so
I need it's data that is displayed>

Button Click fires:

public void ShowModel(object sender, DataGridCommandEventArgs e) { string
lcCommand = e.CommandName; if (lcCommand != "sort")

{

// Code here for # in the grid used to go against ds.

// no longer works with sort buttons on top of grid.

// ____________

// string lcstring = e.Item.DataSetIndex.ToString();

// int lnstring = Convert.ToInt32(lcstring);
New code here, but it brings up control info and not text on control. string
lctr = e.CommandSource.ToString();
Any ideas?

TIA


--
Stephen Russell
S.R. & Associates
Memphis TN

901.246-0159
Nov 17 '05 #1
2 1380
//Get button text

string strBtnTxt = ((Button)e.CommandSource).Text;

"Stephen Russell" <srussell@notat_lotmate.com> wrote in message
news:eP**************@tk2msftngp13.phx.gbl...
Having a brain fart this morning :(

I need to take the text of a button in a datagrid. <Grid could be sorted so I need it's data that is displayed>

Button Click fires:

public void ShowModel(object sender, DataGridCommandEventArgs e) { string
lcCommand = e.CommandName; if (lcCommand != "sort")

{

// Code here for # in the grid used to go against ds.

// no longer works with sort buttons on top of grid.

// ____________

// string lcstring = e.Item.DataSetIndex.ToString();

// int lnstring = Convert.ToInt32(lcstring);
New code here, but it brings up control info and not text on control. string lctr = e.CommandSource.ToString();
Any ideas?

TIA


--
Stephen Russell
S.R. & Associates
Memphis TN

901.246-0159

Nov 17 '05 #2
//Get button text

string strBtnTxt = ((Button)e.CommandSource).Text;

"Stephen Russell" <srussell@notat_lotmate.com> wrote in message
news:eP**************@tk2msftngp13.phx.gbl...
Having a brain fart this morning :(

I need to take the text of a button in a datagrid. <Grid could be sorted so I need it's data that is displayed>

Button Click fires:

public void ShowModel(object sender, DataGridCommandEventArgs e) { string
lcCommand = e.CommandName; if (lcCommand != "sort")

{

// Code here for # in the grid used to go against ds.

// no longer works with sort buttons on top of grid.

// ____________

// string lcstring = e.Item.DataSetIndex.ToString();

// int lnstring = Convert.ToInt32(lcstring);
New code here, but it brings up control info and not text on control. string lctr = e.CommandSource.ToString();
Any ideas?

TIA


--
Stephen Russell
S.R. & Associates
Memphis TN

901.246-0159

Nov 17 '05 #3

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

Similar topics

3
by: Zürcher See | last post by:
Someone has implemented a Datagrid Button for the Windows.Form?
0
by: Oz | last post by:
Hi Using VS.NET 2003, Windows XP SP1, We have a page which has been developed using ASP.NET. On it, is a button which when clicked is supposed to add some data to a table. When the button is...
10
by: william | last post by:
Hi, I have a datagrid, inside there is a templete item, it's button. I want to do some thing when user click the button, but do not want the postback event happens. How can I do it? Thanks. ...
1
by: Stu | last post by:
Hi, I have a button in the footer of a datagrid that sometimes does not tigger the item command. The page is quite large & has a number of homegrown controls in it. Has anyone come across this...
4
by: John Boy | last post by:
Hi, Can anyone help. This is really doing my nut in. 3 years ASP exp. and now doing .DOT which is a step in the wrong direction. Basically I am left with the code of a guy who has left. When I...
5
by: Jeff User | last post by:
Hello ..NET 1.1, VS 2003, C# & asp.net I have tried to follow msdn instructions and samples but I can not get an event to fire for this button on the datagrid. There has to be something obvious...
7
by: rsaffy | last post by:
I am having trouble with my dynamically created button's event handling. I read that the buttons need to be recreated on every trip to the server, but how exactly do you do that when the datagrid...
2
by: toddw607 | last post by:
Hi all! I am attempting to bring an SQL Server table into ASP.NET using the datagrid . I have set all cells to be a text box by which the user can just click on and edit the cell. I have a...
1
by: geeteshss | last post by:
Dear all, actually i spent a whole month on the R&D of datagrid edit ,update,cancel events but recently my guide told me to make it user friendly because no user would like to go on searching rows...
2
by: slinky | last post by:
I had a successfully deployed datagrid reading an XML file and showing the data: Private Function MakeDataView() as DataView Dim myDataSet As New DataSet()...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
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...

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.