Solved

I am attempting to use a repeater to obtain multiple columns of data by year within an existing repeater by topic

Posted on 2014-09-30
7
228 Views
Last Modified: 2014-11-04
I am attempting to use a repeater to obtain multiple columns of data by year within an existing repeater by topic.

The number of years is variable so cannot be done as a static row.

This is a sample of the existing report and I would like to add a repeater to duplicate the Average column for each year in the list of years available.

•  This Preceptorship enabled me to
      Average
Obtain and record a thorough and reliable history.      
Obtain and record a thorough and reliable physical exam.      
Develop a problem list.      
Develop a list of possible etiologies (differential diagnosis.)      
Order appropriate studies.      
Recommend rational therapy.      
Communicate with health team.      
Increase proficiency in technical procedures.      
Increase knowledge of patient problems in primary care.      
Average of Above Ratings      

I’ve been experimenting and just can’t get the syntax right to generate the multiple columns.

This is the first few rows of code before adding a repeater.

                  <div class="indent" ">
                  <li class="label" style="margin-top:20px;">This Preceptorship enabled me to:</li>

<asp:Table ID="Table2" GridLines="Both" runat="server" >
         <asp:TableHeaderRow ID="TableHeaderRow1"  runat="server" >
                  <asp:TableHeaderCell ID="TableHeaderCell1" ColumnSpan="30"   HorizontalAlign="Left"  runat="server" TabIndex="0"
                 Text="" Wrap="True" />
                  <asp:TableHeaderCell ID="TableHeaderCell2" ColumnSpan="10"   HorizontalAlign="Right"  runat="server" TabIndex="1"
                 Text="Average" Wrap="True" />
                         
         </asp:TableHeaderRow >

         <asp:TableRow ID="TableRow41"  runat="server" >
                 <asp:TableCell ID="TableCell3" colspan="30"   HorizontalAlign="Left"  runat="server"  
                 Text="Obtain and record a thorough and reliable physical history." Wrap="False" />
                  <asp:TableCell ID="TableCell4"  width="4"    HorizontalAlign="Right"  runat="server"  aria-readonly="true" >
                 <input type = "text" value='<%#DataBinder.Eval(Container.DataItem, "objHistory")%>'" Wrap="False" >
                          </asp:TableCell>
         </asp:TableRow >

         <asp:TableRow ID="TableRow42"  runat="server" >
                 <asp:TableCell ID="TableCell5" colspan="30"   HorizontalAlign="Left"  runat="server"  
                 Text="Obtain and record a thorough and reliable physical exam." Wrap="False" />
                  <asp:TableCell ID="TableCell6"  width="4"    HorizontalAlign="Right"  runat="server"  aria-readonly="true" >
                 <input type = "text" value='<%#DataBinder.Eval(Container.DataItem, "objExam")%>'" Wrap="False" >
                          </asp:TableCell>
         </asp:TableRow >

         <asp:TableRow ID="TableRow3"  runat="server" >
                 <asp:TableCell ID="TableCell15" colspan="30"   HorizontalAlign="Left"  runat="server"  
                  Text="Develop a problem list." Wrap="False" />
                  <asp:TableCell ID="TableCell16"  width="4"    HorizontalAlign="Right"  runat="server"  aria-readonly="true" >
                 <input type = "text" value='<%#DataBinder.Eval(Container.DataItem, "objList")%>'" Wrap="False" >
                          </asp:TableCell>
         </asp:TableRow >

 
         <asp:TableRow ID="TableRow4"  runat="server" >
                 <asp:TableCell ID="TableCell22" colspan="30"   HorizontalAlign="Left"  runat="server"  
                 Text="Develop a list of possible etiologies (differential diagnosis.)" Wrap="False" />
                  <asp:TableCell ID="TableCell23"  width="4"    HorizontalAlign="Right"  runat="server"  aria-readonly="true" >
                 <input type = "text" value='<%#DataBinder.Eval(Container.DataItem, "objEtiologies")%>'" Wrap="False" >
                          </asp:TableCell>
         </asp:TableRow >
0
Comment
Question by:jrwalker1048
  • 3
  • 2
7 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 40363598
I don't see a Repeater, I see a <table> element.  If you have a table layout, did you try binding to a GridView?
0
 

Author Comment

by:jrwalker1048
ID: 40364233
I don’t have a repeater in the example because none of my attempts worked so I just included the base code for information on how to add the repeater for multiple columns.

If there is another way to add a variable number of columns that would be fine but every page may have a different number of columns so I thought a repeater would work.

thanks
0
 

Author Comment

by:jrwalker1048
ID: 40364252
Do you have sample code I can try?

Thank you for your expertise. Truly appreciated!
0
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
LVL 96

Accepted Solution

by:
Bob Learned earned 500 total points
ID: 40364788
With ASP.NET and the GridView, the binding depends on the type of data.

Here are some examples:

ASP.NET Quickstart Tutorials
http://quickstarts.asp.net/QuickStartv20/aspnet/doc/ctrlref/data/gridview.aspx

GridView + SqlDataSource Example:

  <asp:GridView ID="GridView1" DataSourceID="SqlDataSource1" AutoGenerateColumns="False"
      runat="server">
      <Columns>
        <asp:BoundField HeaderText="ID" DataField="au_id" ReadOnly="true" />
        <asp:BoundField HeaderText="Last Name" DataField="au_lname" />
        <asp:BoundField HeaderText="First Name" DataField="au_fname" />
        <asp:BoundField HeaderText="Phone" DataField="phone" />
        <asp:BoundField HeaderText="Address" DataField="address" />
        <asp:BoundField HeaderText="City" DataField="city" />
        <asp:BoundField HeaderText="State" DataField="state" />
        <asp:BoundField HeaderText="Zip Code" DataField="zip" />
        <asp:CheckBoxField HeaderText="Contract" DataField="contract" />
      </Columns>
    </asp:GridView>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
      SelectCommand="SELECT [au_id], [au_lname], [au_fname], [phone], [address], [city], [state], [zip], [contract] FROM [authors]"
      ConnectionString="<%$ ConnectionStrings:Pubs %>" />

Open in new window

0
 
LVL 33

Expert Comment

by:Big Monty
ID: 40422391
I've requested that this question be closed as follows:

Accepted answer: 500 points for Bob Learned (TheLearnedOne)'s comment #a40364788

for the following reason:

This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0
 

Author Closing Comment

by:jrwalker1048
ID: 40422392
Thank you for your assistance
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
This video teaches users how to migrate an existing Wordpress website to a new domain.
Learn how to set-up PayPal payment integration in your Wufoo form. Allow your users to remit payment through PayPal upon completion of your online form. This is helpful for collecting membership payments, customer payments, donations, and more.

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question