Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. <% and %> tags? can I use them to dynamically generate content?

<% and %> tags? can I use them to dynamically generate content?

Scheduled Pinned Locked Moved ASP.NET
csharphtmlasp-netsysadminquestion
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    signbit
    wrote on last edited by
    #1

    Hi, Can I use <% = and %> tags to insert ASP.NET code snippets into my HTML? If yes? why doesn't the following code work?

    <asp:RadioButton id="<% = r[i]["ID"].ToString() %>" runat="server" />

    Also, if I use something like:

    <asp:RadioButton id="SomeID" value="<% = r[i]["Value"].ToString() %>" runat="server" />

    Any Ideas?

    - A programmer's national anthem; "AAAAAHHHHH!!!!"

    E A 2 Replies Last reply
    0
    • S signbit

      Hi, Can I use <% = and %> tags to insert ASP.NET code snippets into my HTML? If yes? why doesn't the following code work?

      <asp:RadioButton id="<% = r[i]["ID"].ToString() %>" runat="server" />

      Also, if I use something like:

      <asp:RadioButton id="SomeID" value="<% = r[i]["Value"].ToString() %>" runat="server" />

      Any Ideas?

      - A programmer's national anthem; "AAAAAHHHHH!!!!"

      E Offline
      E Offline
      enjoycrack
      wrote on last edited by
      #2

      signbit wrote:

      Can I use <% = and %> tags to insert ASP.NET code snippets into my HTML?

      Yes...

      signbit wrote:

      " runat="server" />

      But what is r in your code? << >>

      8x Solutions Ltd

      1 Reply Last reply
      0
      • S signbit

        Hi, Can I use <% = and %> tags to insert ASP.NET code snippets into my HTML? If yes? why doesn't the following code work?

        <asp:RadioButton id="<% = r[i]["ID"].ToString() %>" runat="server" />

        Also, if I use something like:

        <asp:RadioButton id="SomeID" value="<% = r[i]["Value"].ToString() %>" runat="server" />

        Any Ideas?

        - A programmer's national anthem; "AAAAAHHHHH!!!!"

        A Offline
        A Offline
        Arun Immanuel
        wrote on last edited by
        #3

        Try this: <%String val=r[i]["ID"].ToString();> <asp:RadioButton id="SomeID" value="<%=val%>' runat="server" /> If this does not work, use double quotes instead on single quotes. r must be a public member.

        Regards, Arun Kumar.A

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups