By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,034 Members | 1,672 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,034 IT Pros & Developers. It's quick & easy.

Using a Link Button to redirect to another page by using data from

P: n/a
I'm trying to determine how to create a page with data from the database and
I want to use the link button to have the user click on. Once the user
clicks on the link button I want to transfer them to another page, passing,
for example, the customer id from my database.

How to I create a url for this link button, that includes the page name and
passing the page emp_id=1 as the argument?

--
Sincerely,

Keith
Nov 19 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Keith:
Your question is a little ambiguous. Is this in a databinding environment?
(ie, you have multiple records that you want to display mutiple links?) or a
single link?

In the first case, i'd use a binding control (repeater/datalist/datagrid,
depending on your needs) and simply do:

<itemTemplate>
<tr>
<td><%# DataBinder.Eval(Container.DataItem, "FirstName") %></td>
<td><a href='edit.aspx?uid=<%# DataBinder.Eval(Container.DataItem,
"UserId") %>'>edit</a></td>
</tr>
</itemTemplate>

in the 2nd case I'd create an HtmlAnchor in the html-->

<a id="logout" runat="Server" />

and in codebehind declare the control:

protected logout as HtmlAnchor

Sub Page_Load
dim ds as DataSet = GetDatabaseData()
logout.Href = "logout.aspx?userId=" +
ds.tables(0).Rows(0)("UserId").ToString()
end sub

in the above example a dataset is overkill for a single value..and you'd
want to do some error checking (what if ds is null for example)

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"GTDriver" <GT******@discussions.microsoft.com> wrote in message
news:6C**********************************@microsof t.com...
I'm trying to determine how to create a page with data from the database and I want to use the link button to have the user click on. Once the user
clicks on the link button I want to transfer them to another page, passing, for example, the customer id from my database.

How to I create a url for this link button, that includes the page name and passing the page emp_id=1 as the argument?

--
Sincerely,

Keith

Nov 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.