I'll try to keep this short & sweet and hopefully get the direction I'm
looking for.
I'll drop a SqlDatasource onto a webform. Configure it to use a stored
proc, perhaps have the parameters be QueryString parms or Session variables,
whatever the situation calls for.
The Stored Proc will return one row of data, let's say FirstName & LastName,
John Smith.
I drop a Label (or Literal) onto the webform.
I would like the Label's Text property to be set to FirstName.
What/where is the proper way to hook this up?
In the past, I've had a Page_Load event and if not Postback, I setup a
datareader and read the values from the datareader and populate the
label/literal/textbox controls.
But I was thinking there must be a way to utilize the SqlDatasource object
and do the same thing (thus saving having to write all that SP calling code
in the Page_Load).
Thanks,
Brian 1 1662
Hi Brian,
I think you can try the following code to bind your Label control to a
SqlDataSource.
Dim dv As DataView =
CType(SqlDataSource1.Select(DataSourceSelectArgume nts.Empty), DataView)
Dim dr As DataRowView = dv.Item(1)
Me.Label1.Text = dr.Item(0)
Regards,
Manish www.ComponentOne.com
"Brian Simmons" wrote:
I'll try to keep this short & sweet and hopefully get the direction I'm
looking for.
I'll drop a SqlDatasource onto a webform. Configure it to use a stored
proc, perhaps have the parameters be QueryString parms or Session variables,
whatever the situation calls for.
The Stored Proc will return one row of data, let's say FirstName & LastName,
John Smith.
I drop a Label (or Literal) onto the webform.
I would like the Label's Text property to be set to FirstName.
What/where is the proper way to hook this up?
In the past, I've had a Page_Load event and if not Postback, I setup a
datareader and read the values from the datareader and populate the
label/literal/textbox controls.
But I was thinking there must be a way to utilize the SqlDatasource object
and do the same thing (thus saving having to write all that SP calling code
in the Page_Load).
Thanks,
Brian This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Marty McDonald |
last post by:
I have <asp:Table... </asp:Table> on my webform. In codebehind, I populate
a DataTable whose data should appear in the asp:Table. I created my own
code to populate the asp:Table with the...
|
by: Luis Esteban Valencia |
last post by:
Hi,
the following code displays a search result in a datagrid and is working
without problems. But I think the way I have done is not correct especially
databind(). could anyone help me to...
|
by: NancyASAP |
last post by:
I have a label on my ASP.NET form. It has a cssclass that includes a
background color.
I am dynamically putting text in this label. The text contains some
embedded html (I want to display part...
|
by: Joe |
last post by:
I know that the Literal control will not render a <span> tag so I can not
format its text. Other than this, what is the difference betwen the Literal
control and the LiteralControl Control? How...
|
by: Mark A. Sam |
last post by:
Hello,
I want to use a literal control to provide information about people listed
on a webpage, where the control is on the same line as the person it
addresses, so that I have a button, the...
|
by: paul.hester |
last post by:
Hi all,
I have a custom control with an overridden Render method. Inside this
method I'm rendering each control in its collection using their
RenderControl method. However, I'm running into a...
|
by: craigkenisston |
last post by:
In Asp.Net 2.0 I need to create a very special layout with data coming
from an ObjectDataSource.
It was already working using a GridView, but I need a free layout.
So, I dropped the GridView and...
|
by: rn5a |
last post by:
Consider the following code:
<script runat="server">
Sub ShowData(obj As Object, ea As EventArgs)
lblDate.Text = DateTime.Now.ToString("d")
lblDate.DataBind()
End Sub
</script>
<form...
|
by: rn5a |
last post by:
This is how I am populating a Panel with dynamic LinkButtons (the no.
of LinkButtons that will be created will depend upon the no. of orders
a user has placed):
Sub Page_Init(obj As Object, ea...
|
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...
|
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...
|
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...
|
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: 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,...
|
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...
|
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,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
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,...
| | |