I have a grid with a repeater with a checkboxlist inside. I have no problem displaying the page, but when i try and get the value of the checkboxlist on the insert command in the code behind ... I cannot seem to get the values
here is an example of my code the only part that doesnt work is when i try an get the selected check boxes
Any ideas?
here is an example of my code the only part that doesnt work is when i try an get the selected check boxes
Any ideas?
<asp:Repeater ID="rptMarkets" runat="server" DataSourceID="objMarkets"> <ItemTemplate> <b> <%#DataBinder.Eval(Container.DataItem, "Market")%></b> <!-- Nested Repeater Level 2 - START --> <asp:HiddenField ID="HiddenField1" runat="server" Value='<%# Eval("MarketID") %>' /> <asp:ObjectDataSource ID="objProducts" runat="server" SelectMethod="GetProductsByMarketsID" TypeName="Ceradyne.clsLibrary"> <SelectParameters> <asp:ControlParameter Name="MarketID" Type="Int32" ControlID="HiddenField1" PropertyName="Value" /> </SelectParameters> </asp:ObjectDataSource> <ul> <asp:CheckBoxList ID="clProductName" runat="server" DataSourceID="objProducts" DataTextField="ProductName" DataValueField="ProductID" RepeatColumns="3" Font-Size="8px"> </asp:CheckBoxList> </ul> <!-- Nested Repeater Level 2 - END --> </ItemTemplate> <SeparatorTemplate> <hr /> </SeparatorTemplate></asp:Repeater>Protected Sub RadGrid1_InsertCommand(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles RadGrid1.InsertCommand 'save the file to the website Dim txtPDFFile As String = "" Dim Upload As RadUpload = TryCast(e.Item.FindControl("upBrochurePDF"), RadUpload) Dim BrochureFolder As String = Server.MapPath("~/uploads/brochures/") If Upload.UploadedFiles.Count > 0 Then For Each file As UploadedFile In Upload.UploadedFiles txtPDFFile = file.GetName() file.SaveAs(BrochureFolder & txtPDFFile, True) Next End If 'check to see if this file name exists already '(not written yet) ' save the file name to the database objBrochure.AddBrochure(txtPDFFile) 'look up the brochure id based on the filename objBrochure.GetBrochuresByFilename(txtPDFFile) Dim BrochureID As Integer = objBrochure.BrochureID 'save the value of the check boxes Dim ProductID As Integer Dim i As Integer Dim List As CheckBoxList = DirectCast(e.Item.FindControl("clProductName"), CheckBoxList) For i = 0 To List.Items.Count - 1 If List.Items(i).Selected = "true" Then ProductID = List.Items(i).Value 'add brochure links to products objBrochure.AddBrochureProductLink(BrochureID, ProductID) End If Next Response.Redirect("/admin/Library/ManageBrochures.aspx")End Sub