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

How to Access LinkButton.Text

I need to know when a link buttons value is zero so I don't try to run a
query to find none.

When I was using ViewState(ds_Last), which I can't do because certain phones
are choking on the data, I have on avg about 12 rows of data.

Apparently that's way too much data for some phones, nearing 30k.

So I've abondoned ViewState and I'm trying to get the value from the
datagrid, I see that it can be done but I may be missing something that will
make it all work.

'This works well... (except for ViewState overhead)
Dim myRow as DataRow = CType(ViewState("ds_Last"),
DataSet).Tables(0).Rows(e.Item.ItemIndex)
Case Right(sCoMander,1) = "S"
.... intEventCount = myRow.Item("Sales")....
If intEventCount >= 1 Then... do stuff load next datagrid of "Sales"

'populate my datagrid
dgFutureSM.DataSource = dsF.Tables(0)
dgFutureSM.DataBind()

'renders a datagrid similar to.....
|Future Data
SalesPerson, Calls, Apts, Sales, Totals
-------------------------------------
Gilia Swifting 12 7 6 25
Steve Colbert 32 9 8 49
Rusty Nail 6 1 0 7

<asp:Datagrid ... DataKey="UserID"....
<asp:TemplateColumn HeaderText="Sales"....
<asp:LinkButton id="btnSelectSMFS" CommandName=="SelectSalesSMFS"....

Selecting Rusty Nail's Sales link button value zero, or any link button
renders an empty string

Pvt Sub dgSM_ItemCmd(byVal Src as obj, byVal e as
Sys.Web.UI.WebCtrls.DgCmdEventArgs) handles dgHistorySM.ItemCmd,
dgFuture.ItemCmd

'get current dg name
Dim dg as DataGrid = e.Items.NamingContainer

'get index UserID for nxt sProc
Dim UserID as String = dg.DataKeys(e.Item.ItemIndex)

'get nxt step, FS, load future sales for respective UserID
Dim sCoMander as String = Right(e.CommandName,2)

'here's where I'm failing, I know which cell it is, I've verified the ID,
however I've stepped thru all of my linkbuttons and their text value = ""
Dim lnkBtnText as String = Ctype(e.Item.Cells(1).Controls(1),
LinkButton).Text

If I check column(4) which is an <asp:BoundColumn of totals, I do see the
value "7" but not in any of my linkbuttons for columns Calls, Apts and
Sales.

TIA

JeffP....
If you think this is crossposted that's only because there wasn't any
action....
Sep 13 '06 #1
1 3691
My error, <asp:TemplateColumns with a linkButton: although intellisense
doesn't offer a Text= adding it as Text='<% # DataBinder.Eval(Container,
"DataItem.FieldName") %>... JeffP....

"JeffP@Work" <jpgmt_at_sbcglobal_dot_netwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
>I need to know when a link buttons value is zero so I don't try to run a
query to find none.

When I was using ViewState(ds_Last), which I can't do because certain
phones are choking on the data, I have on avg about 12 rows of data.

Apparently that's way too much data for some phones, nearing 30k.

So I've abondoned ViewState and I'm trying to get the value from the
datagrid, I see that it can be done but I may be missing something that
will make it all work.

'This works well... (except for ViewState overhead)
Dim myRow as DataRow = CType(ViewState("ds_Last"),
DataSet).Tables(0).Rows(e.Item.ItemIndex)
Case Right(sCoMander,1) = "S"
... intEventCount = myRow.Item("Sales")....
If intEventCount >= 1 Then... do stuff load next datagrid of "Sales"

'populate my datagrid
dgFutureSM.DataSource = dsF.Tables(0)
dgFutureSM.DataBind()

'renders a datagrid similar to.....
|Future Data
SalesPerson, Calls, Apts, Sales, Totals
-------------------------------------
Gilia Swifting 12 7 6 25
Steve Colbert 32 9 8 49
Rusty Nail 6 1 0 7

<asp:Datagrid ... DataKey="UserID"....
<asp:TemplateColumn HeaderText="Sales"....
<asp:LinkButton id="btnSelectSMFS" CommandName=="SelectSalesSMFS"....

Selecting Rusty Nail's Sales link button value zero, or any link button
renders an empty string

Pvt Sub dgSM_ItemCmd(byVal Src as obj, byVal e as
Sys.Web.UI.WebCtrls.DgCmdEventArgs) handles dgHistorySM.ItemCmd,
dgFuture.ItemCmd

'get current dg name
Dim dg as DataGrid = e.Items.NamingContainer

'get index UserID for nxt sProc
Dim UserID as String = dg.DataKeys(e.Item.ItemIndex)

'get nxt step, FS, load future sales for respective UserID
Dim sCoMander as String = Right(e.CommandName,2)

'here's where I'm failing, I know which cell it is, I've verified the ID,
however I've stepped thru all of my linkbuttons and their text value = ""
Dim lnkBtnText as String = Ctype(e.Item.Cells(1).Controls(1),
LinkButton).Text

If I check column(4) which is an <asp:BoundColumn of totals, I do see the
value "7" but not in any of my linkbuttons for columns Calls, Apts and
Sales.

TIA

JeffP....
If you think this is crossposted that's only because there wasn't any
action....

Sep 13 '06 #2

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

Similar topics

5
by: Fresh Air Rider | last post by:
Hello Could anyone please explain how I can pass more than one arguement/parameter value to a function using <asp:linkbutton> or is this a major shortfall of the language ? Consider the...
1
by: Rodusa | last post by:
I keep getting this error when trying to modify the text property of a linkbutton inside a datagrid template column. Object reference not set to an instance of an object. Description: An...
1
by: Harry Devine | last post by:
I have a DataGrid that is configured to use the Edit/Update/Cancel concept correctly. My grid shows values from 5 database fields. I only need to update that last 4 fields. The last field is a...
10
by: Bharat | last post by:
Hi Folks, Suppose I have two link button on a page (say lnkBtn1 and lnkBtn2). On the click event of the lnkbtn1 I have to add a dynamically created control. And On the click event of the lnkBtn2 I...
0
by: Joey | last post by:
Hello, I need to be able to access the linkbuttons that are used for paging inside a datagrid so I can set the style for what eventually becomes the client-side html anchor tags. I have read...
7
by: Ibrahim. | last post by:
Hello, How can I access a Shared Folder of the Server by using the following control. 1. I need to download files from c:\resumes folde by using the following; <asp:HyperLink...
0
by: comp974 | last post by:
ok, here is the situation, I am trying to construct a table with several ASP.net 2.0 controls in it during execution time in an VB.net enviroment. For starters, I have a textbox and a linkbutton...
3
by: rn5a | last post by:
Consider the following code which creates LinkButtons dynamically: For i = 1 to 5 lnkBut = New LinkButton lnkBut.ID = "lnkBut" & i lnkBut.Text = i.ToString & " " lnkBut.CommandName = i...
5
by: Nathan Sokalski | last post by:
I have a FormView control in which I use a PagerTemplate. I am having trouble accessing the controls in the PagerTemplate. How do I access them, and in what event should I put the could that...
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:
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...

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.