Showing posts with label controls. Show all posts
Showing posts with label controls. Show all posts

Wednesday, March 28, 2012

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 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

Pre-emptive Controls not working

I have installed Atlas the way the documentation says and am using VWD Express.
When I am in code mode, and type in <atlas: it does not pre-emp it and have the controls in the drop down. I'm not sure why? I finish manually entering it in, and receive no error. Not sure why this is doing it. Any ideas, or anyone had similar problems?

Mick

hello.

sometimes it takes a while to initialize the intellisense list here, but then it starts working without any problems.


yes, it does take awhile, today it is working perfectly!!
Thanks,
mick

Preferred Approach to Existing .Net Server Controls and Client Scripting

In asp.net 1.1, the mechanism I used on many occassions is to add attributes to work some client side script. ie. a .NET dropdownlist:

ddlMonOfficeStart.Attributes.Add("onChange",string.Format("return ValidateTimeSelection('{0}', '{1}', 'divMonOfficeStart', 'divMonOfficeEnd')", ddlMonOfficeStart.ClientID, ddlMonOfficeEnd.ClientID));

First off, I'm not sure if the above approach is necessary with Atlas, but the next question is how to handle this in javascript:

Do I simply get the clientid of the dropdownlist and do my 'normal' javascript - or at this point do I try to 'cast' this dropdownlist object on the client side to the Sys.UI.Select object?

I see this example here:http://atlas.asp.net/docs/util/srcview.aspx?path=~/atlas/samples/controls/simple_control.src - but in this example, these are 'html' elements, not .net server side controls?

In the above attribute, the script might look like this:

<scripttype="text/javascript">

function ValidateTimeSelection(g_ddl1, g_ddl2, g_div1, g_div2) {
var dd1 = ($(g_ddl1));
...
}

</script>

in this line here: var ddl = ($(g_ddl1)) I'd rather like to do something like:

var dd1= new Sys.UI.Select($(g_ddl1));

and utilize the Atlas script library.

Hopefully this makes sense :)

You can simply continue to build your custom control with regaulr JavaScript that is rendered by the control through the Page.ClientScript.RegisterXXXScript methods. Where your 'behavior' is simple, this might still be the best approach.

However, if you wish to build a new control that makes use of the Atlas libraries and perform much more rich behavior in the client, then you can begin to develop custom controls that implement IScriptControl, that can then render the required xml-script (declarative Atlas script) to the client. You'll need of course to ensure that there is a Scriptmanager in the page, in order to render your script. This means that you can divorce yourself from writing complex JavaScript etc.

If you have bew custom behaviors that you want your custom control to make use of, then you could potentially build Atlas client-side behaviors/controls that agfain you can render through the custom control. This would also yield those client-side components for other client-side rich applications.

Saturday, March 24, 2012

Problem adding atlas controls to existing web form

I created an atlas web site from the Atlas Template and added some files from another web site, so I tried to add <atlas:ScriptManager...> tag, but VS2005 didn't recognize Atlas (now ASP.Net AJAX) tags.

How can I add Atlas to existing ASP.Net web sites?

i'll need to register the "altas" tag in your web.config file.

I've discovered the problem. Atlas intellisense doesn't work in projects on network shares, so I installed Visual Source Safe and now it recognizes as being run locally.

Wednesday, March 21, 2012

Problem in finding dynamically loaded user control in javascript when using ASP.Net AJAX

Hi,
I am loading user controls dynamically in an update panel. User control loads smoothly, but when i viewsource the page, the current loaded user control can't be found there. What I found is old user control which loads when page is loaded for the first time. I have a grid view control in that user control which i want to validate using javascript, but this grid view control can't be found by javascript 'getElementById' function. How can i access grid view and other controls in javascript?

Thanks in advance.
Regards

Amjad Paracha, MCP
Software Engineer.

Seehttp://forums.asp.net/t/1149634.aspx

My guess is that your ID is incorrect when you are trying to access the control.

-Damien


amjad.paracha:

Hi,
I am loading user controls dynamically in an update panel. User control loads smoothly, but when i viewsource the page, the current loaded user control can't be found there. What I found is old user control which loads when page is loaded for the first time. I have a grid view control in that user control which i want to validate using javascript, but this grid view control can't be found by javascript 'getElementById' function. How can i access grid view and other controls in javascript?

Thanks in advance.
Regards

Amjad Paracha, MCP
Software Engineer.

What you are experiencing is the reality of how a browser actually works. The source code that you download on page load is not fixed. Its image in browser computer memory can be altered dynamically (especially by Ajax updates) and that is why the source does not reflect it. If you want to see much more closely what is going on in the page, download and install the IE Developer Toolbar (or another browser DOM viewer). This will show the current DOM and you may in fact find that the Id you are looking for is either not there or it is set as a ClientID (a property of most controls) which does not match the original ID. This would be true for instance of any ordinary control in a tab panel. They will not have the same ID you assigned on the server. As well any control in a repeating control will be assigned a new client id.

AFAIAC every develper that develops without a tool that can see the DOM as it exists is working blind. As a bonus, the IE Developer Toolbar has the ability to modify styles on the fly so you can see what they do, trace styles and a few other things.

Problem in Speeding Up First Load of this page...

Improving Response Loading

Hi,

Is there a guide in improving loading performance when using atlsa controls liek update panel, tabcontainer and tabpanels, multiview and view, Gridview, composite controls, web user controls, updateprogress and other asp.net web controls together in a web user control. I have this user control that contains 2 tabcontainers, first, has 3 tabpanels, second,
is contain as child tabpanel of one of outer tabpanels, has 6 tab panels, currently 3 of these tab panels has usercontrols, 2 outer tabpanels has gridview in them.

Is there a way to speed up loading for first time? Any ideas, I time first load of this page, it time between 4 to 6 seconds, sometimes even 9 seconds.

Basically AddButtonAttribute(), GetPostBackAugument(), GetGlobalParameter(), PopulateFilterDropDown(), PopulateFilterDropDown(), and RestrictTabs() and base.OnLoad(e) are executed when this page is loaded for first time.

protected override void OnLoad(EventArgs e) { AddButtonAttribute();//Add Attribute javascript functionstring args = GetPostBackArgument();//Get _PostBack(control, argument)string tabPage = GetGlobalParameter();//Get a global hidden field valueif (!Page.IsPostback) {if (tabPage !=string.Empty && args !="Redirect") RedirectTabPage(viewPage);//Where a TabPanel speciifc function is handled including loading usercontrol to this usercontrol }else {if (tabPage !=string.Empty && args !="Redirect") RedirectTabPage(tabPage);//Where a TabPanel speciifc function is handled including loading usercontrol to this usercontrolelse if (args =="ContentRedirect") PopulateFilterDropDown();//Populate 3 Dropdownlist controls } RestrictTabs();//Restrict Tabpanelsbase.OnLoad(e); }

Structure like this xml:

4 usercontrols

<hiddenfields = 14>
<UpdatePanel>
<TabContainer>
<TabPanel>
<MultiView>
<View>
<UpdateProgress></UpdateProgress>
<control></control>
<GridView></GridView>
<control></control>
</View>
<View>
<Table>
<control>
</control>
<control>
</control>
</Table>
</View>
</MultiView>
</TabPanel>
<TabPanel>
<MultiView>
<View>
<UpdateProgress></UpdateProgress>
<control></control>
<GridView></GridView>
<control></control>
</View>
<View>
<Table>
<control>
</control>
<control>
</control>
</Table>
</View>
</MultiView>
</TabPanel>
<TabPanel>
<TabContainer>
<TabPanel>
<Table>
<control>
</control>
<control>
</control>
</Table>
</TabPanel>
<TabPanel>
<Table>
<control>
</control>
<control>
</control>
</Table>
</TabPanel>
<TabPanel>
<Table>
<control>
</control>
<control>
</control>
</Table>
</TabPanel>
<TabPanel>
<UserControl></UserControl>
</TabPanel>
<TabPanel>
<UserControl></UserControl>
</TabPanel>
<TabPanel>
<UserControl></UserControl>
</TabPanel>
</TabContainer>
</TabPanel>

</TabContainer>
</UpdatePanel>

Thabks in advanced.

I was wondering using Session to replace HiddenFields to speed up loading, and put controls found inside tab into a user control and loading them when it is needed, will this speed up loading process a lot?

Try this set

<% @.Page Trace="True" %>The trace information will show you exactly how large your ViewState is for that page.

try to figure out which controls you can disable the ViewState for (EnableViewState="False") or what might be causing your ViewState bloat.

Check debug="false" is et or not in web.config, it will improve some performance

problem of UpdatePanel with legacy code

The page has UpdatePanel control also has many custom controls written under aps.net 1.1. After use command 'iisrestart', the respones of the first time access is correct. UpdatePanel works very well. But when we access the site again, there will be some 'access denied' exceptions. and UpdatePanel cann't work correctly. The page still refreshs when submit something in UpdatePanel.

Thanks

Update Panel only work with the xhtml transitional code. Configure your web config file from legacy to transitional
but the first access is currect after restart IIS server. how to explain it with you theory? in my opinion, it may because of cache or some related things, doesn't it?

thanks, i'v solved it. change <xhtmlConformance mode="Legacy"/> to <xhtmlConformance mode="Transitional"/> .

this article makes it clearhttp://weblogs.asp.net/scottgu/archive/2006/12/10/gotcha-don-t-use-xhtmlconformance-mode-legacy-with-asp-net-ajax.aspx

Problem of Validation Controls With AJAX Panel.

Hi All,

I am facing a problem when using validators inside AJAX update panel. The scenario is that i have some requiredFieldValidators inside AJAX Update Panel. When partial post back occours then validators do not show error message, its another things that page also not submites.

Can any one help me in this regard.
Thanks.

acording to me, AJAX and asp.net validation controls doent go well with each other. You try using ajax validation control


Disable the the client side scripts of those validators, otherwise checkout this threadhttp://forums.asp.net/t/1066821.aspx