Showing posts with label drop. Show all posts
Showing posts with label drop. Show all posts

Wednesday, March 28, 2012

Ajax update panel and the drop down list

Hi all,

Im using the update panel but have got into a spot of bother.

I've used the update panel many times before with buttons, but this time i need to use an update panel so that when a drop down list has its index chasnged that certain panels are shown and certain panels are hidden.

The problem i'm encountering is that the page does the post back, ive tried various options and tried to find decent examples on the next but everything is either with a checkbox or using a button.

on my page.aspx.cs i have the

1protected void dropTaxCertType_SelectedIndexChanged(object s, EventArgs e) {23UpdateCertView();45//UpdatePanel1.Update();6}78protected void UpdateCertView() {910//SortedList answers = this.AnsweredQuestions;11//DropDownList ddl = (DropDownList)sender;12//answers[ddl.ToolTip] = ddl.SelectedValue;13//this.AnsweredQuestions = answers;1415if (dropTaxCertType.SelectedValue =="0") {16pnlCert.Visible =false;17pnlRefNo.Visible =false;18}19else if (dropTaxCertType.SelectedValue =="1000") {20pnlRefNo.Visible =true;21pnlCert.Visible =false;22}23else if (dropTaxCertType.SelectedValue =="n/a") {24pnlRefNo.Visible =false;25pnlCert.Visible =false;26}27else {28pnlCert.Visible =true;29pnlRefNo.Visible =false;30}3132//if (ScriptManager1.IsInAsyncPostBack ){33// string callbackString = Map1.CallbackResults.ToString()34// ScriptManager1.RegisterDataItem(Map1, callbackString)35//}36}
 
as you can see from the above code ive tried various optinos from seeing it on the web with no success.
At first i created my updatepanle and inserted the ddl into it, but i kept getting this javasript error saying ambigous match found.
 
so i put the ddl outside the update panel, but because i have the autopostback it keeps posting back like a normal page without
update panel, but if i take out the autopostback the panls that are supposed to change dont. 
 
<table class="tLayout5"><tr class="top"><td colspan="2"><br /><hr /><br /><br /><strong>CIS Tax Certificate Type:</strong><br /><asp:DropDownList ID="dropTaxCertType" OnSelectedIndexChanged="dropTaxCertType_SelectedIndexChanged" AutoPostBack="true" CssClass="frmWidth99" runat="server"><asp:ListItem Text="" Value="0"></asp:ListItem><asp:ListItem Text="Subcontractor Certifying Document" Value="1000"></asp:ListItem><asp:ListItem Text="CIS4 - Registration card - must pay net" Value="CIS4"></asp:ListItem><asp:ListItem Text="CIS5 - Corporate certificate - can pay gross" Value="CIS5"></asp:ListItem><asp:ListItem Text="CIS6 - Photocard certificate - can pay gross" Value="CIS6"></asp:ListItem><asp:ListItem Text="CIS65 - Temporary registration - must pay net" Value="CIS65"></asp:ListItem><asp:ListItem Text="Exempt or Non Applicable" Value="n/a"></asp:ListItem></asp:DropDownList><br /></td></tr></table><asp:UpdatePanel ID="UpdatePanel1" updatemode="conditional" runat="server"><ContentTemplate><asp:Panel ID="pnlRefNo" runat="server"><table class="tLayout5"><tr class="top"><td colspan="2"><label for="txtUniqueRefNo"><strong>Unique Reference Number:</strong></label><br /><asp:textbox id="txtUniqueRefNo" MaxLength="30" runat="server" CssClass="frmWidth99" /></td></tr></table></asp:Panel><asp:Panel ID="pnlCert" runat="server"><table class="tLayout5"><tr class="top"><td colspan="2"><label for="txtOtherTaxCertType"><strong>Other:</strong></label><br /><asp:textbox id="txtOtherTaxCertType" MaxLength="30" runat="server" CssClass="frmWidth99" /></td></tr><tr class="top"><td style="width:49%;"><label for="txtTaxCertNr"><strong>CIS Tax Certificate Number:</strong></label> <br /><asp:textbox id="txtTaxCertNr" MaxLength="50" runat="server" CssClass="frmWidth99" /><asp:RegularExpressionValidator ID="RegularExpressionValidator7" Enabled="true" ControlToValidate="txtTaxCertNr" Display="Dynamic" runat="server" Text="Invalid Number" ValidationExpression="\w{1,20}" /></td><td style="width:49%;"><label for="radDate_dateInput_TextBox"><strong>Expiry Date:</strong></label>(dd/mm/yyyy)<radcln:raddatepicker id="radDate" MinDate="1980-01-01" AllowEmpty="true" Runat="server"><PopupButton style="float: left" /><DateInput DisplayPromptChar="_" PromptChar=" " onclick="ToggleStartDatePopup()" Width="100px" style="float: left" /></radcln:raddatepicker><asp:RequiredFieldValidator runat="server" ID="rfvDate" ControlToValidate="radDate" InitialValue="1980-01-01" Text="Required!" /><br /></td></tr></table></asp:Panel><Triggers> <asp:AsyncPostBackTrigger ControlID="dropTaxCertType" /> </Triggers></ContentTemplate></asp:UpdatePanel>
 I hope someone can help me pleaseeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
 
many thanxz in advance
 
Zal
 
 
 
Try with the triggers tags outside the contentTemplate tags.

I've tried your code without this lines:

<radcln:raddatepicker id="radDate" MinDate="1980-01-01" AllowEmpty="true" Runat="server">
<PopupButton style="float: left" />
<DateInput DisplayPromptChar="_" PromptChar=" " onclick="ToggleStartDatePopup()" Width="100px" style="float: left" />
</radcln:raddatepicker>
<asp:RequiredFieldValidator runat="server" ID="rfvDate" ControlToValidate="radDate" InitialValue="1980-01-01" Text="Required!" />

with DropDownList inside UpdatePanel, and works fine.


That was probably because you aren't using the RadCalendar when you tried that code or it wasn't set up the same. The drop down wasn't triggering the update outside the update panel because the trigger tags need to be at the same level at the content template tags, not nested.

AJAX Update Panel And ModalPopUpExtender

hi,

Im using the ModalPopupExtender ,Its work's just fine that is the model pop up i display contains a Drop down list a grid etc etc now on an Event of the Selected index changed another Drop downlist is suppose to be filled ..but it does not happen ..!! For the First time the pop up is displayed and the selected index is changed nothing happens the second time onwards the events on those particular controls work,that applies to all controls within the ModalPopUp..!! Pls help me regarding this..!!!!

Thanks n Regards

Francis P.

Put each drop down list in an updatepanel with updatemode="conditional"

On the event handler for dropdown1 changed, do what you must on dropdown2andforce an updatepanel2.update()


Hi,

Ive tried that but still no changes..!!!

I ll explain you the whole code..

The Main Page is within an update panel which also contains the Target to the ModalPopUp now in the Modal popup i ve put the Drop down list into an Update panel and on selected index change of that Dropdown list i get all the values needed to bind and bind that to the second drop down list..And do the

UpdatePanel3.Update() ("UpdatePane3.update()is the Update Panel which contains the second drop down list") but still nothing happens..

Thanks n Regards

Francis P.


- Have u set the dropdownlist as a trigger for updatepanel?

- Tried setting some breakpoints to see what gets "hit"?

Monday, March 26, 2012

Ajax toolkit dragdropmanager

Hello, I'm using Ajax toolkit in my project.

I have written own extender for drag and drop procedure.

Everything is fine, except that images that is located in target control doesn't fire onlick event.

Seems like, dragdropmanager disable this event on page load. Any workarounds?

thanks in advance.

Hi,

the DragDropManager doesn't disable any events of DOM elements. Could you explain in more detail your scenario? Are the images the draggable items?