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 725359
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T06:19:41+00:00 2026-05-14T06:19:41+00:00

Morning stackoverflow, I have a repeater, with the following code in my aspx page;

  • 0

Morning stackoverflow,

I have a repeater, with the following code in my aspx page;

<asp:Repeater ID="Contactinforepeater" runat="server">
<HeaderTemplate>
<h1>Contact Information</h1>
</HeaderTemplate>

<ItemTemplate>
<table width="50%">
<tr>
<td colspan="2"><%#Container.DataItem("position")%></td>
</tr>
<tr>
<td>Name:</td>
<td><%#Container.DataItem("surname")%></td>
</tr>
<tr>
<td>Telephone:</td>
<td><%#Container.DataItem("telephone")%></td>
</tr>
<tr>
<td>Fax:</td>
<td><%#Container.DataItem("fax")%></td>
</tr>
<tr>
<td>Email:</td>
<td><%#Container.DataItem("email")%></td>
</tr>
</table>
</ItemTemplate>

<SeparatorTemplate>
<br /><hr /><br />
</SeparatorTemplate>

</asp:Repeater>

Then I have this code in my aspx.vb to get the data;

If did = 0 Then
            s = "sql works on db server"
            x = New SqlCommand(s, c)
            x.Parameters.Add("@contentid", Data.SqlDbType.Int)
            x.Parameters("@contentid").Value = contentid
            c.Open()
            r = x.ExecuteReader
            r.Read()
            Contactinforepeater.DataSource = r
            Contactinforepeater.DataBind()
        End If
        c.Close()
        r.Close()

        If Not did = 0 Then
            s = "sql works on db server"
            x = New SqlCommand(s, c)
            x.Parameters.Add("@contentid", SqlDbType.Int)
            x.Parameters("@contentid").Value = contentid
            x.Parameters.Add("@did", SqlDbType.Int)
            x.Parameters("@did").Value = did
            c.Open()
            r = x.ExecuteReader
            r.Read()
            Contactinforepeater.DataSource = r
            Contactinforepeater.DataBind()
        End If
        r.Close()
        c.Close()

If ‘did’ is or is not ‘0’ I still get no data outputted to the page. I just get the ‘contact information’ h1 header from the header template.

I’ve tested the value of s in sqlsms and it works fine. Position, surname, telephone, fax, email all exist in the db. The particular page I am checking exists and has 1 set of contact information attached.

Where am I going wrong?

Thanks!

ps. Does my syntax appear correct?

pps. I am also open to different ways of achieving the same result. I tried via an sqldatasource but ran into problems when using variables as params (there is no option to select them, only controls, querystring etc)

  • 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-14T06:19:42+00:00Added an answer on May 14, 2026 at 6:19 am

    The solution was to change the codebehind blocks to;

     If r.HasRows Then
                    Contactinforepeater.DataSource = r
                    Contactinforepeater.DataBind()
                End If
    

    Cheers

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Morning all I have frequently used the old <asp:Label ID=lblWas runat=server Text='<%# XPath(FACEVALUE) %>'></asp:Label>
Morning all. I have the following javascript in my code in front <script type=text/javascript
Morning, I have the following HTML: <div id=sah_padding> <div id=sah_holder> <div id=sah_name>Hello [agent_name]</div> <div
Good Morning Justice League of Stackoverflow, I have here a problem that may stump
Morning all. How are we? Excellent I hope. I have the following little bits
Good Morning Stack Overflow, I'm new to asp.net and have a problem I'm trying
I've spent the morning reading through page after page of StackOverflow posts about this
Morning- I need a function that would produce the following kind of looking sequence:
Morning guys. Using C sharp .net4, and MS Visual Studio 2010. I have Developed
Morning, simple stupid question. I have found post with similar issues but after reading

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.