Discussion in '.NET' started by Tabriz, Aug 2, 2015.

  1. Tabriz


    Aug 2, 2015
    Likes Received:
    I've a problem with repeater control
    I use a repeater for display the database element but I want ،
    firt : display the choosen item in the label1
    next : when the choose details_link..... display the details on other page of database
    but i can't ...
    what do I do ??????????????

    my code:

    Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
    For Each rep As RepeaterItem In Repeater1.Items
    For Each ctrl As Control In rep.Controls
    If ctrl.GetType Is GetType(RadioButton) Then
    If DirectCast(ctrl, RadioButton).Checked = True Then
    Dim myvarID As String = DirectCast(ctrl, RadioButton).ID
    Dim myvarText As String = DirectCast(ctrl, RadioButton).Text

    End If
    End If

    End Sub

    <%@ Page Language="vb" AutoEventWireup="false" CodeBehind="WebForm1.aspx.vb" Inherits="test_repeater.WebForm1" %>

    <!DOCTYPE html>

    <html xmlns="">
    <head runat="server">
    <form id="form1" runat="server">
    <div><asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:testConnectionString %>" SelectCommand="SELECT * FROM [T1]"></asp:SqlDataSource>
    <asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSource1">
    <ItemTemplate >

    <table >
    <td><%#Eval("title")%> </td>
    <tr><td> <asp:RadioButton ID="RadioButton1" Text='<%#DataBinder.Eval(Container.DataItem, "g1")%>' runat="server" name="1"/></td></tr>
    <tr><td> <asp:RadioButton ID="RadioButton2" Text='<%#DataBinder.Eval(Container.DataItem, "g2")%>' runat="server" name="1"/></td></tr>
    <asp:Label ID="Label1" runat="server" Text="Label">choosen Item : </asp:Label>
    <asp:HyperLink ID="HyperLink1" runat="server">more details</asp:HyperLink>

    <asp:Button ID="Button1" runat="server" Text="Button" />

    Tabriz, Aug 2, 2015
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.