Friends,

I need some help :P

See this :


<%@ Import Namespace="System.Data.SqlClient" %>

<Script Runat="Server">

Sub Page_Load
  If Not IsPostBack Then
    Dim conNorthwind As SqlConnection
    Dim cmdSelect As SqlCommand
    Dim dtrCategories As SqlDataReader

    conNorthwind = New SqlConnection(
"Server=localhost;UID=sa;PWD=;Database=Northwind" )
    cmdSelect = New SqlCommand( "Select CategoryName From Categories",
conNorthwind )
    conNorthwind.Open()
    dtrCategories = cmdSelect.ExecuteReader()

    rptCategories.DataSource = dtrCategories
    rptCategories.DataBind()

    dtrCategories.Close()
    conNorthwind.Close()
  End If
End Sub

Sub Button_Click( s As Object, e As RepeaterCommandEventArgs )
  Dim lbtnSelected As LinkButton

  lbtnSelected = e.Item.Controls( 1 )
  lblCategory.Text = "You selected " & lbtnSelected.Text
End Sub

</Script>

<html>
<head><title>LinkButtonList.aspx</title></head>
<body>
<form Runat="Server">

<asp:Repeater
  ID="rptCategories"
  OnItemCommand="Button_Click"
  Runat="Server">

<ItemTemplate>
  <li>
  <asp:LinkButton
   Text='<%# Container.DataItem( "CategoryName" ) %>'
   Runat="Server" />
</ItemTemplate>

</asp:Repeater>

<p>
<asp:Label
  ID="lblCategory"
  Runat="Server" />

</form>
</body>
</html>


How i do, when i pass over the links ... shows on taskbar on IE this:
"path\index.aspx?mn=1&Link=xx"

or something like this:

<%= Request.ApplicationPath %>\index.aspx?mn=1&Link=xx

It is possible ? Because it shows like this :

javascript:__doPostBack('rptCategories:_ctl0:_ctl0',")
..
.. 
javascript:__doPostBack('rptCategories:_ctl7:_ctl0',")
(8 links)

What i would like is ,when i ckick on the first link , dont show the message
"You selected xxxxxxx" , in accordance with the label :  lblCategory.Text =
"You selected " &  lbtnSelected.Text , but redirect to the page depending on
the link choose :

Example:
The fist link redirect to :  "path\index.aspx?mn=1&link=1"
The second link redirect to :  "path\index.aspx?mn=1&link=2"

My problem is how i can "capture" the number of link that was press (choose)
in the LinkButton... not the text !

I know that is in this part :

Sub Button_Click( s As Object, e As RepeaterCommandEventArgs )
  Dim lbtnSelected As LinkButton

  lbtnSelected = e.Item.Controls( 1 )
  lblCategory.Text = "You selected " & lbtnSelected.Text
End Sub

---- >>>>  e.Item.Controls( 1 )

What are the property that give me the nš of control (choose) ?

I want to associeted the number link (control)  to some links , like, first
link  redirect to "path\index.aspx?mn=1&link=1". 
I what to use, the LinkButton (POST) and capture the values of parametrs and
choose the link to redirect,  like this:

ex: 
dim StrMenu as string
dim StrLink as string
dim StrUrl as string

StrMenu = request.form("mn")
StrLink = request.form("link")

if stmenu = "1" and link="1" then
   StrUrl= "index.aspx?mn=1&link=1"
end if

etc... etc

in the end i use the redirect command using the StrUrl variable.

How i know the value of control ("ctl1"), corresponding to some link ?

task bar : javascript:__doPostBack('rptCategories:_ctl1:_ctl0',")

How i do that ?

Thanks :P

Best regards,
Ricardo Figueira (RBFIGUEIRA) 

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to