Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDevelopment and...Development and...DNN Platform (o...DNN Platform (o...Listview problemListview problem
Previous
 
Next
New Post
1/15/2009 2:10 PM
 

Using DNN 4.9 with .NET 3.5. I have listview with some radio buttons. The listview items are loaded dynamically based on the data in the DB. There are two radio buttons grouped together for each listview item.  One is Pass, the other is Fail. When the user clicks Save I need to iterate through the listview control and get the value of the radio button for that particular item in the listview. So here is the kicker, I get it to work when I run just the aspx page in testing on my local machine but when I copy it to the DNN site it will not work. Here is my code for the click event, is there something I am missing?

        ' iterate through the list of answers to ensure all are checked
        For int As Integer = 0 To lvQuestions.Items.Count - 1
            If lvQuestions.Items(int).ItemType = ListViewItemType.DataItem Then
                Dim rbPass As RadioButton
                Dim rbFail As RadioButton
 
                ' get controls based on the list view item
                rbPass = CType(lvQuestions.Items(int).FindControl("rdoPass"), RadioButton)
                rbFail = CType(lvQuestions.Items(int).FindControl("rdoFail"), RadioButton)
 
                If (rbFail.Checked Or rbPass.Checked) Then
                    'Do nothing
                Else
                    'lblMessage.Text = "Please select an answer for all questions."
                    lblMessage.Text = Localization.GetString("SelectAnswerForAllQuestions.Text", Me.LocalResourceFile)
                    lblMessage.ToolTip = Localization.GetString("SelectAnswerForAllQuestions.ToolTip", Me.LocalResourceFile)
                    ' if have not answered all questions kick them out of the sub
                    lblInspectionNotes.Visible = False
                    lblCompleteBy.Visible = False
                    txtCompleteBy.Visible = False
                    lblInspectionNotes.Visible = False
                    txtInspectionNotes.Visible = False
                    lvQuestions.Visible = False
                    Exit Sub
                End If
            End If

        Next

 

<

<

asp:ListView ID="lvQuestions" runat="server" DataKeyNames="ique_id" >LayoutTemplate>

 

<table cellpadding="4" cellspacing="0">

 

<tbody>

 

<asp:PlaceHolder ID="itemPlaceholder" runat="server"></asp:PlaceHolder>

 

</tbody>

 

</table>

 

</

<

<br />LayoutTemplate>ItemTemplate>

 

<tr valign="top" style="background-color: #CCCCCC">

 

<td>

 

 

<asp:RadioButton ID="rdoPass" GroupName='<%# Bind("ique_id") %>' runat="server" resourceKey="Pass" ToolTip='<%# Localization.GetString("Pass.ToolTip", Me.LocalResourceFile) %>'/> </td>

 

<td>

 

<asp:Image ID="imgPass" runat="server" ImageUrl="~/images/checkmark.gif" Height="24" Width="24" resourceKey="Pass" AlternateText='<%# Localization.GetString("Pass.AlternateText", Me.LocalResourceFile) %>' ToolTip='<%# Localization.GetString("Pass.ToolTip", Me.LocalResourceFile) %>' /></td>

 

<td>

 

<asp:Label ID="lblQuestion" Text='<%# Bind("ique_question") %>' runat="server"></asp:Label>

 

</td>

 

</tr>

 

<tr valign="top" style="background-color: #CCCCCC">

 

<td>

 

<asp:RadioButton ID="rdoFail" GroupName='<%# Bind("ique_id") %>' runat="server" resourceKey="Fail" ToolTip='<%# Localization.GetString("Fail.ToolTip", Me.LocalResourceFile) %>'/>

 

</td>

 

<td>

 

<asp:Image ID="imgFail" runat="server" ImageUrl="~/images/cancelback.gif" Height="24" Width="24" resourceKey="Fail" AlternateText='<%# Localization.GetString("Fail.AlternateText", Me.LocalResourceFile) %>' ToolTip='<%# Localization.GetString("Fail.ToolTip", Me.LocalResourceFile) %>'/></td>

 

<td>

 

<asp:Label ID="lblNotes" runat="server" Text="Note:" resourceKey="Note" ToolTip='<%# Localization.GetString("Note.ToolTip", Me.LocalResourceFile) %>'></asp:Label><br />

 

<asp:TextBox ID="txtNote" runat="server" TextMode="MultiLine" Width="75%"></asp:TextBox>

 

</td>

 

</

<

</tr>ItemTemplate>AlternatingItemTemplate>

 

<tr valign="top">

 

<td>

 

 

<asp:RadioButton ID="rdoPass" GroupName='<%# Bind("ique_id") %>' runat="server" resourceKey="Pass" ToolTip='<%# Localization.GetString("Pass.ToolTip", Me.LocalResourceFile) %>' /> </td>

 

<td>

 

<asp:Image ID="imgPass" runat="server" ImageUrl="~/images/checkmark.gif" Height="24" Width="24" resourceKey="Pass" AlternateText='<%# Localization.GetString("Pass.AlternateText", Me.LocalResourceFile) %>' ToolTip='<%# Localization.GetString("Pass.ToolTip", Me.LocalResourceFile) %>'/></td>

 

<td>

 

<asp:Label ID="lblQuestion" Text='<%# Bind("ique_question") %>' runat="server"></asp:Label>

 

</td>

 

</tr>

 

<tr valign="top">

 

<td>

 

<asp:RadioButton ID="rdoFail" GroupName='<%# Bind("ique_id") %>' runat="server" resourceKey="Fail" ToolTip='<%# Localization.GetString("Fail.ToolTip", Me.LocalResourceFile) %>' />

 

</td>

 

<td>

 

<asp:Image ID="imgFail" runat="server" ImageUrl="~/images/cancelback.gif" Height="24" Width="24" resourceKey="Fail" AlternateText='<%# Localization.GetString("Fail.AlternateText", Me.LocalResourceFile) %>' ToolTip='<%# Localization.GetString("Fail.ToolTip", Me.LocalResourceFile) %>' /></td>

 

<td>

 

<asp:Label ID="lblNotes" runat="server" Text="Note:" resourceKey="Note" ToolTip='<%# Localization.GetString("Note.ToolTip", Me.LocalResourceFile) %>'></asp:Label><br />

 

<asp:TextBox ID="txtNote" runat="server" TextMode="MultiLine" Width="75%"></asp:TextBox>

 

</td>

 

</

<

</tr>AlternatingItemTemplate>EmptyDataTemplate>

 

<div style="margin-top:5px;border:solid 1px #999999;padding: 4px;">

 

<asp:Label ID="lblNoData" runat="server" Text="No questions available for this language" resourceKey="NoQuestionsAvailable" ToolTip='<%# Localization.GetString("NoQuestionsAvailable.ToolTip", Me.LocalResourceFile) %>'></asp:Label>

 

</

</

</div>EmptyDataTemplate>asp:ListView>


View Brenden Kehren's profile on LinkedIn
 
Previous
 
Next
HomeHomeDevelopment and...Development and...DNN Platform (o...DNN Platform (o...Listview problemListview problem


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out