Wednesday, March 28, 2012

postback happens even when validators show error

Hi,

I am using updatepanel in my code. I give a picture of a part of my code.

Now i have a text box with some validators on it ( required field validator and regular expression validator).

I have a save button which saves the content of the text box .

The textbox is withing the update panel and the save button is outside the update panel.

Now when a wrong iput is entered , on tab out the validator shows the error messgae but on clicking th ebutton , a post back happens. in general case where a update panel is not used the button postback event doesnt happen until the validators return true.

Could you help me on this.

Regards,

Sama

any resolution to this problem yet?

this really needs to be fixed


I also have come across this problem. I have three validators on the footer row of a gridview which is in an UpdatePanel. I use the footer for insertion of new records. When I click 'Insert', the validators fire ok and I get the red asterisks and all but it still posts back. When I take the whole thing out of the UpdatePanel it works as it's supposed to, preventing the postback if no data is entered.

I am using the latest version of Atlas.

Has anyone a solution to this and is it going to be fixed in a future ctp?

Regards,

Andy.


I just investigated further and found the following strage behaviour:

When my page first loads, the gridview is populated with data. The footer is not visible on the gridview as I set ShowFooter() to false by default. There is a button at the bottom of the page "Add Item". This posts back and sets the ShowFooter() to true so that the insert line appears. In this scenario, when the user leaves the new text fields blank, the validator fires but the page still posts back - WRONG.

If I show the footer by default when the page loads, the validators fire correctly and prevent the postback - CORRECT.

Can anyone shed any light on this, I don't want to have my insert line shown by default.

Andy.


bump...

Postback in FF

Hi All,

I have used ajaxcontrol toolkit in my application.
I have also implemented autosuggest list using classic XMLHTTP.
when I type search keyword in textbox it populates list , from list when I select record and hit enter key entire page is postback.

Please help me for same.

Hi Mukseshzala,

Based on your description, I think you should better use AutomComplelte control + WebService. Just like ths. You can get the whole source code from Ajax ControlToolkit Control.

Mukeshzala:

when I type search keyword in textbox it populates list , from list when I select record and hit enter key entire page is postback.

Please add this to your page , the onItemSelected function will be fired when click on the items.

<script type="text/javascript" language="javascript">
function pageLoad(){
$find("AutoCompleteEx").add_itemSelected(onItemSelected);
}
function onItemSelected(sender,eventArgs){
alert(sender.get_element().id);
}
</script>

I hope this help.

Best regards,

Jonathan

PostBack is happening even after using Update Panel and Script Manager

Hi,

I have a ASP.NET web application. I have a gridview and using a RowDataBound andRaisePostBackEventevent for getting the GridView details in the controls below like textboxes, dropdown etc. Now i am using Ajax Extensions controls like Update Panel and Script manager to avoid a postback happening when the GridView row is clicked. Even after implementing them postback is happening. Please see the code bits and let me know if i am missing somewhere.

UI

<asp

:ScriptManagerID="ScriptManager1"runat="server"EnablePartialRendering="true"></asp:ScriptManager>

<

asp:UpdatePanelid="UpdatePanel1"runat="server"UpdateMode="Conditional">

<contenttemplate>

<asp:GridViewID="GridView1"runat="server"OnRowDataBound="GridView1_RowDataBound"CssClass="sampletable"AlternatingRowStyle-CssClass="d1"ShowHeader="true"ShowFooter="false"AllowPaging="true"AllowSorting="true"AutoGenerateColumns="false"DataKeyNames="ProjectID"Width="100%"PageSize="5"><Columns>

<asp:BoundFieldVisible="false"HeaderText="Project ID"DataField="ProjectID"SortExpression="ProjectID"/><asp:BoundFieldHeaderText="Project Name"DataField="ProjectName"SortExpression="ProjectName"/><asp:BoundFieldHeaderText="Site Name"DataField="SiteName"SortExpression="SiteName"/></Columns></asp:GridView><asp:LabelID="Label1"runat="server"Text="Label"></asp:Label><asp:TextBoxID="TextBox1"runat="server"></asp:TextBox><asp:ButtonID="Button1"runat="server"Text="Button"/>

</

contenttemplate>

<

Triggers>

<

asp:AsyncPostBackTriggerControlID="GridView1"EventName="RowDataBound"/>

</

Triggers>

</

asp:UpdatePanel>

And theCode behind for RowDatabound event is

protected

void GridView1_RowDataBound(object sender,GridViewRowEventArgs e)

{

try

{

if (!((e.Row.RowType ==DataControlRowType.Pager) || (e.Row.RowType ==DataControlRowType.Header) || (e.Row.RowType ==DataControlRowType.Footer)))

{

System.Web.UI.

ClientScriptManager cs = Page.ClientScript;//Assign Row Index. This row index used in finding the ID of the clicked rowint intRowIndex = e.Row.RowIndex;

e.Row.Attributes.Add(

"onClick", cs.GetPostBackEventReference(this, intRowIndex.ToString().Trim()));

e.Row.Attributes.Add(

"onKeyDown","if( event.keyCode == 13 ) " + cs.GetPostBackEventReference(this,"KEYDOWN" +"$" + e.Row.DataItemIndex.ToString().Trim()));

}

}

catch (System.Exception ex)

{

//OnError(ex);

}

}

The code looks good, did you try a easy test to see if the postback is hidden?

http://alpascual.com/blog/al/archive/2006/12/21/Code-Snip-_2200_AJAX-Timer_2200_.aspx

Try the sample below and let me know if you see the postback


Thanks for the Quick Response.

But i could not get exactly what you want to convey.

regards,

Parimal


Ok, wrap a asp:button around an updatepanel and let me know if you see the postback

Hi,

The button is working fine without any post back. The Post back is happening when Grid Row is clicked as it call the RaisePostBack event to get the Row details. That event is coded as we have not used any command template in Grid.

regards,

Parimal


OnRowDatabound would not make sense for an async trigger. The user clicking the row and getting a postback via the javascript you added to the onclick is not the same. If you take out the trigger and just add ChildrenAsTriggers="true" to the UpdatePanel it would probably work as you expect.

One other thing - in this code:

"onClick", cs.GetPostBackEventReference(this, intRowIndex.ToString().Trim()));

e.Row.Attributes.Add(

"onKeyDown","if( event.keyCode == 13 ) " + cs.GetPostBackEventReference(this,"KEYDOWN" +"$" + e.Row.DataItemIndex.ToString().Trim()));

Change "this" to GridView1. You want to create a postback for your gridview, not the whole page. Since you're creating a custom postback you'll also need to register for event validation, or disable event validation in your page.


Thanks for the response. But still post back is happening. I will explain in details

1. I have a Gridview RowDataBound event which fires when Data is bounded to Grid.

2. I have aRaisePostBackEvent which fires when the row in the Grid is selected and this causes the Post Back event.

3. Aslo my UserControl is implementingIPostBackEventHandler interface.

Thanks in Advance,

Parimal

Postback inside of AJAX Rounded Corners Extender problem

Hello everyone. I have learned alot through this site and finally joined because I can't seem to find a fix for my problem and I was hoping that you guys could help me out.

I have a DropDownList with a SqlDataSource inside a panel with an AJAX rounder corners extender. It seems that the page shows itself without the extenders applied but then flashes and shows the extenders applied to the controls.

If I take the DropDownList and SqlDataSource out of the panel I know longer get the screen flash, but the extenders do take a second to show on the controls.

What is the fix for the Screen flash? And, If possible, how can I delay the display of the controls so that the AJAX extenders are applied before showing the controls?

Thanks for your help!

Rusty

Try putting Panel in a UpdatePanel

Thanks for the suggestion, but putting the Panel in an Update Panel didn't work. The screen still flashes. Here is my code with the update panel.

<

divid="master_page"><asp:UpdatePanelID="UpdatePanel1"runat="server"><ContentTemplate><cc1:RoundedCornersExtenderID="RoundedCornersExtender2"runat="server"TargetControlID="Panel2"Radius="10"></cc1:RoundedCornersExtender><asp:PanelID="Panel2"runat="server"Height="1000"Width="100%"BackColor="ForestGreen"><asp:SqlDataSourceID="SqlDataSource1"runat="server"ConnectionString="<%$ ConnectionStrings:MyConnectionString %>"SelectCommand=""></asp:SqlDataSource><asp:DropDownListID="InfoDDLB"runat="server"AutoPostBack="True"DataSourceID="SqlDataSource1"DataTextField="Name"DataValueField="ID"OnTextChanged="GetInfo"Width="100"><asp:ListItemSelected="True"Value="0">Select Something...</asp:ListItem></asp:DropDownList></asp:Panel></ContentTemplate></asp:UpdatePanel><asp:contentplaceholderid="ContentPlaceHolder1"runat="server"></asp:contentplaceholder></div>
Anything else I can try?

1. When I put your code in UpdatePanel there wasno flash when I changed value in DropDownList.

2. The RoundedCornersExtender should have ajaxtoolkit prefix, unless you have changed tag attribute in your web.config file

3. Depending on how much data you are fetching in the dropdown list, it will take longer to apply rounded corners effect.

The simple reason is javascript executed by rounded corner starts executing after you panel is completely loaded and size (height and width) is determined. Also, the more javascript/ajax calls you use the slower it gets, as javascript gets slower and slower as size increases.

PS: You can turn off debugging in web.config file by setting <compilation debug="false">. This will speed up Ajax scripts as they don't make any debug calls. And you won't see a delay.


2. I have the following entry in my web.config file for the AJAX controls:

<

addtagPrefix="cc1"namespace="AjaxControlToolkit"assembly="AjaxControlToolkit"/>

3. I am not fetching anything into the dropdown list.

I also turned off the debugger.

I have done further investigation and it turns out that I don't need the SqlDataSource tied to the DropDownList to get the flash. The only control that makes the screen flash is this DropDownList. When replaced with a textbox or button there is no flash. The first Example below shows the flash when the page is loaded and the "Push Me" Butotn is clicked. The second example has the DropDownList outside of the Panel and doesn't have a flash when the page loads or the "Push Me" button is clicked.

EXAMPLE 1: (SCREEN FLASH - OnPage load and 'Push Me' Button Clicked)

<%@. Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager runat="server" id="ScriptManager1" />
<div align="right" style="margin-right: 10px">
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<cc1:DropShadowExtender ID="DropShadowExtender1" Opacity=".5" Radius="2" TargetControlID="Panel5" runat="server" Rounded="True">
</cc1:DropShadowExtender>
<asp:Panel backcolor="orange" id="Panel5" runat="server" Height="100px" Width="200px">
<asp:DropDownList ID="DropDownList1" runat="server">
</asp:DropDownList>
<asp:Button ID="Button1" runat="server" Text="Push Me" />
</asp:Panel>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</form>
</body>
</html>

EXAMPLE 2: (NO SCREEN FLASH - OnPage load and 'Push Me' Button Clicked)

<%@. Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager runat="server" id="ScriptManager1" />
<div align="right" style="margin-right: 10px">
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<cc1:DropShadowExtender ID="DropShadowExtender1" Opacity=".5" Radius="2" TargetControlID="Panel5" runat="server" Rounded="True">
</cc1:DropShadowExtender>
<asp:DropDownList ID="DropDownList1" runat="server">
</asp:DropDownList>
<asp:Panel backcolor="orange" id="Panel5" runat="server" Height="100px" Width="200px">
<asp:Button ID="Button1" runat="server" Text="Push Me" />
</asp:Panel>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</form>
</body>
</html>

Thanks for your help!

Rusty


I tried your code same results both times no flash. Although as I said before, it takes fraction of a second(1/10 or even less) to apply the DropDownExtender (being a javascript). It is not noticable at all.

What browser you are using? I've read many complaints related to AJAX and IE 6. I'm using IE 7.

Please try with other browsers and see you have the same issue.

Let me know. Will be glad to help you out.


Yes, that's what it was. I updated from IE6 to IE7 on one of my computers and tried the page and there is no flashing issues. So, is there a recommendation for a solution for IE6 users when viewing my website?

Your help is greatly appreciated!

-Rusty


for IE 6 you can use filter instead of RoundedExtendedCorners.

<DIV ID="oFilterDIV" STYLE="cursor:hand;height:160px; padding:10px; font:bold 13pt verdana;
filter:progid:DXImageTransform.Microsoft.dropshadow(OffX=5, OffY=5,
Color='gray', Positive='true')" onclick="fnDepress();">
This is the DIV content.</DIV>

More about filters is herehttp://msdn.microsoft.com/library/default.asp?url=/workshop/author/filter/reference/filters/dropshadow.asp

Now on server-side you can check Browser's version (Request.Browser.Version) and then enable/disable RoundedCornerExtender as well as set CSSClass or Style property of the Asp:Panel control to use or not use filters.

Filters are specific to IE. They don't work in FireFox or other browsers.


postback inside modalpopupextender

I want to show a modalpopupextender that contains: a textbox ,A button, gridview, ok button , close button: when the user click on A button the gridview must be populated , I need this behavior inside the modalpopupextender but it seems like modalpopupextender does not support any control that make a postback, How can I manage this??

Best Regards

Joseph

I already have done this what you need to do is,

let say. btnSearch popups your ModalpopupExtender,

when you click in side the control do one thing only in the code behind, of that click event either grid pageindexchange, sortiung, any button click in the last. that is.

ModalPopupExtender1.Show()

it will keep showing the popup until you click close button or call a method.

ModalPopupExtender1.Hide()

It is trial and tested, even I have done more than this in my application.

IF THIS MAKES ANSWER PLEASE CLICK ANSWER ON MY POSTING

Regards,


Hi Killerjocker,

My understanding of your issue is that you want to show some controls include the GridView and generate(update) the content inside it when click on the Button which is associated with the ModalPopupExtender. If I have misunderstood, please feel free to let me know.

In my opnion, I think the easiest way for your situation is adding a UpdatePanel into the Panel which is associated with the ModalPopupExtender and the GridView is put inside the added UpdatePanel. When user click on the Button, the UpdatePanel will be refreshed by sending a asynchronous post and then the shows the ModalPopupExtender. Here is a sample:

<%@. Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server"
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
<style>
.modalBackground {
background-color:Gray;
filter:alpha(opacity=70);
opacity:0.7;
}

.modalPopup {
background-color:#FFD9D5;
border-width:3px;
border-style:solid;
border-color:Gray;
padding:3px;
width:250px;
}
</style>

</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:Button ID="Button2" runat="server" Text="Button" Enabled="false" style="display:none"/>
<asp:Panel ID="Panel1" runat="server" CssClass="modalPopup" Height="50px" Width="235px" style="display:none" DefaultButton="Button4">
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<%=DateTime.Now.ToString()%>
</ContentTemplate>
</asp:UpdatePanel>
<asp:Button ID="Button1" runat="server" Text="Cancel" />
<asp:Button ID="Button4" runat="server" Text="Button" />
</asp:Panel>

<ajaxToolkit:ModalPopupExtender ID="ModalPopupExtender1" runat="server" TargetControlID="Button2" PopupControlID="Panel1" CancelControlID="Button1" DropShadow="true" BackgroundCssClass="modalBackground">
</ajaxToolkit:ModalPopupExtender>
<input id="Button3" type="button" value="Click Me" onclick="showModalPopup()"/>
<script type="text/javascript" language="javascript">
function showModalPopup(){
__doPostBack('<%=UpdatePanel1.UniqueID%>','');
$find("<%= this.ModalPopupExtender1.ClientID%>").show();
}
</script>
</form>
</body>
</html>

I hope this help.

Best regards,

Jonathan

Postback issue

In my page, there are a lots of toolkit controls and gridvidw. Sometime when I postpack partially inside a UpdatePanel, I got the following message in a popup message box:

Invaid postback or callback argument. Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <% Page EnableEventValidation="true" %> in page. For security purposes,this fuature verifies that arguments to postbalc or callback events originate from the server control that orginally rendered them. If the data is valid and expected, use the ClientScriptManager.RegiterForEventValidation method in order to register the postback or callback data for validation.

For example, in gridview with paging, when I click on page numnber, sometimes the above message will come out. It comes out randomly. If I refresh the page, it will fix this issue.

How to solve this issue?

The pics you posted are not visible.

A potentially dangerous Request.Form value was detected from the client (ctl00$ctl00$ctl00$ctlToAdd1$ctl00$ctlHeaderFooter$ctl00$txtPageHeader="<p>DO NOT ATTEMPT TH...").

Description: Request Validation has detected a potentially dangerous client input value, and processing of the request has been aborted. This value may indicate an attempt to compromise the security of your application, such as a cross-site scripting attack. You can disable request validation by setting validateRequest=false in the Page directive or in the configuration section. However, it is strongly recommended that your application explicitly check all inputs in this case.

Exception Details:System.Web.HttpRequestValidationException: A potentially dangerous Request.Form value was detected from the client (ctl00$ctl00$ctl00$ctlToAdd1$ctl00$ctlHeaderFooter$ctl00$txtPageHeader="<p>DO NOT ATTEMPT TH...").

Source Error:

[No relevant source lines]


Source File:c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\siteseasytest\b32181f7\172c3a32\App_Web_yzjzpobg.2.cs Line:0

Stack Trace:

[HttpRequestValidationException (0x80004005): A potentially dangerous Request.Form value was detected from the client (ctl00$ctl00$ctl00$ctlToAdd1$ctl00$ctlHeaderFooter$ctl00$txtPageHeader="<p>DO NOT ATTEMPT TH...").]

System.Web.HttpRequest.ValidateString(String s, String valueName, String collectionName) +3219550

System.Web.HttpRequest.ValidateNameValueCollection(NameValueCollection nvc, String collectionName) +108

System.Web.HttpRequest.get_Form() +119

System.Web.HttpRequest.get_HasForm() +57

System.Web.UI.Page.GetCollectionBasedOnMethod(Boolean dontReturnNull) +2025201

System.Web.UI.Page.DeterminePostBackMode() +60

System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +6953

System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +154

System.Web.UI.Page.ProcessRequest() +86

System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +18

System.Web.UI.Page.ProcessRequest(HttpContext context) +49

ASP.communitydefault_aspx.ProcessRequest(HttpContext context) in c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\siteseasytest\b32181f7\172c3a32\App_Web_yzjzpobg.2.cs:0

System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +154

System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +64


Jason, If you are using code behind to control what gets added to a PlaceHolder for instance...

In ATLAS - we simply issued the

UpdatePanelModal.Update();

Because viewstate would get mucked up. (Article on my blog about this)

In Beta - I find that anytime you issue that command - it causes the error ... I think when mode is conditional - it works but not sure - as I am being forced to use always due to databound controls dissapearing on a modal popup and have not heard any feedback on the issue...

If you are not using code behind to handle - can you post a simple code example that demonstrates the issue?


Jason, I have written down the message text in message box. Forget the pic.


jodywbcb, what's your post for my question?

Postback Multitask progress bar (ajax)

hello

I have a asp.net page that takes several actions uppon a button click.

Suppose this page triggers 3 functions on that button click: (THIS IS JUST AN EXAMPLE)
1) Saves data to local data base
2) Export data do internet data base
3) send emails to 50 users reporting this update

What I want to do is show the user wich action the server is performing at the moment.
basically, it should show (on a Modal PopUP, i figure) all the 3 steps taken.
1) ...saving data...
2) ...exporting data ...
3) ... notifying users ...

does anyone have a solution for this?

thanks

Checkout this threadhttp://forums.asp.net/t/1133013.aspx

PostBack once all lists in CascadingDropDown are selected

Has anyone found a way to generate a postback once all lists in a CascadingDropDown have a valid selection.

I am converting a web app that has many places where the user has to select Software, Version, Terrain and Course (It's a Virtual Reality Cycling Portal) Previously each selection caused a postback to populate the next list. On each post back the state of the page may need to changed, in terms of different controls being visible to capture either the riders time or the distance they cover.

I have switched to using Atlas and created a UserControl with the CDD to reduce the postbacks, but I still need to change the state of the controls with a postback, as I need to lookup details of the course to determine which controls should be visible.

So what I need to do is generate a postback once all lists have a valid selection. As a last resort I can turn the Ride Upload tool I am referring to into a wizard, but I would prefer to keep the new UI similar to the original single form one users are already using.

The user control is working great in all but this one scenario, as the other scenarios all require the user to click on a button to trigger the update of a data control.

Once the last CDD gets a selection, you know that all the CDDs have a selection - might you be able to tag the last CDD with AutoPostBack? Alternatively, maybe you could write a little bit of JS to run on the client side and hook the onchange event of the DDL and do the postback manually?

postback outside updatepanel

Hello,

I have a label outside an updatepanel which i would like to update at the same time as the updatepanel.

So is there a way to do that without placing the label inside another updatepanel?

Any suggestion?

I think you cant do it unless u change 'EnablePartialRendering' property of your script manager to 'false'. which means refresh the whole page not just the update panel.


It is not possible, you have wrap the label in an update panel and set the update mode to always.

Postback Page controls go reverse video

I'm using master pages, and have various content pages using the same paster page, with an update panel in my paster page, that wraps my content pages. All works very well.

However, on some content pages if I double click my rows in my Gridview to cause an edit of that record, all the controls on the page are reverse video for a brief second, this is only true on some content pages, not all. I've recreated one of the content pages in question from scratch, same issue.

Has anyone else ran into this reverse video issue before?

No,I have never ran into this issue before.So I'm afraid I donn't have any idea on it if you don't provide with a repro of it.

Regards

postback problem

i have asp.net web page,on page load i create a simple html table with fixed no of rows and no of columns and their names are determined dynamically.now i have few javascipt functions for adding a row to table,for adding another column to table and for removinga row from table.

also i have a asp:button on click of which a xml file is generated from the data filled in by user in the table.but as soon as i hit the asp button to generate xml all newley added rows and columns are deleated.Is it possible to call a server side function without posting the page back.

Yes, it is

take a look at this article about client scripts callbacks:

http://msdn.microsoft.com/msdnmag/issues/04/08/CuttingEdge/

Cheers,

Yani


hey went throught the article actually i mean new to all this so didnt get it completely some code help from ur side will be appriciated

actually i have a method on server side that accepts the html table parses it and writes the data of html table in a xml file.

and i want to call this method on click of a button and without postback.

thanx in advance

sandeep


Sorry man,

I haven't put the client scripts callbacks into practice yet too.

I was going to use them to create a dynamic progress bar, but then i've decided to use the ajax update panel.

It was much faster and cheaper.

Cheers,

Yani

postback problem

Hi,

I have a control in my update panel which gets data from the database. The trigger for the update panel is a button control. its working fine ( i mean partial page update is happening) when i run my application.

But when this page is opened from an other user's browser, the whole page ( with all the other controls outside the update panel ) is being posted back on button click.

Any help is appreciated.

Hi developer_dotnet,

The same page has different behaviour in another users browser. Can you past your code here so we can analyze it. Thanks

Regards,


Hi developer,

developer_dotnet:

its working fine ( i mean partial page update is happening) when i run my application.

.

You mean in your development environment or you have published your website on this spot ?

developer_dotnet:

But when this page is opened from an other user's browser, the whole page ( with all the other controls outside the update panel ) is being posted back on button click.

First, suggest that we should use a debug tool such as Web Development Helper to make sure whether it make a asynchronous post or not.

If not , we should pay our attention to check if Asp.Net Ajax Extension V1.0 has been installed in the machine which host your website. http://ajax.asp.net/docs/InstallingASPNETAJAX.aspx .If Aajx ControlToolkit Controls used in your application, please add "AjaxControlToolkit.dll" to your bin folder.

If yes , please check the web.config settings .http://ajax.asp.net/docs/ConfiguringASPNETAJAX.aspx

If the problem cannot been resolved by doing these, please show your simple source code here.


I had a similar issue of partial postback. I have made it into a seperate <table> and it worked.


Hi all,

If an Ajax-Enabled page doesn't work properly in the browser, we may do some checking on the broswer security and privacy setting.

The following table lists required browser security and privacy settings for both user browsing and site development. In all cases, the recommended settings are the default settings for that browser.

Internet Explorer 6

Make sure that theInternet Zone in the Security Zones settings is set toMedium.

Internet Explorer 7

Make sure that theInternet Zone in the Security Zones settings is set toMedium-High.

FireFox 1.5 or later versions

In theTools menu underOptions, make sure thatEnable JavaScript is selected.

Opera 9.0 or later versions

In theTools menu underQuick preferences, make sure thatEnable JavaScript is selected.

Safari 2.0 or later versions

ClickSafari,Preferences,Security, and then Web Content and make sure thatEnable JavaScript is selected.

Hope it helps.

Postback problem using a usercontrol inside an update panel that is inside a masterpage

Hi all,

I have been messing around with this all day and its starting to get on my nerves i'm probably missing something really simple but I was hoping someone could shed some light on it or perhaps point me in the right direction..

As I said in thesubject of the post, I have a user control inside an update panel, that resides in the master page, now my problem is when the user control goes to perform a post back I get that nasty "Invalid callback or postback argument error" Can someone help me to rectify this issue? Basically all the control needs to do is hide one panel inside it and show another on a link buttons click even.. There is other code in there too..

The simplified code for the master page is as follows..

<%

@dotnet.itags.org.MasterLanguage="VB"CodeFile="redcellar.master.vb"Inherits="redcellar" %>

<%

@dotnet.itags.org.RegisterAssembly="AjaxControlToolkit"Namespace="AjaxControlToolkit"TagPrefix="ajaxToolkit" %>

<%

@dotnet.itags.org.RegisterSrc="login.ascx"TagName="login"TagPrefix="uc2" %>

<%

@dotnet.itags.org.RegisterSrc="controls/memberdeals.ascx"TagName="memberdeals"TagPrefix="uc1" %>

<!

DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0 Strict//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<

htmlxmlns="http://www.w3.org/1999/xhtml"xml:lang="en"lang="en">

<

headrunat="server"><metahttp-equiv="content-type"content="text/html;charset=utf-8"/><linkrel="stylesheet"type="text/css"media="screen, projection"href="stylesheets/screen.css"/><!--[if lte IE 6]>

<link rel="stylesheet" type="text/css" media="screen, projection" href="http://links.10026.com/?link=stylesheets/screen-ie.css" /><![endif]-->

<linkrel="stylesheet"type="text/css"media="screen, projection"href="stylesheets/order.css"/><!--[if lte IE 6]>

<link rel="stylesheet" type="text/css" media="screen, projection" href="http://links.10026.com/?link=stylesheets/order-ie.css" /><![endif]-->

<scripttype="text/javascript"src="scripts/borders.js"></script><scripttype="text/javascript"src="scripts/misc.js"></script><title></title>

</

head>

<

body><formid="form1"runat="server"><asp:ScriptManagerEnablePartialRendering="true"ID="masterScriptManager"runat="server"/><asp:UpdatePanelID="masterUpdatePanel"runat="server"><ContentTemplate><!-- container --><divid="container">

<p>page content is here</p>

</div><uc2:loginID="Login1"runat="server"/></ContentTemplate></asp:UpdatePanel>

And the code for the control is:

<%

@dotnet.itags.org.ControlLanguage="VB"Debug="true"AutoEventWireup="false"CodeFile="login.ascx.vb"Inherits="login"Strict="true" %><asp:PanelID="pnlLoginContainer"CssClass="modalPopup"runat="server"><divid="normal"><asp:PanelID="pnlLogin"runat="server"style="overflow: auto;"><divstyle="width: 160px; float: right;"><asp:linkbuttonID="lbClose"cssclass="modalClose"Text=""runat="server"/><asp:ImageID="Image1"runat="server"ImageUrl="~/images/member-red-large.gif"/></div><div><br/><h3id="normalpage_heading">

Member sign in.

</h3><br/><asp:LabelID="Label1"runat="server">Welcome back!</asp:Label><br/><br/><tablecellspacing="0"><trclass="datarow"><tdclass="itemheader"><asp:LabelID="Label2"runat="server"Text="email"/></td><tdclass="itemcontent"colspan="2"><asp:TextBoxID="txtEmail"runat="server"MaxLength="255"/></td></tr><trclass="datarow"><tdclass="itemheader"><asp:LabelID="Label3"runat="server"Text="password"/></td><tdclass="itemcontent"colspan="2"><asp:TextBoxID="txtPassword"runat="server"MaxLength="50"TextMode="Password"/><asp:RequiredFieldValidatorID="RequiredFieldValidator1"runat="server"ControlToValidate="txtpassword"Display="Dynamic"ErrorMessage="*"/></td></tr><trclass="datarow"><tdclass="itemheader"> </td><tdclass="itemcontentsmall"><asp:CheckBoxID="chkRememberMe"runat="server"Text="remember me"/></td><tdclass="itemcontentsmall"style="text-align: right;"><asp:LinkButtonID="lbForgotPassword"runat="server"CausesValidation="False"Text="forget your password?"/></td></tr></table><br/><divclass="link"id="signin-link"><asp:LinkButtonID="cmdLogin"runat="server"Text="sign in"/></div><br/><asp:LabelID="lblLoginMsg"runat="server"ForeColor="Red"></asp:Label><br/></div><div><asp:LabelID="Label4"runat="server">Are you a new user? You must register</asp:Label><asp:LinkButtonID="lbRegister"runat="server"CausesValidation="False"Text="here!"ToolTip="Click here to register.">here!</asp:LinkButton></div></asp:Panel><asp:PanelID="pnlForgotPass"runat="server"Width="100%"style="overflow: auto;"Visible="False"><divstyle="width: 160px; float: right;"><asp:linkbuttonID="Linkbutton1"cssclass="modalClose"Text=""runat="server"/><asp:ImageID="Image2"runat="server"ImageUrl="~/images/member-red-large.gif"/></div><div><p>

Forgot you password?

</p><asp:LabelID="Label5"runat="server">email</asp:Label><asp:TextBoxID="txtForgotPassEmail"runat="server"></asp:TextBox><asp:RequiredFieldValidatorID="RequiredFieldValidator2"runat="server"ControlToValidate="txtForgotPassEmail"Display="Dynamic"ErrorMessage="*"></asp:RequiredFieldValidator><asp:RegularExpressionValidatorID="RegularExpressionValidator1"runat="server"ErrorMessage="You must enter a valid email!"ControlToValidate="txtForgotPassEmail"SetFocusOnError="True"ValidationExpression="^([0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*@dotnet.itags.org.([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,9})$"Display="Dynamic"></asp:RegularExpressionValidator><br/><br/><asp:LabelID="lblResponseMessage"runat="server"></asp:Label><br/><pstyle="text-align: right;"><asp:ButtonID="cmdForgotPass"runat="server"Text="submit"/> </p></div></asp:Panel></div></asp:Panel>

The relevant code behind for this is:

ProtectedSub lbForgotPassword_Click(ByVal senderAsObject,ByVal eAs System.EventArgs)Handles lbForgotPassword.Click

pnlLogin.Visible =

False

pnlForgotPass.Visible =

TrueEndSub

Some help with this would be greatly appreciated.. :)

I'm still stuck with this one :S Any ideas?


After eliminating one thing at a time in my masterpage I found that this was the culprit, commenting it out did the trick..

<form method="get" action="">
<p><label for="search">Find a wine:</label>
<input type="text" id="search" onfocus="if(value=='eg: Henschke') value=''" value="eg: Henschke" />
<input type="image" src="http://pics.10026.com/?src=images/go.gif" value="Go" id="go" /></p>
</form>


does anyone have any idea why??

Postback problem with dynamically added ModalPopupExtender

In my task i have to create ModalPopupExtender dynamically, and add an .ascx control to it. This is the code:

Test.aspx page:

<

asp:ScriptManagerProxyrunat="server"ID="proxy"/>

<

asp:UpdatePanelrunat="server"ID="ajaxPanel"RenderMode="Inline"UpdateMode="Conditional"><ContentTemplate><asp:Panelrunat="server"ID="panel"><asp:Buttonrunat="server"ID="btn2"Text="Show Control"OnClick="btn2_Click"/></asp:Panel>

<%

--<asp:Button runat="server" ID="btn1" Text="test1" OnClick="btn1_Click" />--%>

</ContentTemplate></asp:UpdatePanel>

test.ascx control:

<

asp:ScriptManagerProxyrunat="server"ID="proxy"/>

<

asp:UpdatePanelrunat="server"ID="ajaxPanel2"RenderMode="Inline"UpdateMode="Always"><ContentTemplate> <asp:Buttonrunat="server"ID="btnTest2"Text="test2"OnClick="btnTest2_Click"/></ContentTemplate></asp:UpdatePanel><asp:Buttonrunat="server"UseSubmitBehavior="false"ID="btnTest"Text="Close OK"OnClick="btnTest_Click"/><asp:Buttonrunat="server"UseSubmitBehavior="false"ID="btnTestClose"Text="Close"OnClick="btnTest_Click"/>

In aspx page:

protected

overridevoid OnInit(EventArgs e)

{

base.OnInit(e);Control c = LoadControl("~/test.ascx");

c.ID =

"customModalControl";Panel p =newPanel();

p.Width = 300;

p.Height = 200;

p.CssClass =

"modalPopup";

p.ID =

"modalPanel_";_modalPopup =newModalPopupExtender();

_modalPopup.ID =

"modalPopup";

_modalPopup.DropShadow =

true;

_modalPopup.BackgroundCssClass ="modalBackground";

_modalPopup.PopupControlID = p.ID;

_modalPopup.TargetControlID = btn2.ID;

Control c2 = c.FindControl("btnTest");

_modalPopup.OkControlID = c2.ClientID;

c2 = c.FindControl("btnTestClose");

_modalPopup.CancelControlID = c2.ClientID;

p.Controls.Add(c);

panel.Controls.Add(_modalPopup);

panel.Controls.Add(p);

}

protectedvoid btn1_Click(object sender,EventArgs e)

{

}

protectedvoid btn2_Click(object sender,EventArgs e)

{

_modalPopup.Show();

}

onInit event, i create ModalPopupExtender and a panel for ascx control. All works fine, but is one problemCrying, when i click btnTest2 on ModalPopup, rises postback for the page, but ascx control didn't receive btnTest2 _OnClick event. Maybe someone know where is a problem. Thank you.

Try to change change some of your codes to specify asynchronous post back.
<asp:UpdatePanel runat="server" ID="ajaxPanel2" RenderMode="Inline" UpdateMode="Always">
<ContentTemplate>
??????<asp:Button runat="server" ID="btnTest2" Text="test2" OnClick="btnTest2_Click"/>
</ContentTemplate>
<triggers>
????<asp:AsyncPostBackTrigger ControlID="btnTest2" EventName="Click"/>
</triggers>

</asp:UpdatePanel>
Wish this can help you.

PostBack Problem, Need Help.

I have a page with a drop down that drives a gridview. Now whatever is selected the drop down will drive whats shown in the gridview. The page loads fine and the default value in the drop down loads the gridview fine. Now on each row in the gridview I have an edit button to edit that row. I use a modal popup to edit that row and save it. The modal works great and updates a row. Here is where the problem happens, if I change the drop down to a different value the gridview updates, I edit the row and the modal pop is ok and saves...but without changing the drop down again if I try to edit another row I get this error...

--------
Windows Internet Explorer
--------
Invalid postback or callback argument. Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@dotnet.itags.org. Page EnableEventValidation="true" %> in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.
--------
OK
--------

Now I have tried adding that attrbute to the page tag and it still does not work...it gives me a similar error than the above one. I assume it has something to do with having all these postbacks and the modal is causing one while so is the edit button and they are conflicting somehow...anyway, any direction or solution would great. Let me know if anyone needs to see some code.

Hi Horizon,

In your modal popup, do you make partial or full postback when you update the datagrid row?

If you make partial postback, there is chance the server does not know all about this partial update, especially if you modify or update portions of your page, so by the next time you try to issue partial postback the server will complain about invalid postback event arguments.

It works if you change the dropdown because the dropdown issues full postback so the server now knows about all modifications on your page.

Is it an option to issue a full postback when you update the rows in the datagrid?

If your application does not require high grades of security, you could turn off the enableEventValidation attribute globally for your application (in web.config file).

Probably some ASPX and code-behind code would be helpful here to see how exactly you do the postbacks and updates on your page...

Kind regards,

sbogus.


Thanks you lead me on the right path, I added this to the load event...

ScriptManager.GetCurrent(Page).RegisterPostBackControl(btnSaveRankings);

What this does is cause a full post back on the page now when I click btnSaveRankings which is in my modal panel. Though know its not saving state on my drop down...it reverts it back to the value as if you just came into the site...I am going to post my aspx and aspx.cs file...

<%@. Page Language="C#" AutoEventWireup="true" CodeBehind="index.aspx.cs" Inherits="PowerRankingsAjax.admin.index" %><%@. Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxControlToolkit" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" ><head runat="server"> <title>Add/Edit Power Rankings</title> <link href="../ModalDialogs.css" rel="stylesheet" type="text/css" /></head><body> <form id="form1" runat="server"> <div> <asp:Label ID="lblError" runat="server" Text=""></asp:Label> <ajaxControlToolkit:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"></ajaxControlToolkit:ToolkitScriptManager> Edit Past Issues <br /> Select Issue: <asp:DropDownList ID="ddlIssue" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlIssue_SelectedIndexChanged"></asp:DropDownList> <br /> <asp:UpdatePanel ID="uEditPanel" runat="server" ChildrenAsTriggers="False" UpdateMode="Conditional"> <ContentTemplate> <asp:GridView ID="EditPowerRankings" runat="server" AutoGenerateColumns="false" OnRowCreated="EditPowerRankings_OnRowCreated" > <Columns><asp:TemplateField ShowHeader="False"><ItemTemplate> <asp:Button ID="btnEdit" runat="server" Text="Edit" OnClick="btnEdit_Click" CausesValidation="false" /></ItemTemplate></asp:TemplateField><asp:BoundField DataField="pid" /><asp:BoundField DataField="teamabbr" /><asp:BoundField DataField="team" HeaderText="Team" SortExpression="team" /><asp:BoundField DataField="rank" HeaderText="Rank" SortExpression="rank" /><asp:BoundField DataField="comment" HeaderText="Comment" SortExpression="comment" /></Columns> </asp:GridView><!--cheesy button for the modal popups target control--> <asp:Button ID="btnHiddenRankings" runat="server" style="display: none" /> <ajaxControlToolkit:ModalPopupExtender ID="mpeRankings" runat="server" TargetControlID="btnHiddenRankings" PopupControlID="pnlRankings" CancelControlID="btnCancelRankings" BackgroundCssClass="modalBackground" Drag="true" > </ajaxControlToolkit:ModalPopupExtender> <asp:Panel ID="pnlRankings" runat="server" CssClass="modalBox" Style="display: none;" Width="500px"><asp:Panel ID="RankingsCaption" runat="server" CssClass="caption" Style="margin-bottom: 10px;">Edit Rankings</asp:Panel> <asp:HiddenField ID="hidRankEditIndex" runat="server" Value="-1" /><div class="divCol"></div><div class="divColLast"> <asp:Image ID="imgTeam" runat="server" />  <asp:Label ID="lblTeamName" runat="server" Text=""></asp:Label></div><div class="clearer"></div><div class="divCol">Rank:</div><div class="divColLast">   <asp:DropDownList ID="ddlEditRank" runat="server"> <asp:ListItem>1</asp:ListItem> <asp:ListItem>2</asp:ListItem> <asp:ListItem>3</asp:ListItem> <asp:ListItem>4</asp:ListItem> <asp:ListItem>5</asp:ListItem> <asp:ListItem>6</asp:ListItem> <asp:ListItem>7</asp:ListItem> <asp:ListItem>8</asp:ListItem> <asp:ListItem>9</asp:ListItem> <asp:ListItem>10</asp:ListItem> <asp:ListItem>11</asp:ListItem> <asp:ListItem>12</asp:ListItem> <asp:ListItem>13</asp:ListItem> <asp:ListItem>14</asp:ListItem> <asp:ListItem>15</asp:ListItem> <asp:ListItem>16</asp:ListItem> <asp:ListItem>17</asp:ListItem> <asp:ListItem>18</asp:ListItem> <asp:ListItem>19</asp:ListItem> <asp:ListItem>20</asp:ListItem> <asp:ListItem>21</asp:ListItem> <asp:ListItem>22</asp:ListItem> <asp:ListItem>23</asp:ListItem> <asp:ListItem>24</asp:ListItem> <asp:ListItem>25</asp:ListItem> <asp:ListItem>26</asp:ListItem> <asp:ListItem>27</asp:ListItem> <asp:ListItem>28</asp:ListItem> <asp:ListItem>29</asp:ListItem> <asp:ListItem>30</asp:ListItem> </asp:DropDownList></div><div class="clearer"></div><div class="divCol">Comments:</div><div class="divColLast"> <asp:TextBox ID="txtComment" runat="server" TextMode="MultiLine" MaxLength="500" Width="480" Height="200"></asp:TextBox></div><div class="clearer"></div><div style="white-space: nowrap; text-align: center;"> <asp:Button ID="btnSaveRankings" runat="server" Text="Save" OnClick="btnSaveRankings_Click" CausesValidation="true" /> <asp:Button ID="btnCancelRankings" runat="server" Text="Cancel" CausesValidation="false" OnClick="btnCancelRankings_Click" /></div></asp:Panel> </ContentTemplate> <Triggers> <asp:AsyncPostBackTrigger ControlID="ddlIssue" EventName="SelectedIndexChanged" /> </Triggers> </asp:UpdatePanel> </div> </form></body></html>

cs file...

using System;using System.Data;using System.Configuration;using System.Collections;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Web.UI.HtmlControls;namespace PowerRankingsAjax.admin{public partialclass index : System.Web.UI.Page { powerrankings oPowerrankings =new powerrankings(); DataSet ds =new DataSet();public String strWeek;public int intCountVal;protected void Page_Load(object sender, EventArgs e) { ScriptManager.GetCurrent(Page).RegisterPostBackControl(btnSaveRankings);if (oPowerrankings.ConnectToDatabase(lblError) ==true) {if (!Page.IsPostBack) {//GetWeek GetWeek(); BuildEditList(); BuildEditGrid(strWeek); } } ds.Dispose(); }protected void GetWeek() {//Current Week strWeek = oPowerrankings.GetMaxWeek(ds, lblError); }protected void BuildEditList() { ddlIssue.DataSource = ds.Tables[oPowerrankings.GetAllWeeks(ds, lblError).ToString()]; ddlIssue.DataTextField ="week"; ddlIssue.DataValueField ="week"; ddlIssue.DataBind(); intCountVal = oPowerrankings.GetHolder(ds, lblError);if(intCountVal > 0) { ListItem li =new ListItem("Edit","edit"); ddlIssue.Items.Add(li); }else { ListItem li =new ListItem("New","new"); ddlIssue.Items.Add(li); } lblError.Text = intCountVal.ToString();//ddlIssue.SelectedValue = strWeek; }protected void BuildEditGrid(string strWeek) { EditPowerRankings.DataSource = ds.Tables[oPowerrankings.GetEditPowerRankings(strWeek, ds, lblError).ToString()]; EditPowerRankings.DataBind(); }protected void ddlIssue_SelectedIndexChanged(object sender, EventArgs e) { strWeek = ddlIssue.SelectedValue;if (oPowerrankings.isNumeric(strWeek, System.Globalization.NumberStyles.Integer)) { BuildEditGrid(strWeek); }else { } }protected void EditPowerRankings_OnRowCreated(object sender, GridViewRowEventArgs e) { e.Row.Cells[1].Visible =false; e.Row.Cells[2].Visible =false; }protected void btnSaveRankings_Click(object sender, EventArgs e) { oPowerrankings.UpdatePowerRankings(Convert.ToInt16(hidRankEditIndex.Value), Convert.ToInt16(ddlEditRank.SelectedValue), txtComment.Text, lblError); mpeRankings.Hide(); strWeek = ddlIssue.SelectedValue; BuildEditList(); BuildEditGrid(strWeek); uEditPanel.Update(); }protected void btnCancelRankings_Click(object sender, EventArgs e) { mpeRankings.Hide(); }protected void btnEdit_Click(object sender, EventArgs e) { Button btnEdit = senderas Button; GridViewRow row = (GridViewRow)btnEdit.NamingContainer; hidRankEditIndex.Value = row.Cells[1].Text; imgTeam.ImageUrl ="../images/" + row.Cells[2].Text +".gif"; lblTeamName.Text = row.Cells[3].Text; ddlEditRank.SelectedValue = row.Cells[4].Text; txtComment.Text = row.Cells[5].Text; uEditPanel.Update(); mpeRankings.Show(); } }}

Postback Slowdown

I have a page that contains a table inside an update panel. The table is 10 columns wide and when the page is initially loaded it only contains the header row and a + under the table to add a row. The problem I have is after adding 4 rows the 5th slows down a lot. And from then on addings more rows gets slower and slower. Whenever the + is clicked it causes the update panel to update and dynamically recreate the table with another row. So it starts by just creating the header. The first time you click the + it creates the header and the 1st row. The next time it creates the Header and 1st and 2nd rows.. and so on.

I cannot figure out a way to speed this up, and as the user approaches 10 rows it begins to slow down to 3 to 4 seconds after htiting the button that anything happens. I think the problem is the viewstate is getting huge and causing it to be much slower. I cannot even get update progress images to work. They don't pop up right away, and when they do pop up they go away immediatly.

Any suggestions on ways to improve the speed? Or I am stuck dealing with a slow page.

Can you post any code?


You're right. The viewstate gets sent back for every AJAX call which means that adding a row

may as well be posting the whole page to the server from the servers point of view.

Use this plugin to see what's being sent over the wire:http://www.nikhilk.net/Project.WebDevHelper.aspx

Check outhttp://smarx.com/posts/delayed-load-with-an-updatepanel.aspx

This shows the oposite of what you're doing.

What you need to do is just update the new row instead of the whole grid.

HTH,

Jonathan.


Is there a way to add a row without recreating the whole table? If I update the panel without recreating the table the table goes away right now.

Thanks for the plugin, I will have to check that out.


Try to set <compilation debug = "false" />

may it will improve some ammount of performance..


If you have each row in a div for example:

<div id="table">
 <div id="row1">hello row 1</div>
<div id="row2">Hello row 2</div>
</div>
<asp:Button ID="clickme" runat="server" OnClientClick="javascript:updateTable(); return false;" Text="Add Row" />

Then you could do the following in JavaScript:

<script type="text/javascript">
function updateTable()
{
var table = document.getElementById("table");
table.innerHTML = table.innerHTML + "<div id='row3'>hello row 3</div>";
}
</script>

HTH,

Jonathan.



I have the same problem. Luckily, after optimizing the 'retrieval time'/row, the speed was acceptable for the number of rows I wanted to display.

If you want speed, you can try using the JavaScript method above, and don't update via Updatepanel. So your buttons change the data behind the scenes (without postback), while calling the JavaScript to show the updates.

Postback sees TextChanged event while timer initiated the postback


Hi,

I have a challenge which I cannot seem to master and I hope that somebody already solved it.

Here is the setup to create the issue:

Place an updatepanel on a page, place a timer control inside (or outside with a trigger section for the panel), set the interval to 3000 or so and enable the timer.

Then place a TextBox on the page and add some code to the TextChanged event.

Now start the page..

Type some text in the textbox but don't press enter, when the timer fires you will find that the TextChanged event comes in through the postback.

I think I have tried everything, partialrendering to true, updatemode to conditional, childelementsastriggers to false and so on...

I need the text entered in the textbox to stay as it is until the moment the user presses enter, while the update panel constantly refreshes a datagrid.

Does anybody have a solution? Would I need to use a javascript timer which updates the datagrid? would that prevent a postback?

Please help...

Thanks

Is the textbox inside the updatepanel?

If your expecting the user to hit enter, presumably that triggers a click event for a button. Why not read/process the textbox's value as part of the button's click event and avoid TextChanged altogether?


Inside or outside renders the same problem.

The thing is that when a user enters some text in the textbox but is not finished typing yet, the timer causes a postback which in turn results in the TextChanged event, but the user is not ready to post yet.


Yeah i'd say this is by design and theres nothing you can do about it. Modify your approach so it doesn't make use of the TextChanged event (as i suggested in previous post).


If you can put the DataGrid and TextBox in separate UpdatePanels, that would begin to solve the problem.


Ha, I won't sacrefice design over some "feature". I won't believe that this behaviour is by design and if it is then there must be a way to intercept the event..

Hmm... I may have solved my own problem.

P.S. the TextChanged event is needed as we are using barcode scanners which add a carriage return to the end of the text stream which triggers the TextChanged event just nicely. The user should also be able to enter some code without hitting a button as confirmation..

Thanks,

Wouter


I'm not sure how multiple UpdatePanels would change your design, since you didn't post any sample code.

You may want to take a closer look at how UpdatePanels work. What you're describing is the inevitable consequence of putting a timer on an UpdatePanel that contains data entry fields.

Postback to Open Window

i have a button in an update panel that checks through some business logic and if errors/warnings are generated i need to report them to the user.

i have no room on the screen to use for this and would like to show a dialog/window with anything to report.

anyone any ideas on how i could achieve this?

cheers

you can try to build a message control that has absolute position (CSS) , and it located in the center of the page (on top of every elements of page (using z-index)) with ok and close button.

the message control will be placed in every page and have it hidden before any message send, maybe you want to put it in master or basepage if there are a lot of pages going to use the control.


Use javascript:window.alert('Your message here!');


If you're using the AJAX Toolkit, check out theModalPopup Extender.

If you're not, jQuery'sBlockUI plugin is a nice way to accomplish that as well.


thanks for all the feedback.

i eventually used the modalpopup to handle this and works perfectly.

thanks again all...

postback when button click in firefox

Hi all,

can anybody help me out ?

I have a button and i write ...

<button id=

"clipButton">

<behaviors>

<clickBehavior>

<click>

<invokeMethod method=

"show" target="clipPopup" />

</click>

</clickBehavior>

</behaviors>

</button>

so button is clicked a div is popup ed. Its working fine in IE but in Firefox when i click on button postback occurs...i cud nt understand why its happening...please help me.

Thanks and Regards

Riyaz

Sorry folks, actuaaly i forgot to mention that im using dataNavigator

<dataNavigator id=

"pageNavigator" dataView="dataView"/>

and dataView

<dataView id=

"dataView" pageSize="7">

<bindings>

<binding dataContext=

"ClipartDS" dataPath="data" property="data" />

</bindings>

</dataView>

to display the filtered data from the dataView in the listView. I thought it'ld be a couse of the problem...plz comment on my problem.

Regards

Riyaz


hello.

can you post a small page with the hml + xml-script that demonstrates the problem you're having?


actually when i click button a div is popup with certain cliparts and when i click any clipart popup disappears and selected clipart is shown right hand side.

The HTML part is below:

<

br/>

Click this button to choose a clipart image

<br/><buttonid="clipButton">

ClipArt

</button><br/><divid="ClipArt"></div>

<

divid="PopColors"style="display:none; position: absolute; border-right: blue thin dotted; border-top: blue thin dotted; border-left: blue thin dotted; border-bottom: blue thin dotted;"></div>

<

divid="clipartImageRight"style="left: 500px; position: absolute; top: 290px; "><imgid="clipartImage"alt="Clip"src=""height="35"width="35"/></div>

<

divid="clipTemplate"><spanid="clipItemTemplateParent"><spanid="clipItemTemplate"><span><ahref="javascript:;"><imgid="clip"height="50px"width="50px"alt=""src=""/></a></span></span></span><divid="pageNavigator"><inputtype="button"id="firstPageButton"value="<<"/><inputtype="button"id="previousPageButton"value="<"/><inputtype="button"id="nextPageButton"value=">"/><inputtype="button"id="lastPageButton"value=">>"/> <aid="closePopUP"href="javascript:;"style=" color:Red; left: 350px; position: absolute;">close</a></div></div>

The XML markup is here :

<button id=

"clipButton">

<behaviors>

<clickBehavior>

<click>

<invokeMethod method=

"show" target="clipPopup" />

</click>

</clickBehavior>

</behaviors>

</button>

<dataNavigator id=

"pageNavigator" dataView="dataView"/>

<button id=

"firstPageButton" parent="pageNavigator" command="firstPage">

</button>

<button id=

"previousPageButton" parent="pageNavigator" command="previousPage">

<bindings>

<binding property=

"enabled" dataPath="hasPreviousPage"/>

</bindings>

</button>

<button id=

"nextPageButton" parent="pageNavigator" command="nextPage">

<bindings>

<binding property=

"enabled" dataPath="hasNextPage"/>

</bindings>

</button>

<button id=

"lastPageButton" parent="pageNavigator" command="lastPage">

</button>

<dataView id=

"dataView" pageSize="7">

<bindings>

<binding dataContext=

"ClipartDS" dataPath="data" property="data" />

</bindings>

</dataView>

<listView id=

"ClipArt" itemTemplateParentElementId="clipItemTemplateParent"

tabIndex=

"0" dataIndex="-1" >

<bindings>

<binding dataContext=

"dataView" dataPath="filteredData" property="data"/>

</bindings>

<behaviors>

<popupBehavior id=

"clipPopup" parentElement="clipButton" positioningMode="BottomRight" />

<clickBehavior>

<click>

<invokeMethod method=

"hide" target="clipPopup" />

<invokeMethod method=

"UpdateImage" target="XMPData" />

</click>

</clickBehavior>

</behaviors>

<layoutTemplate>

<template layoutElement=

"clipTemplate"/>

</layoutTemplate>

<itemTemplate>

<template layoutElement=

"clipItemTemplate">

<image id=

"clip">

<bindings>

<binding property=

"imageURL" dataPath="Image"/>

</bindings>

</image>

</template>

</itemTemplate>

</listView>

<image id=

"clipartImage">

<bindings>

<binding property=

"imageURL" dataContext="ClipArt" dataPath="dataItem.Image"/>

</bindings>

</image>

Thanks and Regards

Riyaz

Postback with button IN Update panel

Hello,

Q, I have 2 update panel's, one panel has 3 button's in it, say button1, button2, button3. Now i need to find a way to have a whole page postback with button1 (in update panel1) and a partial postback on button2 (also in panel1) . Is this posible.

Thanks in advange

Greetings Henk

hello.

well, you can try to add a dummy button outside the panel and then when the user clicks the button you'd call the click method over the other button...


In Atlas 1.0 we'll have a way to tell the UpdatePanel that certain controls should cause a regular postback even though they're inside the UpdatePanel. For now you'll have to use a workaround (such as the one described previously).

Thanks,

Eilon


Hmm, I tryed that, but that did not sucseed. I get the error btnDumie does not exist or sumthing like that. the problem is (I think that the submit button is only visible after an panelupdate, so that panel can't acces other elements on the page??)

I hope there is another sollution.


If it's possible in your scenario you could try to divide up your page such that the regular-postback button isn't inside an UpdatePanel. Once Atlas 1.0 is released you'll be able to do this very easily, but it's not quite ready yet.

Thanks,

Eilon


I am having the same issue. When is Atlas 1.0 due for release?

Thanks,

Murali


Here's the Atlas roadmap:http://weblogs.asp.net/scottgu/archive/2006/09/11/_2200_Atlas_2200_-1.0-Naming-and-Roadmap.aspx

Thanks,

Eilon


hello.

well, that post gives some clues, but no spcific date. btw, when are you guys start sharing the current versions you're developing with us? after all, i've been using atlas for months now and i've seen several posts where you guys say something like: "well, in v1.0 that problem is solved" or "you'll be able to do that easilly"...this just isn't enough!

according to the team's comments, it's as if you're changing several internal key parts of atlas. it's not that i'm against it, but you should also keep in mind that there are several people building applications with atlas and it' won't be a lot of fun to find out that v1.0 is out and that everything is completly different (when compared with the ctps!).

thanks.


I think the reason that we're not giving out a date is that there isn't a specific date chosen yet. What we will have is public previews of the new 1.0 Atlas (soon, but I'm not surehow soon). We'll also have a comprehensive document that describes the changes between the older Atlas CTPs and the new Atlas 1.0 CTPs so you can scan through it and identify any changes that you will have to make.

Thanks,

Eilon

PostBack with query string...

hi,

Here is what I am trying to do, I have a user control, usercontrol is one of many being loaded in a single default.aspx, inside this user control, there are Atlas TabPanels, in several tab panels there are user controls, in these user controls, there are controls causing a postback, the problem is when page is reloaded, it returns to default tabs, I like to pass a query string that contains active tab, but how can I do this in javascript? I am not sure where to put this here or in Atlas forum. Thanks in advanced.

Hi,

I think u need to set the smartnavigation propery to true . so that focus will not be lost during the postback

Swati


Hi,

Because there is a full postback, you need to use a HiddenField to maintain the current active tab index.
After the postback completes, active the corresponding index with javascript.
Like this:
$find('<%=TabContainer1.ClientID%>').set_activeTabIndex(the value kept in the hiddenfield);

Hope this helps.

Postback with MasterPage

hi all

i want to load other page with masterpage without postback

any one cane help me?

AOJ

Hi,

In my opinion, there is not elegant way to achieve this.

First of all, please note that MasterPage is quite different from a container (e.g.: frameset/iframe) in the client side's point of view. The client isn't aware of the existance of masterPage at all. Every actions fired by controls in the masterPage is the same as the one fired by control in a normal page.

So, if you'd like to implement this, what you need to do is to place a UpdatePanel on the masterPage, and load different controls into it programmatically. Then update the UpdatePanel.

PostBack without page refreshing

Hi, guys!

I have a very important question for me.

Does anyone know how to PostBack without page refreshing?

The situation is as following:

There are 2 DropDownLists on my page,

when I select any item from DropDownList1,

DropDownList2 must fill with items from SQLServer without any refreshing of page,

as if it works on desktop application.

Is it possible?

Thanks!

Hi,

check out theCascadingDropDown in the Toolkit.

Grz, Kris.


Hi,

you can put each of ddl into one UpdatePanel with AutoPostBack="true", then you have the postback of only the part of the page included in UpdatePanel.

Bye!
Stefano

PostbackAction ???

How the heck does one go about using the PostbackAction in javascript? I can't find anyone who is successfully using it in javascript.Hi,

please check this example:

<%@. Page Language="C#" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><script runat="server"> protected void Page_Load(object sender, EventArgs e) { // This will drop the __doPostBack function on page. Page.ClientScript.GetPostBackEventReference(this, String.Empty); if (Page.IsPostBack) { lblTarget.Text = Request.Form["__EVENTTARGET"]; lblArgument.Text = Request.Form["__EVENTARGUMENT"]; } }</script><html xmlns="http://www.w3.org/1999/xhtml" ><head runat="server"> <title>Untitled Page</title></head><body> <form id="form1" runat="server"> <atlas:ScriptManager ID="sm" runat="server"></atlas:ScriptManager> <div> <input type="button" id="myButton" value="ClickMe" /> <br /> <span>Postback target: </span> <asp:Label ID="lblTarget" runat="server"></asp:Label> <br /> <span>Posback argument: </span> <asp:Label ID="lblArgument" runat="server"></asp:Label> </div> </form> <script type="text/xml-script"> <page> <components> <application load="application_load" /> </components> </page> </script> <script type="text/javascript"> function application_load() { var myButton = new Sys.UI.Button($('myButton')); myButton.set_id('myButton'); myButton.click.add(Function.createDelegate(this, clickHandler)); myButton.initialize(); function clickHandler(sender, e) { var postBack = new Sys.WebForms.PostBackAction(); postBack.set_target(sender.get_id()); postBack.set_eventArgument('myArgument'); postBack.performAction(); } } </script></body></html>

If you need only to cause a post back use this line in your javascript code:

__doPostBack();

If you need data from your client script code then use this:

__doPostBack('X','Y');

X --> This is some name you make up that allows you to identify what caused the post back on the server-side code.

Y--> This is the data you are passing back from your javascript. If you need more than one value passed back just separate the values with a comma or something. ie. '42,53' Then you can separate the string in your server side code.

The Server Side of things.

If you are only causing a post back then you don't need to worry about any server-side code. If you did pass data back put the following code in your Page_Load event and use the If statement to see what fired the post back since other controls will also use the javascript post back.

If Request.Form("__EVENTTARGET") = X Then

dim s as String = Request.Form("__EVENTARGUMENT")

'do something with your data

End IF

Hope this helps.


hello.

btw, x is normally used for sending the client id of the server side control that started the postback and y is used to send info associated with that action. for instance, if you have a button which has id bt, setting x to bt will automatically invoke a previouslly configured method on the server which was configured to handle the click event of that button.

Postback? how?

in Ajax, how is it possible to do a postback to the server? So for example, i have a modalpopupdialog, and when i click the ok button in it, i want it to postback to the server to process the request or whatever.

how is this done? Currently I have a scriptmanager on the aspx page, and the User control for the modaldialog - now what?

I've noticed something.

If I don't add this custom user control containing ajax in a webpage, then anything on that webpage, the links and button clicks work fine. However if I add this user control with ajax, the button post backs do not fire at all. This is wierd and no idea why. I think it maybe to do with the scriptmanager or the modalpopupextender but not sure

what would the reason be for the click events to the server not being able to fire when we add this user control?


I'm not sure why postbacks don't work with the modal popup, possibley because it was intended to be used with javascript to customise the page?

In any case, you can use the OnOkScript and OnCancelScript properties of the modalpopupextender to fire a postback. You just need to add this line of javascript as the script that is fired when one of those buttons is pressed:

__doPostBack(TargetControl, Argument);


Replace TargetControl with the control id that triggered your postback (if you want a pass the server a different control id you can too) and replace Argument with any argument you want to pass to the server.

Then, in the Page_Load of your page add these lines:

string controlid = Request.Params.Get("__EVENTTARGET");
string argument = Request.Params.Get("__EVENTARGUMENT");

This will allow you to read the arguments you have passed the server, from here you can trigger a function or event handler.



I actually did that before also but made no difference.

Basically.....

If I have a form and place a simple button on it, double click it to make the click event and do something like Response.Write("I was clicked");, it will work fine.

BUT as soon as I add the modalpopupextender, or even infact, add the assembly reference in the aspx file for the ajaxtoolkit, then when i click that button again - nothing happens. no post back is happening. nothing is firing back at all - the page stays the exact same.


any ideas? I'm stuck. I just created a new ajax enabled project on my main home computer, and the same thing happens - when you insert the modalpopupextender, set all the properties etc... it doesnt fire anything (it shows the control of course) but when you take out that control and press say, the button (which is what the OkControlID property is set to in the ajax control), it works and fires the click event.
looks like there seems to be a problem when using base master templates!! How is it possible to use the Base master templates and making ajax do the postback (of the modalpopupextender)

Works great for me – the code…

<asp:LinkButtonID="btnUpload"BackColor="ButtonFace"Font-Size="11px"Font-Underline="false" ForeColor="Black" CssClass="CenterText"BorderStyle="Outset"BorderWidth="1px"

Text="Upload New Photo"runat="server"Width="100px"Visible='<%#IsAdmin%>'>

</asp:LinkButton>

<asp:PanelID="pnlUpload"runat="server" CssClass="modalPopup"style="display:none">

<asp:LabelID="Label5"Font-Size="11px"Font-Bold="true"runat="server"Text="Upload Photo"/>

<asp:LabelID="ErrorLabel"runat="server"Text=""/>

<table>

<tr>

<tdclass="formlabel"align="right">File:</td>

<td><asp:FileUploadID="FileUpload1"runat="server</td>

</tr>

<tr>

<tdclass="formlabel"align="right">Image title:</td>

<td><asp:TextBoxID="imgTitle"runat="server"CssClass="txtfield"/> </td>

</tr>

</table>

<br/>

<tablestyle="margin-left:auto; margin-right:auto;">

<tr>

<tdstyle="width:100px;"align="left">

<asp:ButtonID="btnUploadImg"runat="server"Text="Upload"OnClick="UploadFile_Click"/>

</td>

<tdstyle="width:100px;"align="right">

<asp:ButtonID="btnClose"runat="server"Text="Close"/>

</td>

</tr>

</table>

<br/>

</asp:Panel>

<ajaxToolkit:ModalPopupExtenderID="modalPopup"runat="server"

TargetControlID="btnUpload"

PopupControlID="pnlUpload"

BackgroundCssClass="modalBackground"

DropShadow="true"

CancelControlID="btnClose"/>

Code behind in vb…

ProtectedSub UploadFile_Click(ByVal senderAsObject,ByVal eAs System.EventArgs)

If FileUpload1.HasFile =TrueAnd IsAdminThen

Dim imageidAsInteger

Dim albumidAsInteger

Dim oAsObject = Request.QueryString("AlbumID")

IfNot oIsNothingThen

albumid =CInt(o)

EndIf

imageid = ImageUtils.uploadImage(imgTitle.Text, albumid, FileUpload1.FileContent)

DataList2.DataBind()

DataList2.SelectedIndex = DataList2.Items.Count - 1

FormView2.DataBind()

FormView2.PageIndex = FormView2.PageCount - 1

ErrorLabel.Text =""

Else

ErrorLabel.Text ="<p>Please select a file to upload<p>"

EndIf

EndSub


yeh it doesnt work. I'm wonder if its to do with the fact that base/master pages are being used, as well as several user controls being placed on an aspx page?
Was anybody ever able to resolve this I have the exact same problem, only controls within a gridveiw fire their events...

I don't think it has anything to do with base pages or master pages. The project I'm working on uses a custom base page, inherits from a master page, and runs more than one user control. The modal popup seems to work just fine. One thing worth considering is building an AJAX Control Toolkit website. You'll find the option if you ran the .vsi installer. It can be informative to look at the reference structure and the web.config after creating a temporary site from that template. Good luck!

Keith


Would you mind posting the markup of your ModalPopup that has working controls?
I finally found the cause of this problem.Smile After going through each control I discovered that when I removed the RequiredFieldValidators from the page, the click events fired. So I put them back and then set causesvalidation = false for the button and again the click event fired. This must be a bug with the extender. So basically you have to disable validation on any control in the modal pupup window.

interesting. ill see if we have this (cant right now) however currently the way it stands, it still does not work. I'm able to do it on a simple aspx page (which does not use a master page) but when using a master page, it does not work.

how do we get it to work with validation, should there be validation in our solution/project?


nope - we dont have any requiredFieldValidators on the pages we are using the ajax control on. - still stuck

Postbacks and animationextender / modalpopupextender

I have a usercontrol which handles its own postbacks. I would like to place this usercontrol in a panel, which gets displayed either using the animationextender or the modalpopupextender. The problem is that when a user clicks on any control which fires the postback in the usercontrol, the usercontrol disappears from the page.

Would anyone happen to know how to prevent the target panel of a modalpopupextender or animationextender from disappearing on a postback? Thanks!

Have you gotten anywhere with this problem? I just came across this issue and need to also understand how to properly do this. Thanks.

postbacks and ajax

I have created dynamic datagrid with vb.net using (no javascript) that has checkboxes and dropdowns, and when checkboxes checks it postsbacks, and shows data comes from database, now I want no postbacks to happen. I guess I can do that in ajax, but need a help on it, since I have never done that before and don't know ajax. Can anybody help me on that?

Hi There,

If you are using .net 2.0 with ajax.net

Try following, this is do a callback when you click on your checkboxes

<asp:ScriptManagerID="ScriptManager1"runat="server"></asp:ScriptManager>

<asp:UpdatePanelID="updatepanel1"runat="server">

<ContentTemplate>

YOUR DATAGRID HERE

</ContentTemplate>

</asp:UpdatePanel>


I am using 1.0 and didn't work on that, I need 2.0 then? Do I need to start with ajax enable website or can I add it those lines later to existing project ?


actually my asp.net version 2.0, but ajax 1.0


Check out all the vid's on ASP.NET AJAX:

http://www.asp.net/learn/videos/default.aspx?tabid=63

This one in particular should help:

http://www.asp.net/learn/videos/view.aspx?tabid=63&id=75

This one discusses what is needed to use ASP.NET AJAX with an existing application:

http://www.asp.net/learn/videos/view.aspx?tabid=63&id=81


Unfortunately I cannot view videos, it says respond denied.


What d4dennis@.inspir3 said should work but you have to add somestuff to your web.config file before the site is "ASP.NET AJAXenabled".


This goes under the <configuration> tag

  <configSections>
<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>
<sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="Everywhere" />
<section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication" />
<section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication" />
</sectionGroup>
</sectionGroup>
</sectionGroup>
</configSections>

 This goes inside the <pages> tag:
  <controls>
<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</controls>

If you haven't made any changes to your <compilation> section replace it with this: (Otherwise change it accordingly)
  
<compilation debug="false">
<assemblies>
<add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</assemblies>
</compilation
<httpHandlers>
<remove verb="*" path="*.asmx"/>
<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>
</httpHandlers
<httpModules>
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</httpModules>


  Finally add this just above the </configuration> tag:
 
 <system.web.extensions>
<scripting>
<webServices>
<!-- Uncomment this line to customize maxJsonLength and add a custom converter -->
<!--
<jsonSerialization maxJsonLength="500">
<converters>
<add name="ConvertMe" type="Acme.SubAcme.ConvertMeTypeConverter"/>
</converters>
</jsonSerialization>
-->
<!-- Uncomment this line to enable the authentication service. Include requireSSL="true" if appropriate. -->
<!--
<authenticationService enabled="true" requireSSL = "true|false"/>
-->
<!-- Uncomment these lines to enable the profile service. To allow profile properties to be retrieved
and modified in ASP.NET AJAX applications, you need to add each property name to the readAccessProperties and
writeAccessProperties attributes. -->
<!--
<profileService enabled="true"
readAccessProperties="propertyname1,propertyname2"
writeAccessProperties="propertyname1,propertyname2" />
-->
</webServices>
<!--
<scriptResourceHandler enableCompression="true" enableCaching="true" />
-->
</scripting>
</system.web.extensions>
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<modules>
<add name="ScriptModule" preCondition="integratedMode" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</modules>
<handlers>
<remove name="WebServiceHandlerFactory-Integrated" />
<add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode"
type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode"
type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</handlers>
</system.webServer>

Hope this helps!


Thank you for laying out this for me, I just found the same thing right before you have sent me and implemented, so web.config is fine now, but in my existing project , I have lots of panels, tables etc. and I tried to put my datagrid inside the this format

<body> <formid="form1"runat="server"> <asp:ScriptManagerID="ScriptManager1"runat="server"/> <asp:UpdatePanelID="UpdatePanel1"runat="server"> <ContentTemplate> <div>

datagrid

</div> </ContentTemplate> </asp:UpdatePanel> </form></body>

which I don't want it to refresh whole page is working but it is something weird happening inside the my grid, I have checkbox and dropdown and textboxes right, when I checked the checkbox, page is not refreshing which is Good, what I want, but because I need to enable dropdown when checkbox checked, refresh happening inside the grid to dropdown, I wonder if I put my updatepanel and contenttemplate to right place or not?


I need when checkbox checked inside the grid, my dropdown inside the grid should enables, gets filled with data without refreshing the page or datagrid. Right now, it is not refreshing the page but inside the grid almost like part of the grid where dropdown there gets refresh( looks like flashing at that area where dropdown sits) I don't want that.

I wrote a lot of working code (at SERVER SIDE) didn't use javascript that does things inside the datagrid when user checks checkboxes. But it was keep refreshing the page with each checkbox clicks that's why I need to use ajax.