Hi there,
I have a radwindow that performs a search on data and displays a list within a repeater of options the user may select.
What I need to do is collect the repeater object and send back to the parent.
I looked at some of your examples using javascript, the problem is using javascript to grab the data within the repeater is quite ugly.
Is there a way I can pass the code back via code behind?
So in my repeater I have a button "select" when user clicks the "select" button the radwindow closes and
the parent receives the selection.
My repeater code
<asp:Repeater ID="rptStores" runat="server" OnItemDataBound="rptStores_ItemDataBound">
<HeaderTemplate>
<table>
<tr style="color:#ffd700; font-weight:bold;">
<td>Store Name</td>
<td>City</td>
<td>Street</td>
<td>Distance(Mi.)</td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr style="color:#fff;" onmouseover="this.style.backgroundColor='blue'" onmouseout="this.style.backgroundColor=''" class="<%# If(Container.ItemIndex Mod 2 = 0, "TRNormal", "TRAlt") %>">
<td style="padding: 4px;">
<asp:Label ID="lblDBAName" runat="server" Text='<%# Eval("DBAName") %>' />
<asp:HiddenField ID="hfRowID" runat="server" Value='<%# Eval("id") %>' />
</td>
<td style="padding: 4px;">
<asp:Label ID="lblCity" runat="server" Text='<%# Eval("State") +"-"+ Eval("City")%>' />
<asp:HiddenField ID="hfState" runat="server" Value='<%# Eval("state") %>' />
</td>
<td style="padding: 4px;">
<asp:Label ID="lblStreet" runat="server" Text='<%# Eval("Street1") %>' />
<asp:HiddenField ID="hfPhone" runat="server" Value='<%# Eval("phone") %>' />
</td>
<td style="padding: 4px;">
<asp:Label ID="lblDistance" runat="server" Text='<%# Eval("distance") %>' />
</td>
<td>
<telerik:RadButton runat="server" Text="Select" ID="storeSelection2" CommandName="Process" Skin="Black" OnClientClicked="returnToParent"></telerik:RadButton>
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
<tr>
<td>
<asp:Label ID="lblEmptyData" Text="No Data To Display" runat="server" Visible="false"></asp:Label>
</td>
</tr>
</table>
</FooterTemplate>
</asp:Repeater>
my vb
Protected Sub rptStores_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.RepeaterCommandEventArgs) Handles rptStores.ItemCommand
Dim dbaName As Label
dbaName = CType(e.Item.FindControl("lblDBAName"), Label)
Dim city As Label
city = CType(e.Item.FindControl("lblCity"), Label)
Dim state As HiddenField
state = CType(e.Item.FindControl("hfState"), HiddenField)
Dim phone As HiddenField
phone = CType(e.Item.FindControl("hfPhone"), HiddenField)
Dim street1 As Label
street1 = CType(e.Item.FindControl("lblStreet"), Label)
Dim selectedID As HiddenField
selectedID = CType(e.Item.FindControl("hfRowID"), HiddenField)
ProcessButton(dbaName.Text, street1.Text, city.Text, state.Value, phone.Value, selectedID.Value)
End Sub
ProcessButton is called AFTER a return to parent javascript call.
Is this an option or do i really need to send object via javascript back to parent and then push into code behind.
I have a radwindow that performs a search on data and displays a list within a repeater of options the user may select.
What I need to do is collect the repeater object and send back to the parent.
I looked at some of your examples using javascript, the problem is using javascript to grab the data within the repeater is quite ugly.
Is there a way I can pass the code back via code behind?
So in my repeater I have a button "select" when user clicks the "select" button the radwindow closes and
the parent receives the selection.
My repeater code
<asp:Repeater ID="rptStores" runat="server" OnItemDataBound="rptStores_ItemDataBound">
<HeaderTemplate>
<table>
<tr style="color:#ffd700; font-weight:bold;">
<td>Store Name</td>
<td>City</td>
<td>Street</td>
<td>Distance(Mi.)</td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr style="color:#fff;" onmouseover="this.style.backgroundColor='blue'" onmouseout="this.style.backgroundColor=''" class="<%# If(Container.ItemIndex Mod 2 = 0, "TRNormal", "TRAlt") %>">
<td style="padding: 4px;">
<asp:Label ID="lblDBAName" runat="server" Text='<%# Eval("DBAName") %>' />
<asp:HiddenField ID="hfRowID" runat="server" Value='<%# Eval("id") %>' />
</td>
<td style="padding: 4px;">
<asp:Label ID="lblCity" runat="server" Text='<%# Eval("State") +"-"+ Eval("City")%>' />
<asp:HiddenField ID="hfState" runat="server" Value='<%# Eval("state") %>' />
</td>
<td style="padding: 4px;">
<asp:Label ID="lblStreet" runat="server" Text='<%# Eval("Street1") %>' />
<asp:HiddenField ID="hfPhone" runat="server" Value='<%# Eval("phone") %>' />
</td>
<td style="padding: 4px;">
<asp:Label ID="lblDistance" runat="server" Text='<%# Eval("distance") %>' />
</td>
<td>
<telerik:RadButton runat="server" Text="Select" ID="storeSelection2" CommandName="Process" Skin="Black" OnClientClicked="returnToParent"></telerik:RadButton>
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
<tr>
<td>
<asp:Label ID="lblEmptyData" Text="No Data To Display" runat="server" Visible="false"></asp:Label>
</td>
</tr>
</table>
</FooterTemplate>
</asp:Repeater>
my vb
Protected Sub rptStores_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.RepeaterCommandEventArgs) Handles rptStores.ItemCommand
Dim dbaName As Label
dbaName = CType(e.Item.FindControl("lblDBAName"), Label)
Dim city As Label
city = CType(e.Item.FindControl("lblCity"), Label)
Dim state As HiddenField
state = CType(e.Item.FindControl("hfState"), HiddenField)
Dim phone As HiddenField
phone = CType(e.Item.FindControl("hfPhone"), HiddenField)
Dim street1 As Label
street1 = CType(e.Item.FindControl("lblStreet"), Label)
Dim selectedID As HiddenField
selectedID = CType(e.Item.FindControl("hfRowID"), HiddenField)
ProcessButton(dbaName.Text, street1.Text, city.Text, state.Value, phone.Value, selectedID.Value)
End Sub
ProcessButton is called AFTER a return to parent javascript call.
Is this an option or do i really need to send object via javascript back to parent and then push into code behind.