Showing posts with label index. Show all posts
Showing posts with label index. Show all posts

Wednesday, March 28, 2012

Asp.net Ajax Enabled web app creating more ScriptResource.axd on a Simple page

Hello,

I am using Asp.net Ajax extension 1.0.In my application ,I am using a index.aspx page,which have no script manager control.When i am runing this application the the index page is loading very slow.When I save the page from browser I am finding six ScriptResource.axd files are loading on client side.Which have up to 400 kb.So I want to reduce these files on index page.But I do not know how I do it.Please help me.

Regards,

Pawan

Hi Pawan,

Basically, those scripts won't be requested if there is no AJAX related controls on the form.
If you are using MasterPage and there is ScriptManager on it, they will be downloaded too.

Hope this helps.

Hello Raymond Wen,

Thanks for reply.

I am using asp.net ajax enable website1.0.I have noticed that ScriptResource.axd is uploaded each time when I am navigate the site.On each page ScriptResource.axd is again loading.I want to cache ScriptResource.axd on Client Side.If you have any idea about it then please help me. Thanks & Regards, Pawan


Please try the following:

1. Set debug to false in web.config

2. Set ScriptMode property of the ScriptManager to release


These should be cached on the client as long as you have <Compilation Debug="false" /> in your web.config.

Monday, March 26, 2012

Asp.net Ajax Accordion SelectedIndex Event

Hello. Im trying to catch the selected index property of an accordion control and then store it into a session variable that I can then load later on in my application. Anyone have any suggestions on how to make this happen...Thanks in advance.

Here you go. On postback, just grab the value of the textbox and assign it to a session variable. Some of the javascript is for dealing with finding form objects when using a master file.

/*** Code Behind ***/
for (int i = 0; i < YourAccordionName.Panes.Count; i++)
{
YourAccordionName.Panes[i].HeaderContainer.Attributes.Add("onclick", "AssignIndex(" + i.ToString() + ")");
}

/*** Source View ***/
<asp:TextBox
ID="txtAccordionSelectedIndex"
runat="server"
style="background-color:#FFFFFF; color:#FFFFFF; border:solid 0px #FFFFFF"
Text="-1" />

<script language="JavaScript">
<!--
function AssignIndex(val)
{
document.forms[0].<%= txtAccordionSelectedIndex.UniqueID%>.value = val;
}
//-->
</script>

Hope that helps.