Results 1 to 4 of 4

Thread: Add asp:radiobutton to string?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2001
    Location
    Worcester, MA
    Posts
    77

    Add asp:radiobutton to string?

    I am using the replace function to try and add a radiobutton into a string but can not figure out how to do it programatically. Any help would be appreciated
    Code:
    strRep=replace("<--add radio1 here-->","<asp:radiobutton runat=server id=radiobutton1/>")
    label1.text=strRep
    I know that doesn work but not sure how to do it.
    "Find all you need in your mind if you take the time" -DT

  2. #2
    Junior Member
    Join Date
    May 2003
    Location
    SC
    Posts
    17
    Assign a value to your Radio Button in your aspx page, example (threw a button on there so you can test this, just paste inside a form tag):

    <asp:radiobuttonlist id="rd1" runat="server" RepeatLayout="Flow" RepeatDirection="Horizontal" ForeColor="Black">

    <asp:ListItem Value="RD String Value1 " Selected="True">All</asp:ListItem>
    <asp:ListItem Value="RD String Value2 ">None</asp:ListItem>

    </asp:radiobuttonlist></FONT></TD><TD vAlign="center" colSpan="5"><FONT color="#000000">RD Display Text</TD>

    <asp:Button id="Button1" runat="server" Text="Button"></asp:Button>
    <BR>
    <BR>
    <asp:Label id="Label1" runat="server">Label</asp:Label></TR></FONT>


    In your Code Behind Page:

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    Dim strRep As String
    strRep = "Test1 "

    strRep = strRep & rd1.SelectedItem.Value 'Concatenates the string with the radio buttom value


    Label1.Text = strRep
    End Sub

    Good Luck.
    If you would have been listening, you would have heard what I meant to say.

  3. #3
    Hyperactive Member
    Join Date
    Aug 2002
    Location
    Fort Collins, CO
    Posts
    366
    It looks like you want the actual radio button(not the value of a radio button) added to your string...What exactly are you trying to do? There's probably an easy way of doin it, just need to know what is the desired end result.

  4. #4
    Frenzied Member DevGrp's Avatar
    Join Date
    Nov 2001
    Location
    Charlotte, NC
    Posts
    1,256
    You can add a placeholder to the form, then just add the radio button to the placeholder at runtime.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width