Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7504977
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T21:45:26+00:00 2026-05-29T21:45:26+00:00

I have 2 DataLists where one is nested in the other one. I have

  • 0

I have 2 DataLists where one is nested in the other one. I have one line (Dim QID….) that keeps giving me problems, no matter what combination of code I can find online. I just want to be able to get the Hidden Field to show up as an integer so that my If statement will work.

Dim dl2 As DataList = CType(e.Item.FindControl("DataList2"), DataList)
        Dim QID As Integer = Convert.ToInt32(e.Item.FindControl("HiddenField2"))
        If QID = 33 Then
                Dim lbl As Label = dl2.FindControl("Label3")
                For Each i As ListItem In dl2.Items
                    If lbl.Text = "Self Directed" Or lbl.Text = "Systems" Then
                        lbl.Visible = False
                    End If
                Next
        End If

<asp:DataList ID="DataList1" runat="server" DataSourceID="SqlDataSource1" 
 Width="100%" CellPadding="4" ForeColor="#333333">
<ItemTemplate>
<asp:HiddenField ID="HiddenField2" runat="server" 
 Value='<%# Eval("QuestionID") %>'></asp:HiddenField>
<asp:Label ID="lblQuesNum" runat="server" Font-Bold="True" 
 Text='<%# Eval("QuestionNum") %>'></asp:Label>
<asp:Label ID="Label2" runat="server" Font-Bold="True" 
 Text='<%# Eval("Question") %>'></asp:Label>
<asp:HiddenField ID="hiddenPicklistID" runat="server"  
 Value='<%# Eval("PicklistID") %>' />
<asp:HiddenField ID="HiddenField1" runat="server" 
 Value='<%# Eval("AnswerType") %>' />

<asp:DataList ID="DataList2" runat="server" DataSourceID="dsPicklist">
<ItemTemplate>
    <asp:HiddenField ID="hidPickID" runat="server" value='<%# Eval("PICKLISTID") %>' />
    <asp:Label ID="Label3" runat="server" Text='<%# Eval("TEXT") %>'></asp:Label> 
    <asp:HiddenField ID="HiddenField1" runat="server" 
     Value='<%# Eval("AnswerType") %>' />
 </ItemTemplate>
 </asp:DataList>
 </asp:TextBox>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T21:45:27+00:00Added an answer on May 29, 2026 at 9:45 pm

    You cannot cast a control to a numeric value. Actually you want the value of the Hiddenfield to be casted to an integer.

    Dim hidden2 = DirectCast(e.Item.FindControl("HiddenField2"), HiddenField)
    Dim QID As Integer = Int32.Parse(hidden2.Value)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey, I have this code here: ArrayList arrayList = new ArrayList(); arrayList.add(one); arrayList.add(two); arrayList.add(three);
I have a fieldset inside that one panel on inside the panel I have
I have the below dataList that displays images with pagination that shows one image
I have follow following code in my JSF application <t:dataList id=slider-one value=#{MyBean.banners} var=ofr layout=simple
I have a class that has overloaded constructors. I'd like to re-factor the code
I have Datalist that is inside an updatepanel and it is in panel in
I have a DataList control that displays a set of elements. Can anyone point
I have a datalist being generated with ASP, but unfortunately the jQuery script that
I have a datalist inside a usercontrol that gets loaded into a page where
Kinda hard to explain, but i'll try. I have a datalist that is populated

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.