passing linkButton value as sql parameter

G

Guest

I create several link buttons based on database data. When a user clicks a
link button,
1. I want to pass the value of the button as a parameter to an SQL query
string;
2. suck more data out of the database; and
3. create another bunch of link buttons.

All on the same page.

Can anybody suggest how I do step 1 ?

Thank you.
 
B

Bruno Alexandre

a sugestion:

in the link text use "this is a link" in the NavigationURL use
"myPage.aspx?param={0}" and as commandValue "the text you have to pass"

or
<asp:LinkButton
ID="myLink" runat="server"
CommandArgument="12"
OnCommand="filterSQL"
Text="this is a link"
/>

Sub filterSQL(ByVal sender As Object, ByVal e As CommandEventArgs)
Dim name As String = FindControl(e.CommandArgument).ToString
... ask SQL with the new parameter, and the value is in the name string
just above
End Sub


--
Hope it helps


Bruno Alexandre
(a Portuguese in Denmark)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top