![]() |
| |||||||
| Sponsored Links |
![]() |
| | LinkBack | Thread Tools | Display Modes |
|
#1
| ||||
| ||||
| I am using the accordion ajax control to display data and have bound the accordion to a datasource. Inside the contenttemplate of the accordion I have a few checkboxes. When I try and access these controls on postback I get nothing back from them. Code: <ajaxtoolkit:Accordion ID="accord_phase" runat="server" FadeTransitions="false" RequireOpenedPane="false" OnItemDataBound="accord_phase_onitemdatabound" HeaderCssClass="accordionHeader" ContentCssClass="accordionContent"> <HeaderTemplate> <table width="99%" cellpadding="0" cellspacing="0" border="0" class="accordiontblHeader"> <tr><td class="white9b" style="padding:1px 0px 1px 3px;cursor:pointer"><asp:Literal ID="ltl_accord_header" runat="server" Text="Section 1" /></td></tr> </table> </HeaderTemplate> <ContentTemplate> <asp:HiddenField ID="hdn_phaseref" runat="server" /> <table width="99%" cellpadding="0" cellspacing="0" border="0"> <tr id="tr_interest" runat="server"> <td class="frm_req"></td> <td class="lbl_form"> <asp:Label ID="lbl_interest" Text="Registered Interest" AssociatedControlID="chk_interest" runat="server" CssClass="dblue9b" /> </td> <td class="txt_form" nowrap="nowrap"> <asp:checkbox ID="chk_interest" runat="server" Checked="true" Enabled="false" /> </td></tr> <tr id="tr_contact" runat="server"> <td class="frm_req"></td> <td class="lbl_form"> <asp:Label ID="lbl_contact" Text="Contact Details" AssociatedControlID="chk_contact" runat="server" CssClass="dblue9b" /> </td> <td class="txt_form" nowrap="nowrap"> <asp:checkbox ID="chk_contact" runat="server" /> </td></tr> <tr id="tr_initial" runat="server"> <td class="frm_req"></td> <td class="lbl_form"> <asp:Label ID="lbl_initial" Text="Date & Time for Initial Contact" AssociatedControlID="chk_contact" runat="server" CssClass="dblue9b" /> </td> <td class="txt_form" nowrap="nowrap"> <asp:checkbox ID="chk_initial" runat="server" /> </td></tr> </table> </ContentTemplate> </ajaxtoolkit:Accordion> Code: For Each item As AjaxControlToolkit.AccordionPane In accord_phase.Panes
Dim hdn_phaseref As HiddenField = item.ContentContainer.FindControl("hdn_phaseref")
I've tried googling but can't find any examples using it like this. The page loads exactly as it should and I don't get any errors when loading or on postback. Is there some way I can access these controls? Last edited by richyrich; June 24th, 2008 at 10:51 AM. |
| Sponsored Links |
|
#2
| ||||
| ||||
| How are you setting the value of hdn_phaseref? Is the postback having an effect on its value? I haven't yet needed this control, so have no experience with it.
__________________ jmurrayhead If you agree with me... click the icon! If my post solved your problem, click the button in the lower right-hand corner of the post.If you like it here...throw us a few bones to help support us. Join our Folding team: DeveloperBarn Folding |
|
#3
| ||||
| ||||
| I've tried setting it as <%#Eval("phaseref")%> and hdn_phaseref.value = When I look at the source of the page, the value shows in the hidden field. I also have a literal control in the header template of the Accordion control and I am able to retrieve the text contained in the literal using item.FindControl("ltl_accord_phase") If I change FindControl("hdn_phaseref") to FindControl("jfhfv") I get an object not set to instance error, so it's obviously finding the control, but for some reason it's empty. I think it must be somehow linked to the HeaderTemplate, but I'm not sure how yet. |
|
#4
| ||||
| ||||
| Try gaining access to the control as explained in this link: AJAX Control Library Accordion Problems - Brian Mains Blog |
|
#5
| ||||
| ||||
| I'm not quite sure how that would work because I'm binding the accordion to a datasource, so I can't call the control using the accordionID.FindControl as there are several instances of the same control and I don't explicitly define the accordion panes, so I can't call ths control using the ID of the pane either. This seems very strange. |
|
#6
| ||||
| ||||
| OK. I seem to have got somewhere, but no idea if it's anywhere useful!! ![]() I only seem to be able to get a value(text) from a literal control. All other types of control come back blank....Hmmmm.... Anyone heard of this before? |
|
#7
| ||||
| ||||
| I have found a solution of sorts....Not ideal, but it may have to do for the time being. I have had to add an update button to the ContentTemplate of the accordion so each pane has it's own update button. Then I added a CommandName and Argument to the update button:- Code: <asp:ImageButton id="img_update" runat="server" ImageURL="link_update.gif" CommandName="Update" CommandArgument='<%#Eval("phaseref")%>' />
Code: <ajaxtoolkit:accordion id="accord_phase" runat="server" ....... OnItemCommand="update_phase"> Code: Sub update_phase(ByVal s As Object, ByVal e As CommandEventArgs)
If e.CommandName = "Update" then
Dim accord As AjaxControlToolkit.Accordion = s
Dim accord_pane As AjaxControlToolkit.AccordionPane = accord.Panes(accord.SelectedIndex)
Dim phaseref As Integer = e.CommandArgument
Dim chk_initial As Checkbox = accord_pane.FindControl("chk_initial")
End If
|
![]() |
|
| Bookmarks |
| Tags |
| accordion, ajax, control, postback |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Custom Calendar Control | AOG123 | Microsoft Access | 3 | September 6th, 2008 07:36 AM |
| Webchart Control not displaying in Firefox | richyrich | .Net Development | 1 | June 2nd, 2008 01:43 PM |
| WebCharts Control | richyrich | .Net Development | 1 | April 4th, 2008 11:14 AM |
| Dynamic Content in AJAX Extender | richyrich | .Net Development | 3 | March 17th, 2008 12:14 PM |