Click here to Skip to main content
14,268,557 members
Rate this:
Please Sign up or sign in to vote.
See more:
i am creating a website dynamically which is retrieve data from database i tried it still but i am getting in problem a tool i use here
Literal1
in this i tried to data take from button event till now
Public Function getmenu() As String

       str += str & "<ul>"
       str = str & "<li> <a href=""> <span></span><span>Contact Us2</span></a></li>"
       str = str & "<ul>"


       Return str
   End Function


this is not shows till i use another tool of label with same as
Literal1.Text = getmenu()
        Label1.Text = getmenu()

now its works but bellow shows on blank Menus and a bullet point in starting
if i use image code same in this its works
'Dim src As String = Page.ResolveUrl("~/download.png")
        'Literal1.Text = String.Format("<img id='Image3' src='{0}' alt=' ' height='100' width='80' />", src)


What I have tried:

Public Function getmenu() As String

       str += str & "<ul>"
       str = str & "<li> <a href=""> <span></span><span>Contact Us2</span></a></li>"
       str = str & "<ul>"


       Return str
   End Function


Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        
        Literal1.Text = getmenu()
        Label1.Text = getmenu()

    End Sub

in web page
<asp:Literal ID="Literal1" runat="server"></asp:Literal>	




'Dim src As String = Page.ResolveUrl("~/download.png")
        'Literal1.Text = String.Format("<img id='Image3' src='{0}' alt=' ' height='100' width='80' />", src)
Posted
Comments
Richard Deeming 8-Aug-19 10:24am
   
str += str & "<ul>"

You haven't declared the variable str.

You've also added two copies of the current value (if any) at the start. Either use str += "..." or str = str & "...".
irfanansari 9-Aug-19 16:52pm
   
sir i have no issue in str or str + i have just issue in
<asp:literal id="Literal1" runat="server"> when i try to take out put of this css code function in Literal1 then it is not shows out put just shows blank and as i incluse a label with same function called then its works

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100