Showing posts with label button. Show all posts
Showing posts with label button. Show all posts

Wednesday, March 28, 2012

view problem within cc1:ModalPopupExtender ..

I have a view problem within cc1:ModalPopupExtender .. when I click an asp image button the specified panel located most top-left in a page even I do not use x or y ModalPopupExtender properties

this problem happens only with ie

in firefox everything works fine ..

here is ModalPopupExtender code :

<cc1:ModalPopupExtender ID="ModalPopupExtender3" runat="server"
TargetControlID="submitBuyImgBt"
PopupControlID="Panel1"
BackgroundCssClass="modalBackground"
DropShadow="true"
OkControlID="OkButton"
OnOkScript="onOk()"
CancelControlID="CancelButton" />

any help would be greatly appreciated

why it's position always in top left side of the page ?


what does the css look like for the panel? are you using one?

heres what i always use and it shows up at the center of the screen.

<ajax:ModalPopupExtender ID="mpeEditUserForm" runat="server" TargetControlID="btnEditUser" BackgroundCssClass="modalBackground"
PopupControlID="pnlUserModal" />
<asp:Panel ID="pnlUserModal" runat="server" CssClass="modalPopup" Style="display:none; padding:3px 3px 3px 3px" Width="320px">

css:

.modalBackground
{
background-color:Gray;
filter: alpha(opacity=70);
}
.modalPopup{
background-color:White;
border: solid 3px Gray;
padding: 3px 3px 3px 3px;

font-size:medium;
}


Mezzaluna:

what does the css look like for the panel? are you using one?

heres what i always use and it shows up at the center of the screen.

<ajax:ModalPopupExtender ID="mpeEditUserForm" runat="server" TargetControlID="btnEditUser" BackgroundCssClass="modalBackground"
PopupControlID="pnlUserModal" />
<asp:Panel ID="pnlUserModal" runat="server" CssClass="modalPopup" Style="display:none; padding:3px 3px 3px 3px" Width="320px">

css:

.modalBackground
{
background-color:Gray;
filter: alpha(opacity=70);
}
.modalPopup{
background-color:White;
border: solid 3px Gray;
padding: 3px 3px 3px 3px;

font-size:medium;
}

I have CSS but it's still not working .. but both panel and moalPopupExtender located in a web user control ( .ascx )

does the problem because of this ?

Note that every thing works fine in firefox. however not fine in ie6 or above


Not sure on that then. I always have the opposite problem. I get things to work in IE and they fail in Firefox.


ViewState in Session is still uploaded after AsyncPostBack

Hi all,

Here is the basic setup of my page.

- ViewState stored in session
- AutoCompleteExtender using a WebService
- UpdatePanel triggered by button next to AutoComplete TextBox

Here is the behavior I'm experiencing (note that I have validated this with Fiddler):

Page loads first time. "id="__VIEWSTATE" value="y0V/cubnEZ1qzAvIgW0oRpVSc8AvJU6rtssTVFt7+B8="
ViewState is short as expected because storing it in the session.

Now, I click on the button to activate the UpdatePanel, causing a partial postback. This takes much longer than expected. After inspecting with Fiddler I see that it is uploading 50K. I inspect the Request and notice that most of it is my ViewState (I have a repeater on the page). I even turned EnableViewState off on the Repeater and it still uploads it.

My questions are:

1. Where is this uploaded ViewState coming from? It was not downloaded, is it generated clientside by JavaScript?
2. How can I stop this ViewState from being uploaded?

Regards,
Cole

I now realize this is not the viewstate but all of the form elements names & values being concatenated together. Is there a way to adjust what gets sent back from the controls on a AsyncPostBack?


The only way I'm aware of is to not use updatepanels to traffic your info, but instead to use web services, page methods, or hand-jam your own webrequest.

Viewstate was invalid when using the back button

Ok, this is going to be difficult to explain but I'll do my best. So we have several pages that make significant use of update panels. So you can interact with the page and the update panel does its thing. Then you can click a link that takes you to a different page.

Now, what can possibly happen is this scenario where the user then hits the back button so they are back on the page with the update panel. But they go back to the page and the update panel has reverted to its original state. It doesn't look like what it looked like when they left the page.

If you then click on the page to cause the update panel to do its thing again, you get a "Viewstate verification failed. Reason: Viewstate was invalid." error.

Anyone have any thoughts on this?

Are there any events fired when the back button is pressed? Is there anyway when the back button is pressed that I can set the update panel to be the state that it was in when the user left?

Thanks a lot!

Hi,

ASP.NET Futures inlude special control to control browser history and restore AJAX pages when user clickcs BACK. I have never used it, but as far as I know it is what you are looking for. See:http://quickstarts.asp.net/Futures/ajax/doc/history.aspx

-yuriy
http://weblogs.asp.net/ysolodkyy


The history control works great while you remain on the same page. So you can bounce around within the update panel and then hit back to alter the state within the current page. However, if you navigate away from that page and then hit the back button to go back to your page with the update panel, that's where I'm running into my problem.

Monday, March 26, 2012

Visibility problem with ajax control

hi,

I have a textbox and required field validator control.when the page is 1st loaded the Textbox is invisible and after clicking a button it becomes visible but

the problem is that the validator control is not working though the text box is visible now? why any idea pls?

Hi,

Can you post sample code to illustratete problem? I cannot get the same problem just by placing textbox and required validator in update panel and makeing TextBox invisible initially.

-yuriy


If you are using Validators inside UpdatePanel, then it is not compatible with it

http://weblogs.asp.net/scottgu/archive/2007/01/25/links-to-asp-net-ajax-1-0-resources-and-answers-to-some-common-questions.aspx

You can download compatible validators control from here

http://blogs.msdn.com/mattgi/archive/2007/01/23/asp-net-ajax-validators.aspx


hi,

I have used the usual asp validators.Now I have add the tag mapping required in web.config file and add reference to validation.dll.But when I run the program it shows error in my user controls which are in another folder with a custom namespace.any idea pls? the pages are not showing error but the user controls are showing error.By the By the Pages where these user controls are imported are also in a folder.

pls reply...


I have put the error messags given in my User Controls below:

pls see this and reply quickly............

Error 150 Could not load file or assembly 'Validators, Version=1.0.0.0' or one of its dependencies. The system cannot find the file specified. (D:\SSDTracker\Tracker\web.config line 92) D:\SSDTracker\Tracker\User Controls\CompetencyDatabase\CompetencySectionUI.ascx 32


Hi,

I think the error message explained the issue clear.Make sure Validators.dll is in the right folder and the version of it is right. Make sure you made the right setting in the config file.

Good luck!

Wait for response webservice

Hi everyone,

I'm kinda stuck over here. I hope someone can help me.

I have an input button on my page which has the onClick event and the onServerClick event. In the onClick event, the JavaScript code makes a call to a webservice. This webservice adds some records in a database table. After the webservice succesfully finishes, it response should be true.

The procedure goes like this:

function UpdateProduct(){...WebService.UpdateProduct(values, UpdateProduct_Callback);...}function UpdateProduct_Callback(response){return response;}

The onServerClick event refreshes the gridview I am using and selects the new record and its attributes.

The server side code executed by the onServerClick event should not be executed until the webservice is finished.

Is it possible to get the response in the UpdateProduct javascript function and return it? Like onClick="return UpdateProduct();"?

Thanks for your help!




No a callback is done after the WebService finishes on a seperate thread. Thats the whole point of a callBack, you dont have to wait for the method to finish executing. If you want to get the return value, wait for your method to finish, instead of using a callback.


Thanks for your quick reply.

Is there any other way to wait on the return value of the webservice through JavaScript without the callback? Or is it better do do it from the server side code?


You have to do it server side, JS only supports callbacks on webservice calls.


Thanks for your help. I will do it through server side code.

Want to call a javascript function from code behind

Hi.

I am trying to call a javascript function on button click, buttton is present in update panel. It is not working.

On button click event handler i m writing the following code

Response.Write("<script>functionname();</script>");

I have added script reference in script manager and given the path.

Response.Write("<script>functionname();</script>") --> this works if button is outside update panel.

Help me...

Why not try placing your javascript function name in the button's OnClientClick parameter? That way it calls it directly without requiring a post back...

OnClientClick = "functionname();"


PhunkNugget:

If you do that, which runs first, the javascript in the client or the

click event code in the code behind? may be related, so it's

important to know..I also need to invoke a modal popup

extender from code in a codebehind, not from a click event..

I'm watching this thread closely.. Geeked

Thanks in advance..


The OnClientClick runs first.


Kanwar,

You can't use Response.Write() inside an update panel. It conflicts with the ajax somehow (very annoying). You can attach the script to your button's onclick event in page load such as the following:

string myString="<script language='Javascript'>\n";

myString+="function fuctionname()\n";

myString+="{\n";

myString+="whatever your function does...\n";

myString+=

"}\n";myString+="</script>\n";

Page.RegisterClientScriptBlock(

"MYFUNCTION", myString);

btnMyButton.Attributes.Add(

"onClick","functionname();");

Then when you click on the MyButton, the javascript function will be called.

Saturday, March 24, 2012

want to disable button for the webmethod running time

Hi,

Iam using time-consuming webmethod and on the client page atlas:timecontrol for automatic refresh part of page. I want to disable button(whitch start the 5hours webmethod). The one way to disabling is using method in form tag:

onsubmit="DisableButtons()"
But this event is calling every (for example) 5 seconds of automatic refreshing of atlas:timecontrol.
Exist the way to disable button after click the start button and after ending this method button enable back? 
Thanks a lot. 

Hello,

The way to accomplish this is something like the following:

function onServiceComplete(result) {
var button = $get('myButtonElementId');
if (button) {
button.style.disabled = ''; // enable
}

// do stuff with result here...
}

function callService(stuff) {
var button = $get('myButtonElementId');
if (button) {
button.style.disabled = 'disabled'; // disable
}

var serviceParam = stuff;
MyServiceName.DoStuff(serviceParam, onServiceComplete, function(serviceErr) {
// be sure to re-enable when error occurs...
button.style.disabled = '';
var errorDiv = $get('myErrorDiv');
errorDiv.innerText = serviceErr.get_message();
});
}

I hope this helps.

Watermark + Textbox Issue

I have a web form with a text box with an associated watermarktextbox extender and a button. The goal is to have the user input a name into the the textbox and then use that value when the button is clicked as parameter to a new web page. This works if i remove the watermarktextbox extender. Any assistance would be appreciated.


Do you want a watermark? What exactly do you want to do? Are you receiving errors?


Sorry for the vague original post. Yes, the goal is to have a watermarked textbox. The user enters data into the textbox and I want to use that data as a parameter to a redirection to a new webpage. The problem is that when I use the watermarked textbox the textbox text is not captured (i.e., my parameter is empty). If I use a standard textbox, I'm able to retrieve the textbox text and use it as I intend. I receive no errors I just get an empty value. I'm guessing I need to change the way I get the value of the textbox (client-side script?) but I have no idea how to do this.

Thanks.


OK. Post the script that your using.


Hi,

It's hard to tell without knowing how do you pass value? Are you using queryString? Or PostBackURL?

Please be more specific, a simple repro is preferred.

Watermark Extender Validation error

I have a textbox with an ajax watermark extender attached to it. As well as a required feild validator. One button on my page is "CauseValidation = true". Before i applyed the watermark extender the validation check worked perfectly, but now the validation check doesnt work as i think it see`s the watermarktext as text in the textbox, is there any way around this? si!

Hi blink18jew,

Would you mind posting your simple source code here?


sure its like this :

<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TestBox" ErrorMessage="ERROR"></asp:RequiredFieldValidator>
<asp:TextBox ID="TestBox" runat="server"></asp:TextBox>
<ajaxToolkit:TextBoxWatermarkExtender ID="TextBoxWatermarkExtender1" TargetControlID="TestBox" WatermarkText="Watermarked..." WatermarkCssClass="water" runat="server">
</ajaxToolkit:TextBoxWatermarkExtender>

the watermark seems to ruin the validation checks...si!


Hi blink18jew,

I'm afraid that I cannot reproduce your problem.Here is my test sampe based on yours. It works fine locally.

Aspx:

<%@. Page Language="VB" %><!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>Water Mark</title></head><body> <form id="form1" runat="server"> <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TestBox" ErrorMessage="ERROR"></asp:RequiredFieldValidator> <asp:TextBox ID="TestBox" runat="server" CausesValidation="true"></asp:TextBox> <ajaxToolkit:TextBoxWatermarkExtender ID="TextBoxWatermarkExtender1" TargetControlID="TestBox" WatermarkText="Watermarked..." WatermarkCssClass="water" runat="server"> </ajaxToolkit:TextBoxWatermarkExtender> <asp:Button ID="Button1" runat="server" Text="Button" /> </form></body></html>

So would you give us more details including source code or error information? If you can help us reproducing your problem step by step, it will be greatly appreciated.

By the way, did you use your Validator in a UpdatePanel? If yes, maybe you can benefit from this thread: http://forums.asp.net/t/1066821.aspx

Hope it helps.


no worries it was only to get it looking a bit more professional im just not guna use it, but thanks for your time! si!


Hi blink18jew,

Would you do a test with my sample code to find out the exact root cause for this problem ? If we can find the solution, our community members will benefit from our work then.Thanks, Surprise


Tongue Tied it worked... lol, i duno what was going on cos i tryed my olde code and that still didnt work... haha, oh well, ill mark it as answer! thanks.

Wednesday, March 21, 2012

Web App Projects and ScriptManager/UpdatePanel

I am VERY new to this so please excuse me for this obvious question. I have started a basic web app project in VS2005. Just a button, label and textbox. Wors fine. If I drop a scriptmanager and update panel on the page and move the three controls to the update panel I get a scripting error that 'Sys' is not defined. The error is in the page source script shown below:

Sys.WebForms.PageRequestManager._initialize('ScriptManager1', document.getElementById('form1'));
Sys.WebForms.PageRequestManager.getInstance()._updateControls(['tUpdatePanel1'], [], [], 90);

Is there a way to prevent this or edit the script that the script manager produces so as to not throw the error?

Thanks

Hi ixis,

You will have to use the "ASP.NET-Enabled Web Site" template instead of the "Empty Web Site" when creating a new Ajax application so that http handlers and modules are registered in your web.config. Here's an example of an Ajax-Enabled Web Site's web.config:


<configuration> <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> <system.web> <pages> <controls> <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> </controls> <tagMapping> <add tagType="System.Web.UI.WebControls.CompareValidator" mappedTagType="System.Web.UI.Compatibility.CompareValidator, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> <add tagType="System.Web.UI.WebControls.CustomValidator" mappedTagType="System.Web.UI.Compatibility.CustomValidator, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> <add tagType="System.Web.UI.WebControls.RangeValidator" mappedTagType="System.Web.UI.Compatibility.RangeValidator, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> <add tagType="System.Web.UI.WebControls.RegularExpressionValidator" mappedTagType="System.Web.UI.Compatibility.RegularExpressionValidator, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> <add tagType="System.Web.UI.WebControls.RequiredFieldValidator" mappedTagType="System.Web.UI.Compatibility.RequiredFieldValidator, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> <add tagType="System.Web.UI.WebControls.ValidationSummary" mappedTagType="System.Web.UI.Compatibility.ValidationSummary, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> </tagMapping> </pages><!-- Set compilation debug="true" to insert debugging symbols into the compiled page. Because this affects performance, set this value to true only during development. --> <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="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> </system.web> <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-ISAPI-2.0"/> <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="ScriptResource" verb="GET" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /> </handlers> </system.webServer></configuration>

Thanks, I'll give that a try. Just to note because I wasn't very clear in my original post, if I create a normal ASP.NET Website project, the UpdatePanel works just fine. If I create a Web Application Project using the Visual Studio 2005 Web Application Project Model I have the problem. I'm not saying your solution isn't what I am looking for just clearing up the original question. I am certainly going to review my web.config as per your post.

Web Parts menu/dragging disabled after partial update

I have a:

UpdatePanel. Inside it is a WebPartZone. Inside it is a web part.

It really simple. Button click and change the textbox to something. My problem is that as soon as I execute this the web part "verb" menu goes away and you can't drag and drop the web part after the first time it does the partial update. When you first load the page menu/dragging and dropping works fine.

Is this is a bug?

I have the same problem with asp.net ajax RC!!!!

It seems there is a big bug!!!!

It seems there is no tester in the asp.net ajax development team!!!Confused


To get around that problem can you on the postback set the webpartzone to enable again?

Web Service - Invoking on remote server and scheduling

Hello,

I created a web service on my local computer. This web service has one Web Method, which I can [INVOKE] the method by pressing a button on my local computer ie->http://localhost:2234/mywebservice.asmx. However, when I upload this webservice to my remote account at easycgi, the [INVOKE] is missing.

My question is why is the [INVOKE] button missing?
Do I need to create a proxy using WSDL in order to run my web method?
Also, does anyone know how to schedule a web service to run at specified times, if you do not have access to the host server?

Thanks,

-Robert

Hello,

I am going to answer my own question here. I was able to set up a proxy by creating a web reference to my webservice in vs2005. Using the proxy I called my web service method. I am still not sure why the [INVOKE] button was missing on my .asmx file when I uploaded, but no matter.

My web host provider, easycgi, provides a script scheduler. The script can be an .aspx that runs code on the page load event. By calling my web service method on page load event I am able to call my web service at specified times.

-Robert


Gratz on sorting it out Robert

A security feature of WebServices is that the invoke option will only appear on local webservices. There is a security setting you can add to the web.config to allow this remotely but i can't remember what is was. It was a VS2003 feature as i recall and it's likely been removed since .net 2.0

I could probably dig it out though if you need, let me know. It can be handy to check a remote service via the browser

Web service class undefined on Client load

Having tested a simple atlas web method call from the client which is fired by calling a javascript function on a button client side click event -it works perfectly.

The problem is I need this function called when the page loads, however whenever calling this function from either the body onload client side event or by using the RegisterStratupScript on the server side page load method, I get a javascript error refering to the web service class name as being undefined.

In theory this should work, Am I missing something regarding my understanding of the atlas lifecycle perhaps?

Please help!
Thanks

Dynamic script references (included in the References section of the ScriptManager) are not available until after page loading. To use these, you need to hook the Load event of the Application object. Declaratively, you can do this with:

<application>

<load>

<invokeMethod method="MyMethodName" />

</load>

</application>

Alternatively, you can statically include the service with a <script> tag.


A simpler syntax to do this is to have:

<application load="OnApplicationLoad" />

This goes into your <components>. So you would have something like this:

<script type="text/xml-script">
<page xmlns:script="http://schemas.microsoft.com/xml-script/2005">
<references>
</references>
<components>
<application load="OnApplicationLoad" />
</components>
</page>
</script>

David


BTW, I should mention that there is yet an easier way: just name your method pageLoad and it will be automatically called without having to be registered. See theAtlas docs for some examples.

David