Usually it's best to include the minimum amount of code possible inside of the UpdatePanel, if you move the UpdatePanel so that your carousel is not inside it but the code you want to refresh is then it should all work as intended. Otherwise, you can add
a PreRender event to the UpdatePanel and call the ScriptManager.RegisterStartupScript method.
That syntax may not be 100% accurate as I'm just doing it from memory, but it's hopefully close enough to get you pointed in the right direction. You will also need to rename it to match the names of your controls
Swami Naraya...
Member
8 Points
50 Posts
jquerry and ajax problem
Nov 04, 2012 10:02 AM|LINK
can someone help me in adding ajax feature into my project
Here is my code
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" onrowcommand="GridView1_RowCommand" Width="100%"> <Columns> <asp:TemplateField> <HeaderTemplate> <table width="100%"> <tr> <td style="width:50%;text-align:left;">Document Name</td> <td style="text-align:left;">Attached</td> </tr> </table> </HeaderTemplate> <ItemTemplate> <table width="100%"> <tr> <td style="width:50%;border:none;text-align:left;"> <asp:Label ID="Label1" runat="server" Text='<%# Eval("document") %>'></asp:Label> </td> <td style="width:50%;border=none;text-align:left;"> <asp:LinkButton ID="LinkButton1" runat="server" CommandArgument='<%# Eval("attached") %>' CommandName="attached"> <img src="Images/attach.jpg" alt=""/> </asp:LinkButton> </td> </tr> <tr> <td style="text-align:center;" colspan="2"><br /> <div class="pikachoose"> <asp:Repeater ID="repeaterImages" runat="server"> <HeaderTemplate> <ul id="pikame" class="jcarousel-skin-pika"> </HeaderTemplate> <ItemTemplate> <li> <asp:LinkButton ID="lb1" runat="server"> <img src='<%#Eval("image") %>' alt="" /></a> </asp:LinkButton> </li> </ItemTemplate> <FooterTemplate> </ul> </FooterTemplate> </asp:Repeater> </div> </td> </tr> </table> </ItemTemplate> </asp:TemplateField> </Columns> </asp:GridView>Nakor
Member
336 Points
60 Posts
Re: jquerry and ajax problem
Nov 04, 2012 02:14 PM|LINK
The easiest way would be to just put the gridview inside of an UpdatePanel
Swami Naraya...
Member
8 Points
50 Posts
Re: jquerry and ajax problem
Nov 04, 2012 02:32 PM|LINK
I tried your solution but jquerry stopeed working
Nakor
Member
336 Points
60 Posts
Re: jquerry and ajax problem
Nov 05, 2012 12:58 AM|LINK
I don't see any jquery in the code you provided. When you say it stopped working what do you mean? What are you using the jquery for?
Swami Naraya...
Member
8 Points
50 Posts
Re: jquerry and ajax problem
Nov 05, 2012 07:57 AM|LINK
<script type="text/javascript" src=" https://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.js"></script> <script type="text/javascript" src="lib/jquery.jcarousel.min.js"></script> <script type="text/javascript" src="lib/jquery.pikachoose.js"></script> <script type="text/javascript" language="javascript"> $(document).ready( function () { $("#pikame").PikaChoose({ carousel: true }); }); </script>these are the jquerry i m using
Nakor
Member
336 Points
60 Posts
Re: jquerry and ajax problem
Nov 05, 2012 10:58 AM|LINK
Usually it's best to include the minimum amount of code possible inside of the UpdatePanel, if you move the UpdatePanel so that your carousel is not inside it but the code you want to refresh is then it should all work as intended. Otherwise, you can add a PreRender event to the UpdatePanel and call the ScriptManager.RegisterStartupScript method.
protected void UpdatePanel_PreRender(object sender, EventArgs e) { string script = "$('#pikame').PikaChoose({ carousel: true });"; ScriptManager.RegisterStartupScript(UpdatePanelID, typeof(UpdatePanel), "CarouselStartup", script, true); }That syntax may not be 100% accurate as I'm just doing it from memory, but it's hopefully close enough to get you pointed in the right direction. You will also need to rename it to match the names of your controls
More about ScriptManager.RegisterStartupScript
Swami Naraya...
Member
8 Points
50 Posts
Re: jquerry and ajax problem
Nov 06, 2012 06:46 PM|LINK
Thanks a lot :)