Wrox Programmer Forums
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 5th, 2007, 12:18 PM
Authorized User
 
Join Date: Jan 2007
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to iPagan
Default Databinding asp.net help

I want to output a <h1> tag with a piece of data from a database table

Firstly my page does this:-
1: receives post from links.aspx, opens connection to a database then pulls data and populates a grid DONE that bit that was rather easy.

2: opens a connection (SqlDataSource2) and gets the following "select UID, LinkArea, FriendlyName from where @uid wtb_cat" Now what I want to be able to do is write a H1 tag from that, in the good olde days I'd have done something like <%=FriendlyName%> I've looked through a ton of books and can't find the code I am looking for, can anyone help?

--

404 real life user not found
__________________
--

404 real life user not found
 
Old February 5th, 2007, 12:24 PM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

...Are you trying to add the H1 tags in the datagrid or are you simply trying to write the data out to the browser surrounded by an H1 tag?



================================================== =========
I will only tell you how to do it, not do it for you.
Unless, of course, you want to hire me to do work for you.
================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from planoie's profile^^
^^Modified text taken from gbianchi profile^^
================================================== =========
 
Old February 5th, 2007, 01:36 PM
Authorized User
 
Join Date: Jan 2007
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to iPagan
Default

I am trying to get at the data and write it into a <h1> outside the datagrid

Data grids can be useful but in this case not really :S

--

404 real life user not found
 
Old February 5th, 2007, 02:09 PM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

What are you returning the data into? A dataset, datatable, datareader?

In all of the cases, getting to your data will be something similiar to

Response.Write("<h1>" + Convert.ToString(datatable.rows[0]["FriendlyName"]) + "</h1>");
Response.Write("<h1>" + Convert.ToString(datareader["FriendlyName"]) + "</h1>");
Response.Write("<h1>" + Convert.ToString(dataset.tables[0].rows[0]["FriendlyName"]) + "</h1>");



================================================== =========
I will only tell you how to do it, not do it for you.
Unless, of course, you want to hire me to do work for you.
================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from planoie's profile^^
^^Modified text taken from gbianchi profile^^
================================================== =========
 
Old February 6th, 2007, 08:50 AM
Authorized User
 
Join Date: Jan 2007
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to iPagan
Default

Alright, thanks for that, whilst looking at that code I assume, that in this instance we are using a datatable which is populated on page load.

So I've had a look through the books I already have and help files, and am still missing some of the point on the datatable bit, so i've just ordered the WroxBox (asp.net version) Thanks for your help anyway.

--

404 real life user not found





Similar Threads
Thread Thread Starter Forum Replies Last Post
Turning a regular ASP.NET App into an AJAX ASP.Net donrafeal7 Ajax 2 August 31st, 2007 12:33 AM
.net 2.0 - databinding to GUI in multi-threaded ap ivj C# 0 September 7th, 2006 01:49 AM
asp.net DataBinding wigmo XML 0 July 24th, 2003 12:22 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.