Some context to this particular task;
I have a news system I am updating with the ability to see comments and to post comment in a RadWindow. So far, I have been able to get the "show comments" to work by using a combination of the "select" command and session variables, but when I try to wire up the other LinkButton to open another RadWindow to insert a new comment into the database, it seems to default to the code I have done for the selectedItem instead. I'm hoping someone can help me figure this one out.
the *.aspx:
and here's the VB.NET code:
I have a news system I am updating with the ability to see comments and to post comment in a RadWindow. So far, I have been able to get the "show comments" to work by using a combination of the "select" command and session variables, but when I try to wire up the other LinkButton to open another RadWindow to insert a new comment into the database, it seems to default to the code I have done for the selectedItem instead. I'm hoping someone can help me figure this one out.
the *.aspx:
| <!-- Windows Begin --> |
| <telerik:RadWindowManager ID="TrackWindowManager" runat="server" ShowContentDuringLoad="False"> |
| <Windows> |
| <telerik:RadWindow runat="server" ID="CommentsWindow" |
| VisibleOnPageLoad="false" |
| Title="Comments Window" |
| Width="600" Height="500" |
| NavigateUrl="~/NewsComments.aspx" /> |
| <telerik:RadWindow runat="server" ID="PostCommentWindow" |
| VisibleOnPageLoad="false" |
| Title="Post Comments" |
| Width="600" Height="500" |
| NavigateUrl="~/PostNewsComment.aspx" /> |
| </Windows> |
| </telerik:RadWindowManager> |
| <!-- Windows End --> |
| <!-- RadOpen Javascript begins --> |
| <script type="text/javascript"> |
| function openRadWin() |
| { |
| radopen(null, "CommentsWindow"); |
| } |
| </script> |
| <!-- RadOpen Javascript ends --> |
| <telerik:RadListView ID="RadListView1" runat="server" |
| DataSourceID="dsNews" |
| DataKeyNames="NewsID"> |
| <ItemTemplate> |
| <table cellpadding="0" cellspacing="0" class="NewsTable"> |
| <tr> |
| <td class="NewsHeader"> |
| <asp:Label ID="lblTitle" runat="server" Text='<%# Eval("Title") %>' /> - |
| <asp:Label ID="lblDate" runat="server" Text='<%# Eval("ActDate") %>' /> |
| </td> |
| </tr> |
| <tr> |
| <td class="NewsContent"> |
| <asp:Label ID="lblStory" runat="server" Text='<%# Eval("NewsContent") %>' /> |
| <asp:Label ID="lblNewsID" runat="server" Text='<%# Eval("NewsID") %>' Visible="false" /> |
| </td> |
| </tr> |
| <tr> |
| <td> |
| <asp:LinkButton ID="lbShowComments" runat="server" |
| Text="Show Comments" |
| CommandName="Select" /> |
| <asp:LinkButton ID="lbPostComment" runat="server" |
| CommandName="PostComment" |
| Text="Post Comment" /> |
| </td> |
| </tr> |
| </table> |
| </ItemTemplate> |
| <SelectedItemTemplate> |
| <table cellpadding="0" cellspacing="0" class="NewsTable"> |
| <tr> |
| <td class="NewsHeader"> |
| <asp:Label ID="lblTitle" runat="server" Text='<%# Eval("Title") %>' /> - |
| <asp:Label ID="lblDate" runat="server" Text='<%# Eval("ActDate") %>' /> |
| </td> |
| </tr> |
| <tr> |
| <td class="NewsContent"> |
| <asp:Label ID="lblStory" runat="server" Text='<%# Eval("NewsContent") %>' /> |
| <asp:Label ID="lblNewsID" runat="server" Text='<%# Eval("NewsID") %>' Visible="false" /> |
| </td> |
| </tr> |
| <tr> |
| <td> |
| <asp:LinkButton ID="lbShowComments" runat="server" |
| Text="Show Comments" |
| CommandName="Select" /> |
| <asp:LinkButton ID="lbPostComment" runat="server" |
| CommandName="PostComment" |
| Text="Post Comment" /> |
| </td> |
| </tr> |
| </table> |
| </SelectedItemTemplate> |
| </telerik:RadListView> |
and here's the VB.NET code:
| Private Sub RadListView1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadListView1.SelectedIndexChanged |
| Dim NewsIdent As Label |
| NewsIdent = RadListView1.SelectedItems(0).FindControl("lblNewsID") |
| Session.Add("NewsID", NewsIdent.Text) |
| Me.CommentsWindow.VisibleOnPageLoad = True |
| End Sub |
| Sub PostComment() |
| Dim NewsIdent As Label |
| NewsIdent = RadListView1.SelectedItems(0).FindControl("lblNewsID") |
| Session.Add("NewsID", NewsIdent.Text) |
| PostCommentWindow.VisibleOnPageLoad = True |
| End Sub |