Showing posts with label view. Show all posts
Showing posts with label view. Show all posts

Monday, March 26, 2012

ASP.NET AJAX and Image Problem

Hi all.

I am using AJAX Tab Control to display a grid view in one tab and an IMAGE in another tab.

The image is created within the program and saved to "images" folder using Serve.MapPath.

Everytime the TAB index is changed, I do postback and call the code to create IMAGE. The image displays the value of dropdown box.

When I click the IMAGE TAB for the first time it is displaying the value of dropdown box correctly. But when I select another value and click the IMAGE TAB again it is not updating the image... it still shows the old image. But I am sure that the IMAGE is updated with new value (i can open the image from "images" folder manually and see the new value).

I am also sure that the page is posted back and new image is created (debugging revelas this).Even I change the tabs and come back to the image tab, it still shows old image..even thought the ImageUrl is pointing to the new (updated) image.

But when i press F5 (refresh) it is displaying the updated image with new value.

Can anyone help me solve this ? I dont want the user to press F5 everytime they select new value from dropdown box. I want the user to select new value and then press the TAB and display the new Image.

Thanks,

Chandra

Use this. it will work.

i think the cached output shown everytime.

to clear it, add the following code in the code behind.

Response.Expires = 0;

Response.Cache.SetNoStore();

Response.AppendHeader("Pragma","no-cache");

it will work.


Hi

Thanks for the reply. I have another problem! it works well in FIREFOX but not in IE!!

how can I solve this browser issues ?

Chandra.


Add the following line on top of the Page_Load event handler and your ASP.NET page will not be cached in the users browsers:

Response.Cache.SetCacheability(HttpCacheability.NoCache)

it will work.

Saturday, March 24, 2012

asp.net 2.0 ajax website menucontrol : javascript error :"Microsoft JScript runtime error:

i m developing application using ajax in asp.net 2.0 . I m using menu control of asp.net,multiview and view control.while running this application i got error "Microsoft JScript runtime error: '0.cells' is null or not an object" so now what is the solution of this i have returend following coad in html

<

div>

<

asp:UpdatePanelID="UpdatePanel2"UpdateMode="Conditional"runat="Server"><ContentTemplate>

<tablecellpadding="0"cellspacing="0"border="0"width="100%"><tr><tdwidth="6%"><asp:MenuID="Menu1"runat="server"DynamicHoverStyle-BackColor="Aqua"DynamicHoverStyle-Font-Overline="true"DynamicHoverStyle-ForeColor="Brown"DynamicMenuItemStyle-BackColor="Crimson"dOrientation="Horizontal"StaticEnableDefaultPopOutImage="False"OnMenuItemClick="menu_click"Orientation="Horizontal"><Items><asp:MenuItemText="Operator"Value="0"></asp:MenuItem><asp:MenuItemText="Visitor"Value="1"></asp:MenuItem></Items><StaticMenuStyleBackColor="White"/><StaticMenuItemStyleBackColor="White"/><StaticSelectedStyleBackColor="#FFC080"/><StaticHoverStyleBackColor="#80FFFF"/></asp:Menu><asp:MultiViewID="MultiView1"runat="server"><asp:ViewID="op"runat="server"><tablewidth="30%"><trvalign="top"><td>hetal</td></tr></table></asp:View><asp:ViewID="visitor"runat="server"><tablewidth="30%"><trvalign="top"><td>tarun</td></tr></table></asp:View></asp:MultiView></td>

</tr>

</table>

</ContentTemplate>

</

asp:UpdatePanel>

</

div>

please give me solution for this error...thank u

<asp:menu > control seems to be not compatible withUpdatepanel. Put the menu control outside the updatepanel. If you wantto refresh only updatepanel contents on click of menu control, then setmenu control as an async postback trigger for updae panel as givenbelow.

try following modified code.

<div>
<asp:Menu ID="Menu1"runat="server" DynamicHoverStyle-BackColor="Aqua"DynamicHoverStyle-Font-Overline="true"DynamicHoverStyle-ForeColor="Brown"DynamicMenuItemStyle-BackColor="Crimson" dOrientation="Horizontal"StaticEnableDefaultPopOutImage="False" OnMenuItemClick="menu_click"Orientation="Horizontal">
<Items>
<asp:MenuItem Text="Operator" Value="0" ></asp:MenuItem>
<asp:MenuItem Text="Visitor" Value="1"></asp:MenuItem>
</Items>
<StaticMenuStyle BackColor="White" />
<StaticMenuItemStyle BackColor="White" />
<StaticSelectedStyle BackColor="#FFC080" />
<StaticHoverStyle BackColor="#80FFFF" />
</asp:Menu>
<asp:UpdatePanel ID="UpdatePanel2" UpdateMode="Conditional" runat="Server">
<ContentTemplate>
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td width="6%">
<asp:MultiView ID="MultiView1" runat="server" >
<asp:View ID="op" runat="server">
<table width="30%">
<tr valign="top"><td>hetal</td></tr>
</table>
</asp:View>
<asp:View ID="visitor" runat="server">
<table width="30%">
<tr valign="top"><td>tarun</td></tr>
</table>
</asp:View>
</asp:MultiView>
</td>
</tr>
</table>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Menu1"EventName="MenuItemClick" />
</Triggers>
</asp:UpdatePanel>

</div>


You can also add the below script to your aspx page. It overrides the AJAX function and takes care of the error. This works for problems with Tab Controls too, seehttp://forums.asp.net/thread/1628780.aspx.

<scripttype="text/javascript">

var oldMenu_HideItems = Menu_HideItems;if(oldMenu_HideItems)

{

Menu_HideItems =

function(items)

{

if (!items || ((typeof(items.tagName) =="undefined") && (itemsinstanceof Event)))

{

items = __rootMenuItem;

}

if(items && items.rows && items.rows.length == 0)

{

items.insertRow(0);

}

return oldMenu_HideItems(items);

}

}

</script>

ASP,NET AJAX Enabled site and script module error

Hi All,

I have an ASP.NET AJAX enabled site which works OK in my development environment but when I publish it and view the site I get the error below. I have also tried creating a fresh ASP.NET AJAX enabled site and then publishing it but still the same error. Thinking some files were missing I downloaded the MS AJAX setup on my server (Win2K3 64-bit SP1) but to no avail.

From my Googling I see there are some patches to fix various issues with AJAX but nothing I have found matches my problem. If anyone has any info on this error or could point me in the right direction that would be most appreciated.

Description:Anerror occurred during the processing of a configuration file requiredto service this request. Please review the specific error details belowand modify your configuration file appropriately.

Parser Error Message:Couldnot load file or assembly 'System.Web.Extensions, Version=1.0.61025.0,Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of itsdependencies. The system cannot find the file specified.(xxxxx\web.config line 42)

Source Error:

Line 40:
Line 41: <httpModules>
Line 42: <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
Line 43: </httpModules>
Line 44: </system.web>

The AJAX assemblies are intended to be installed in the servers GAC, therefore they will not deploy in your apps bin folder.

Run the AJAX installation on the server to install the assemblies to the severs GAC.


Thanks for the prompt response. I had tried seveal times to download and install the same AJAX setup on my server. Though I thought I'd give it one last try after your comment and it nows works :)

Wednesday, March 21, 2012

ASP control inside AccordionPanes wont show in Desing View.

ASP controls inside the content of an AccordionPane won't show indesign view,
so the codebehind (.vb files) in VWD 2005 ED tells me theyare not declared.

I have this simple accordion:


<atlasTK:Accordion ID="Accordion1" runat="server" SelectedIndex="0" AutoSize="None"
<Panes>
<atlasTK:AccordionPane ID="AccordionPane1" runat="server" >
<Header>
<a href="http://links.10026.com/?link=" onclick="return false;" >ONE</a>
</Header>
<Content>
<asp:Label ID="lbl1" runat="server" Text="Test"/>
</Content>
</atlasTK:AccordionPane
<atlasTK:AccordionPane ID="AccordionPane2" runat="server" >
<Header>
<a href="http://links.10026.com/?link=" onclick="return false;" >TWO</a>
</Header>
<Content>
<asp:Label ID="lbl2" runat="server" Text="Test2"/>
</Content>
</atlasTK:AccordionPane
</Panes
</atlasTK:Accordion>


and albl1.text="hello world" in the codebehind is unacceptable.

What i'm doing wrong?

Hi DV,

I answered your question inthis thread.

Thanks,
Ted