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

Assign Text to Footer Label

I'm trying to populate a label that is located in the Footer Template of
my DataGrid. I want this to be displayed in a label instead of a
textbox when the user wants to add a new record because I don't want
them to have mess with this field.

-----
Dim ds as new dataset
Dim objCommand as new oledbCommand(strSQL, objConn)
Dim myCommand as new OleDbDataAdapter(strSQL, objConn)

myCommand.Fill(ds, "DataTable")
lblID.text = ds.Tables("DataTable").Rows(0)("ID")
-----

When I run the page nothing is displayed in the footer for this field.
I figured this way would work simply because the datagrid's datasource
is the same dataset. Since the dataset is already filled I should just
be able to grab the ID from the dataset right? Any suggestions?
---
"Our enemies are innovative and resourceful, and so are we. They never
stop thinking of ways to harm our country and our people, and neither do
we." President George W. Bush

*** Sent via Developersdex http://www.developersdex.com ***
Nov 19 '05 #1
2 1412
this is fine, more then likely though you are setting the label text from
outside the proper event. Is the DS already populated? if so you will have to
dig into the DG and grab the footer to get at the label... the label probably
isn't exposed to the page directly.

--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com

"Will Chamberlain" wrote:
I'm trying to populate a label that is located in the Footer Template of
my DataGrid. I want this to be displayed in a label instead of a
textbox when the user wants to add a new record because I don't want
them to have mess with this field.

-----
Dim ds as new dataset
Dim objCommand as new oledbCommand(strSQL, objConn)
Dim myCommand as new OleDbDataAdapter(strSQL, objConn)

myCommand.Fill(ds, "DataTable")
lblID.text = ds.Tables("DataTable").Rows(0)("ID")
-----

When I run the page nothing is displayed in the footer for this field.
I figured this way would work simply because the datagrid's datasource
is the same dataset. Since the dataset is already filled I should just
be able to grab the ID from the dataset right? Any suggestions?
---
"Our enemies are innovative and resourceful, and so are we. They never
stop thinking of ways to harm our country and our people, and neither do
we." President George W. Bush

*** Sent via Developersdex http://www.developersdex.com ***

Nov 19 '05 #2
Check out the ItemDataBound Event.

if e.Item.ItemType = ListItemType.Footer Then
'Declare strValue & store the value from
'ds.Tables("DataTable").Rows(0)("ID") into this variable
ctype(e.Item.FindControl(""), Label).Text = strValue
'ds.Tables("DataTable").Rows(0)("ID")
End If

Basically you need to understand the lifetime of each control and then you
will understand as to where you could sneak the code. Hope that helps.

Regards,

Trevor Benedict R
MCSD

"Will Chamberlain" <wi**************@devdex.com> wrote in message
news:uJ**************@TK2MSFTNGP12.phx.gbl...
I'm trying to populate a label that is located in the Footer Template of
my DataGrid. I want this to be displayed in a label instead of a
textbox when the user wants to add a new record because I don't want
them to have mess with this field.

-----
Dim ds as new dataset
Dim objCommand as new oledbCommand(strSQL, objConn)
Dim myCommand as new OleDbDataAdapter(strSQL, objConn)

myCommand.Fill(ds, "DataTable")
lblID.text = ds.Tables("DataTable").Rows(0)("ID")
-----

When I run the page nothing is displayed in the footer for this field.
I figured this way would work simply because the datagrid's datasource
is the same dataset. Since the dataset is already filled I should just
be able to grab the ID from the dataset right? Any suggestions?
---
"Our enemies are innovative and resourceful, and so are we. They never
stop thinking of ways to harm our country and our people, and neither do
we." President George W. Bush

*** Sent via Developersdex http://www.developersdex.com ***

Nov 19 '05 #3

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

Similar topics

2
by: Galina | last post by:
Hello I have a report, which lists records. Each record has money paid field. Money paid can be 0 or not 0. I calculate and print summary of money for a group in the group footer, as well as...
3
by: Shiju Poyilil | last post by:
How to find a control in the datagrid footer ? In my code below, I am trying to hide a label named lbl1 on the basis of a selected vlaue(value="test") of the dropdownlist ,both the dropdownlist...
6
by: tshad | last post by:
I need to get to a status label I have on my footer section of my datalist. There is no event happening that would go to the footer. I am just doing some processing and want to update the label...
4
by: Leor Amikam | last post by:
I want to use a css element and apply it to all labels on a page with the "asp:label" tag. I defined a CSS class: ..cls1 { font-weight: bold; color: royalblue; font-family: Verdana;
15
by: Swetha | last post by:
Hello I have a DropDownList that I am populating using the following SqlDataSource: <asp:DropDownList ID="parentIDDropDownList" runat="server" DataSourceID="SqlDataSource3"...
2
by: Joe Delphi | last post by:
Hi, I want to position label text so that it always appears centered when the user re-sizes the browser window. I tried adding the HTML property text-align="CENTER" to the code, but ASP.NET...
1
by: | last post by:
I have a label control that I've embedded in a datalist template. I will be binding data to that label. I want to run a string formatting function on the database text before it is injected into...
2
by: =?Utf-8?B?U3RldmVu?= | last post by:
Hi, I'm new at Visual C++ and I can't figure out how to change the text property of a label. I'm using a char variable that I'd like to assign to the label. Perhaps I should use a System::String^...
1
by: franc sutherland | last post by:
Hi, I am using Access 2003. I would like to be able to set up a text box or label that I can pull through as the footer for reports. In this instance it is the footer for payment terms on an...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...

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.