-2

IN My web page contains five drop down list kept in separate update panel. It has stopped working because of j query function. How to solve this issue? can anyone guide me

<asp:Script Manager ID="smShop" run at="server" />
<asp:Update Panel class="designer" ID="up Mall"run at="server">
    <Content Template>
       <asp:Drop Down List run at="server" ID="ddlListMall" OnSelectedIndex Changed="ddl ListMall_SelectedIndexChanged" AutoPostBack="true" CssClass="designer">
       </asp:Drop Down List>
     </Content Template> 
     <Triggers>
        <asp:AsyncPostBack Trigger ControlID="ddlListMall" EventName="SelectedIndexChanged" />
     </Triggers>
</asp:Update Panel>

and this is the jQuery functions:

function MallSelect(){
  $('.selectField select').each(function (i){ 
        $(this).attr('id', 'slctOptID' + i); }); 
        $('.selectField select').change(function () 
         {
                 var slctID = $(this).attr('id'); 
                 optvalue = $('#' + slctID + ' option:selected').attr('value'); 
                 $("#" + slctID + " option:selected").each(function () 
                 {
                    if (optvalue == "others") 
                    {
                       $("#" + slctID).parent().parent().next('.otherField').fadeIn();
                    } 
                    else 
                    { 
                        $("#" + slctID).parent().parent().next('.otherField').hide();
                    }
                }
              )
         }); 

if i click list item item value="Others" it goes to j query function.

because of this update panel it wont go into that function.

If remove update panel means it show that function.but i want both function what to do?

Developer
  • 13
  • 1
  • 5
  • I'm guessing this is going to be a duplicate of: http://stackoverflow.com/q/11309017/209668 Show us some code though so we can check. – Codesleuth Jul 03 '12 at 11:42
  • above is my updatepanel for dropdownlist and i have jquery function for this dropdownlist.this update stopped working my jquery function but it doesnt show any error.how to solve this.please guide me friend . – Developer Jul 03 '12 at 11:49
  • function MallSelect() {$('.selectField select').each(function (i) { $(this).attr('id', 'slctOptID' + i); }); $('.selectField select').change(function () {var slctID = $(this).attr('id'); optvalue = $('#' + slctID + ' option:selected').attr('value'); $("#" + slctID + " option:selected").each(function () {if (optvalue == "others") {$("#" + slctID).parent().parent().next('.otherField').fadeIn();} else { $("#" + slctID).parent().parent().next('.otherField').hide();}})}); this s jquery function for above dropdownlist..please tel me friend – Developer Jul 03 '12 at 11:52
  • sorry i cant able to edit quetion..sorry friend please see above comment and give solution for this – Developer Jul 03 '12 at 11:53
  • edited..please see and tel friend – Developer Jul 03 '12 at 11:59
  • See my question. http://stackoverflow.com/questions/6072713/using-jquery-ui-datepicker-inside-updatepanel – Vano Maisuradze Jul 03 '12 at 12:03
  • Where did you call this function, what javascript errors did you get ? – Aristos Jul 03 '12 at 12:05
  • in cs file,if i click list item item value="Others" it will show text box below that drop down.i used jquery for this function .but bcoz of this update panel.if i click value="others"means it goes to selected changed event only it wont show textbox. it stopped working jquery function.if remove update panel means it show that function.but i want both function wat to do? please let me know friend once u get updated – Developer Jul 03 '12 at 12:16
  • Not make scene all that you say, and also you do not edit your question to make it understandable. -1 – Aristos Jul 03 '12 at 12:31
  • please see the question now friend..edited sorry – Developer Jul 03 '12 at 12:43

1 Answers1

0

You have to use Sys.WebForms.PageRequestManager.getInstance().add_endRequest(functionName);

Code sample is

<body onload="load()">

Then after

function load() {

    Sys.WebForms.PageRequestManager.getInstance().add_endRequest(functionName);

}

Then you will able to find the solutions

naval
  • 1,423
  • 1
  • 13
  • 26
  • you have to call load method on the body onload function then after you have to call that function you have already defined.Then Clear the cookies of the browser – naval Jul 03 '12 at 12:32
  • its not possible to provide my whole code in this.already i gave update panel and j query function above..please see that and provide ur valuable codings – Developer Jul 03 '12 at 12:51