Showing posts with label form. Show all posts
Showing posts with label form. Show all posts

Wednesday, March 28, 2012

Extenders and windowed control problem

Hi,

we are using a couple of extenders such as the Calendar extender, Autocomplete extender etc...

The problem with those is when the form contains windowed controls such as the select box just below them... in that case, the usual "problem" of seeing the select through the extender div happens.

Before today, we were building our forms by keeping that in mind... making sure to avoid such positions. But now, our system should allow external people to define forms; which has quickly led to the above problem...

There is a workaround to this problem, using an empty iframe positioned right below the div; but is there any way to have extenders do the same to avoid the problem ? (as this problem is quite common, we think it is weird that it is not part of the extender functionality)

Thanks

/Tharn

ok, issue closed. They actually do it; but it does not work anymore as soon as controls are in relatively positioned elements.

I'll better report that to the codeplex project.

/t

Wednesday, March 21, 2012

Event Triggered from UpdatePanel1 fires validator in UpdatePanel2

I have a form with requiredfieldvalidators inside separate updatepanels, whose UpdateMode's are set to conditional. I've set timestamps in each panel to ensure that the updatemode was functioning correctly, which it is. However, it seems that a postback triggered in the first update panel still fires my validator in my 2nd update panel. I've attached code below. Your insight is much appreciated!

<%@dotnet.itags.org. Page Language="C#" AutoEventWireup="true" CodeFile="test.aspx.cs" Inherits="test" %><!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>Update Panel Test</title></head><body> <form id="form1" runat="server"> <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <div> <asp:UpdatePanel ID="UpdatePanel1" UpdateMode="Conditional" runat="server"> <ContentTemplate> This is Panel 1. <div> TextBox1:<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TextBox1" ErrorMessage="TextBox1 isn't filled in."></asp:RequiredFieldValidator> <asp:Button ID="Button1" runat="server" Text="Button1" /><%=DateTime.Now%> </div> </ContentTemplate> </asp:UpdatePanel> <asp:UpdatePanel ID="UpdatePanel2" UpdateMode="Conditional" runat="server"> <ContentTemplate> This is Panel 2. <div>Textbox2: <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox> <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="TextBox2" ErrorMessage="TextBox2 isn't filled in."></asp:RequiredFieldValidator> <asp:Button ID="Button2" runat="server" Text="Button2" /><%=DateTime.Now%> </div> </ContentTemplate> </asp:UpdatePanel> </div> </form></body></html>

You just need to assign the two sets of controls to different validation groups.

<asp:RequiredFieldValidator ID="RequiredFieldValidator1" ... ValidationGroup="Grp1" />
<asp:Button ID="Button1" ... ValidationGroup="Grp1" />

<asp:RequiredFieldValidator ID="RequiredFieldValidator2" ... ValidationGroup="Grp2" />
<asp:Button ID="Button2" ... ValidationGroup="Grp2" />

Also, you don't need UpdatePanels to make this work.


Assign each button a different validator that will solve the issue

<%@. Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>Update Panel Test</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" ScriptMode="Auto">
</asp:ScriptManager>
<div>
<asp:UpdatePanel ID="UpdatePanel1" UpdateMode="Conditional" runat="server">
<ContentTemplate>
This is Panel 1.
<div>
TextBox1:<asp:TextBox ValidationGroup="panel1" ID="TextBox1" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ValidationGroup="panel1" ID="RequiredFieldValidator1" runat="server" ControlToValidate="TextBox1"
ErrorMessage="TextBox1 isn't filled in."></asp:RequiredFieldValidator>
<% =DateTime.Now %>
<asp:Button ID="Button1" ValidationGroup="panel1" runat="server" Text="Button1" />
</div>
</ContentTemplate>
</asp:UpdatePanel>

<asp:UpdatePanel ID="UpdatePanel2" UpdateMode="Conditional" runat="server">
<ContentTemplate>
This is Panel 2.
<div>
Textbox2:
<asp:TextBox ID="TextBox2" ValidationGroup="panel2" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ValidationGroup="panel2" ID="RequiredFieldValidator2" runat="server" ControlToValidate="TextBox2"
ErrorMessage="TextBox2 isn't filled in."></asp:RequiredFieldValidator>
<% =DateTime.Now %>
<asp:Button ID="Button2" ValidationGroup="panel2" runat="server" Text="Button2" />
</div>
</ContentTemplate>
</asp:UpdatePanel
</div>
</form>
</body>
</html

errors with the control toolkit

I just downloaded the ajax extensions, and toolkit, but everytime I add an item from the toolkit to my web form I get an error in the designer file.

It generates code in the designer.vb file like

but I get an error that says:

ProtectedWithEvents RoundedCornersExtender1As AjaxControlToolkit.RoundedCornersExtender

Type 'AjaxControlToolkit.RoundedCornersExtender' is not defined.

I also get an error from my web.config file that says:

Could not load type 'System.Web.UI.Compatibility.CompareValidator' from assembly 'System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'

pointing to the line:

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

does anyone have any idea what I'm doing wrong, or how I can fix this?

thanks,

smtraber

This post may help youhttp://weblogs.asp.net/scottgu/archive/2007/01/25/links-to-asp-net-ajax-1-0-resources-and-answers-to-some-common-questions.aspx (look down a little bit for the stuff on validators)

Error: There is no source code available for the current location

Hi all,

I'musing iFrame on parent form (not master page) where I'm opening my other forms (child forms). I'hvused ScriptManager and UpdatePanels on both the forms i.e. on parent and on child. When I clicked on the child form(inside iFrame) an error occurred - 'There is no source code availablefor the current location.' and nothing went further. If I removeScriptManager from child form it won't give anyerror, of course I can't use UpdatePanel and AJAX's any control on the child form.

The error is not consistent i.e. if I design another parent and child forms with the same structure error may not occur and if I continue with it then after few pastbacks error will occur. I tried to debug it where I went to one function in Resource.axd:

---

Sys.UI.Point = function Sys$UI$Point(x, y) {

/// <paramname="x" type="Number"integer="true"></param>

/// <paramname="y" type="Number"integer="true"></param>

/// <fieldname="x" type="Number"integer="true"></field>

/// <fieldname="y" type="Number"integer="true"></field>

var e =Function._validateParams(arguments, [

{name:"x", type: Number, integer: true},

{name:"y", type: Number, integer: true}

]);

if(e)throw e;

this.x = x;

this.y = y;

-----

where e.message = "Sys.ArgumentOutOfRangeException: Value must be an integer. Parameter name: x Actual value was NaN."

If anybody had faced the same prob and has the solution please reply.

Thanx.

i also have the exact same problem but only with in a frame,

but my page is inside a normal frame, when my page is opened directly without the frame it works fine.

this error must be new to 1.0 cause i just upgraded and am now getting it.

does anybody have a solution? its important am waiting to upgrade live system to ajax 1.0 but this the only new error that i cant find a solution to.

Thanks


But when no set the frame's border to 'no' ,it works fine!

//frameBorder = "none";


I have tried evrything but the problem is still there therefore I'm not using iFrame now. I'm using frameset where I'm not getting this error but if there is anything wrong in my java script functions like syntax error then only it gives the same error 'There is no source code available for the current location'. But after rectifying function it works fine. So there is no headache of the error for me.

I get the same error only in Internet Explorer and only when using an iframe. This is a bug in the Asp.net Ajax client script !!!

You can see the bughere