• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 284
  • Last Modified:

asp.net vb.net code behind

I would like to carry the value of SelectedPartNo  from code behind to aspx
and i have id2=<%=SelectedPartNo%> and it is not working now.

How can I fix it?

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim SelectedId = String.Empty
        SelectedId = Request.QueryString("id")
        Dim SelectedPartNo = String.Empty
        If (SelectedId <> "") Then
            SelectedPartNo = SingleItem(SelectedId, "1")
        End If
End Sub

<asp:DataList RepeatColumns="4" Font-Bold="true" 
        ID="DataList1" runat="server" DataSourceID="SqlDataSource1" Width="630px">
            <br /><a href=Default.aspx?PL=Sitemap&id=<%# Eval("CATEGORY")%>&id2=<%=SelectedPartNo%>><font color="blue" size="2"><%# Eval("CATEGORY") %></font></a><br />

Open in new window

  • 3
1 Solution
HainKurtSr. System AnalystCommented:

<a href="Default.aspx?PL=Sitemap&id=<%# Eval("CATEGORY")%>&id2=<%=SelectedPartNo%>">

what is not working? any error message? what is rendered html?
HainKurtSr. System AnalystCommented:
make sure SelectedPartNo is defined as public/friend
HainKurtSr. System AnalystCommented:
Dim SelectedPartNo = String.Empty
public SelectedPartNo = String.Empty

and move it to line 2
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now