2012年3月28日水曜日

requirePermission="false" in the web.config return warning.

I have unstalled AJAX rc 1 and I get the following warning(4 times), from my web project web.config, after compilation:

"The 'requirePermission' attribute is not declared"

How can I get rid of this warning ?

It comes from this section:

<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"/>
<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"/>
<section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"requirePermission="false"/>
<section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"requirePermission="false"/>
</sectionGroup>
</sectionGroup>
</sectionGroup>
</configSections>

Hi leeorc

pleas review link below

http://forums.asp.net/thread/1204349.aspx

hope it helps you


Ok I took the following advice:

You can workaround it by opening "c:\Program Files\Microsoft Visual Studio 8\XML\Schemas\dotnetconfig.xsd" and inserting the following at line 40:

"<xs:attribute name="requirePermission" type="boolean_type" use="optional" />"

-------------------------------

Despite the fact that one person didnt recommend it, the workaroundhelpedme with non harmful ireversable issues.

Thanks

Leeor


I found that in the string "<xs:attribute name="requirePermission" type="boolean_type" use="optional" />", the type should be Type, I mean the t should be upper cased.

Liang

Reset (buttom) Functionality

Can somebody tell me of a robust way to reset controls (server side) on a form using ajax? Not sure if this is clear or not but the issue that I'm having is that I have an update panel that contains about 6-8 controls (drop down lists and text boxes). The text boxes contain ajax watermark extenders. I tried using the standard html reset button however, my watermarks are not coming back as the defautl text for each text box. Instead, the text boxes are just blank.

In addition, when just resetting a text box control in an update panel, if there is a dropdownlist (postback set to no) the drop down list flickers everytime and it is somewhat annoying.

Any advice and information on these two issues would be greatly appreciated.

Thanks

Hasn't anybody solved this?!

I've got a Reset link that calls a client-side javascript function, but I can't reset a watermarked textbox. (I've tried resetting its class attribute and its value, but it then loses its watermark behaviour.)

Any help would be greatSmile


I also am having this problem. It is amazing that nobody has replied!??Smile

Cheers

Reset a CascadingDropDown control

Can anyone tell me how to reset a group of drop down lists that are grouped together in a CCDD control? I've tried calling dropDownList1.Items.Clear(); but that's not working.

Thanks!

Jason

not sure on this one... but I think you need to call _onParentChange() on the first CascadingDropDownBehavior object... I think you can just set the ID in the CascadingDropDownProperties and then use $object('long_generated_id')._onParentChange( false );

Sorry, but I'm not following... I can't find a method or event _onParentChange for either the CCDD or the DDL itself. I'm also not sure what you mean by $object("long_generated_id"). Where to I get this ID?

Can you provide an example?

Thanks!


Hi Jason,

Jaykul's talking about setting the ID in your CascadingDropDownProperties instance which will cause an ID to be used when it is rendered to the client. However, the ID you use will get mangled and include all the names of its parent naming containers. This mangled ID is what Jaykul was referring to by "long_generated_id." See the MSDN docs onnaming containers for more information. I think one of the easiest ways to find out the long version of the name is to turn tracing on and find it in the control tree.

Thanks,
Ted
$get("<%=ddlCountry.ClientID%>").selectedIndex = 0;

$get("<%=ddlOffice.ClientID%>").selectedIndex = 0;

$get("<%=ddlSalePerson.ClientID%>").selectedIndex = 0;

$find("<%=CascadingDropDown1.ClientID%>")._onParentChange(false);

Reset Button Onclick Adds WebForm_DoPostBackWithOptions

I'm trying simply call JavaScript to reset the form and this is added, I'm guessing, from script manager. When I click the reset butt on now, rather than resetting the form I get a postback. Any idea why script manager does this and what I can do to prevent the postback?

Hi Travich,

Here is the sample that you can reference to.

<%@. 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></head><body> <form id="form1" runat="server"> <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager><%=DateTime.Now.ToString()%> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> <input id="Reset1" type="reset" value="reset" style="display:none" /> <asp:Button ID="Button1" runat="server" Text="ResetForm" OnClientClick="resetForm();return false;"/> <script language="javascript" type="text/javascript"> function resetForm(){ $get("Reset1").click(); } </script> </form></body></html>

I hope this help.

Best regards,

Jonathan

Reset Cascading Dropdown

I have a set of cascading dropdowns that I need to be able to programatically reset via javascript. I can change the selectedIndexes but that doesn't change any of the data "behind the scenes".

Thanks

Hi

Doesn't change any of the data "behind the scenes", What you mean?

Would you please post some code,so I can reproduce the problem and resolve it more quickly?

Thanks


As I have seen it for three cascading drop downs there are also three hidden form fields that contain data. My specific scenario was modifing some existing code that utilized three drop downs. The application was a store selector. The user could type in a postal code or use drop downs (Country, Region, City). I needed to reset the drop downs if a user types in a postal code. Setting up the blur event on the postal code text box was simple enough. But getting the drop-downs to reset was more challenging. I originally trimmed the item list down to the first item (please select). However on postback the original drop down selections came back. What I ended up doing was triming the item list and resetting the "hidden" fields to ":::" which is what the starting state appears to be.

There has to be an easier way to reset the drop downs to thier default state (via javascript). If the user simply sets the first drop down to the 0 index all drop downs reset. However, using using JS to set the selectedIndex property doesn't cause the client side event to fire.

Hopefully that helps a little. I am probably just missing something obvious. Is the client side JS code documented anywhere?

Reset Controls inside an UpdatePanel

Is there an easy way to reset all controls within an updatepanel without having to reload the page? Or can I reload the page without using Response.Redirect or Server.Transfer? My page has 3 updatepanels.

Pls Define "Reset".


Remove all data in the controls.


Hi,

Thank you for your post.

I think it is easy! Do you remeber the reset HTML contorl?

The contorl reset the whole form Elements to original value.

Just add this:

<input id="Reset1" type="reset" value="reset" />

If you don't want display it,just hidden it and fire the click event of it in javascript.

If you have further question, let me know.

Best Regards,


Thanks

Reset controls in update panel when error is thrown

Hello fellow developers,

A user enters a value in a textbox and i click a button to get some data, but a server error is thrown.

Is there a way to clear/reset the textbox in an UpdatePanel when there is a server error?

If there is a way, can someone assist in providing me that trick?

Thanks in Advance.

Protected Sub myButton_Click(ByVal senderAs Object,ByVal eAs System.EventArgs)Handles myButton.Click
Try
' Whatever code that I'm trying to run goes here.
' This is the code that my produce the error.
Catch
myTextbox.Text =""
End Try
End Sub


Can't you simply use a try/catch block, and catch the exception? If an exception is thrown reset it to the old value. You can use a hidden label or textbox to store the previous value.


Use this

protected void ScriptManager1_AsyncPostBackError(object sender, AsyncPostBackErrorEventArgs e)
{
if (condition)
{
ScriptManager1.AsyncPostBackErrorMessage =
e.Exception.Message;

}
else
{
ScriptManager1.AsyncPostBackErrorMessage =
"An unspecified error occurred.";
}
}


I apologize. My example scenario was not explained the way I originally thought.

The example should be that when using AJAX you want to show an error message AND reset the controls.

If you write code to 'Throw' a custom error message to an alert window, nothing after the 'Throw' gets executed (clearing my textbox).

So my question really should be:

Is there a way, using AJAX, to 'Throw' a custom error message to an alert window and still reset controls? Either on the server or client side.

Thanks.


Protected Sub myButton_Click(ByVal senderAs Object,ByVal eAs System.EventArgs)Handles myButton.Click
Try
' Whatever code that I'm trying to run goes here.
' This is the code that my produce the error.
Catch exAs Exception
ScriptManager.RegisterStartupScript(Page, Page.GetType,"ErrorMsg", "alert('" & ex.Message & "');",True)
myTextbox.Text =""
End Try
End Sub


Thanks Buddha, that's just what I needed.