Various asp controls in a ASP.NET page

Posted by Filipe Costa on Stack Overflow See other posts from Stack Overflow or by Filipe Costa
Published on 2010-05-21T23:38:35Z Indexed on 2010/05/21 23:40 UTC
Read the original article Hit count: 298

Filed under:
|
|

Hello.

I am creating a products page, where the user selects an option in a radiobuttonlist for example, and then a control with the various options of that product appears in a placeholder or in a div when on of the radiobuttons is selected.

At the moment this is the code:

aspx:

<form runat="server">
<asp:CheckBoxList ID="Lentes" runat="server" OnClick="EscolheLentes">
    <asp:ListItem Value="LU">
    Lentes Unifocais
    </asp:ListItem>
    <asp:ListItem Value="LP">
    Lentes Progressivas
    </asp:ListItem>
</asp:CheckBoxList>
<asp:PlaceHolder runat="server" ID="PHLentes"></asp:PlaceHolder>
</form>

aspx.vb:

Protected Sub EscolheLentes()
        Dim ControlLente As Control
        If (Me.Lentes.Items.FindByValue("LU").Selected) Then
            ControlLente = LoadControl("LentesUnifocais.ascx")
        ElseIf (Me.Lentes.Items.FindByValue("LP").Selected) Then
            ControlLente = LoadControl("LentesProgressivas.ascx")
        End If
        Me.PHLentes.Controls.Add(ControlLente)
    End Sub

Need to use some ajax to load the control right? Am i going in the right direction?

Thanks.

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about control