Jump to content

Recommended Posts

Hi there, I'm new on ASP.NET and have the following problem: I get some data from a MS SQL-Server using a stored procedure. To display the data I'm using <ul>, <li> in a Repeater, because I have to do some optical customization. Now I want to call a sub from the Code Behind file, by clicking on a List Item. Right now the ClickEvent should just cause a Console output, that the Item was clicked.But I'm getting an error, saying the sub is undefined. Here is the code:

<asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSource1">						    <ItemTemplate>						   						    <li runat="server" onclick="selectItem" data-icon="false"><a href="index.aspx"><%#Eval("Employee")%></a></li>						   						    </ItemTemplate>						    </asp:Repeater>

    Public Sub selectItem(ByVal sender As Object, ByVal e As System.EventArgs)	    Console.WriteLine("Clicked")    End Sub

Thanks for your help

Link to post
Share on other sites

Thanks for your answer. I've tried an ASP.NET LinkButton but it works not exactly how I need it. The selected Item doesn't remain selected, means doesn't switch color.

<li runat="server" data-icon="false"><asp:LinkButton NavigateURL="~/index.aspx" OnClick="selectItem" runat="server" Text=<%#Eval("Employee")%>></asp:LinkButton></li>

Maybe some further details will help:The Application has a splitview with employee names on the left, projects on the right. By clicking on a name the non-related projects should grey out.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...