Showing posts with label text. Show all posts
Showing posts with label text. Show all posts

Wednesday, March 28, 2012

Accessing Masterpage Ajax control from Web user control

Hi all,

I have created a master page in asp2.0 and i have placed ModalPopupExtender in that. I have written a custom Textbox control. In that text Changeded event i have created reference to the Masterpage modalpopupextender using Findcontrrol method. But i cant able to loop through tge Master page controls Properly. I am unable to findthe controls with its client id. Can anybody know how to solv this.

My aim is to call the modalpopupextender show event from the custom control.

<cc1:ModalPopupExtenderID="ModalPopupExtender1"runat="server"TargetControlID="btnForLookup"PopupControlID="LookupPanel"BackgroundCssClass="modalBackground">

Private

Sub AHNLookup_Click(ByVal senderAsObject,ByVal eAs System.EventArgs)HandlesMe.Click

{ Dim contr as ModalpopupExtender

Contr = Me.page.master.FindControls("ModalPopupExtender1")

Constr.show() -->Gives error as Null object.

}

====

Thanks in advance.

S.Sathishraja

Hi,

Please try to find it in a recursive way.

public?Control FindControlRecursive(Control root, string id)
{
????if (root.ID == id)
????{
????????return root;
????}

????foreach (Control c in root.Controls)
????{
????????Control t = FindControlRecursive(c, id);
????????if (t != null)
????????{
????????????return t;
????????}
????}

????return null;
}
Hope this helps.

Saturday, March 24, 2012

aborting postback

hi guys,

Just wondering how do i or is it even possible to abort a postback when using atlas. The reason why i am asking is that i have some text fields that require validation before a async postback is performed. If the validation fails then i would like to cancel or abort the async postback and alert the user.

any syntax or code snippets would be great

thanks

hello.

maybe something like this: $object("_PageRequestManager").abortPostBack();

A Simple Atlas Work,but Still have Unknown Error BUG

Simply, i Place a Textbox and a button,when i click the button, it response.write(textbox1.text)
but, when i click the button, it show a java script pop-up and show me Unknown error..

below is the code:

1Default.aspx2<%@dotnet.itags.org. Page Language="VB" AutoEventWireup="true" ValidateRequest="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>34<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">5<html xmlns="http://www.w3.org/1999/xhtml">6<head runat="server">7 <title>ASPNET_Atlas_Testing</title>8</head>9<body>10<form id="form1" runat="server">11<div>12 <atlas:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="True"/>13<!-- This section of the page is wrapped by an UpdatePanel. -->14 <atlas:updatepanel id="up" runat="server" mode="Conditional" rendermode="Inline">15 <triggers>16 <atlas:controleventtrigger controlid="TextBox1" eventname="TextChanged" />17 </triggers>18 <contenttemplate>19 <asp:TextBox ID="TextBox1" runat="server" OnTextChanged="TextBox1_TextChanged"></asp:TextBox><br/>20 </contenttemplate>21 </atlas:updatepanel>2223<!-- This section is also wrapped by an UpdatePanel. -->24 <atlas:updatepanel runat="server" id="up1" mode="Conditional" rendermode="Inline">25 <triggers>26 <atlas:controleventtrigger controlid="Button1" eventname="Click" />27 </triggers>28 <contenttemplate>29 <asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click"/>30 </contenttemplate>31 </atlas:updatepanel>32</div>33</form>34</body>35</html>3637
1Default.vb23PartialClass _Default4Inherits System.Web.UI.Page56Protected Sub Button1_Click(ByVal senderAs Object,ByVal eAs System.EventArgs)Handles Button1.Click7 Response.Write(TextBox1.Text)8End Sub910 Protected Sub TextBox1_TextChanged(ByVal senderAs Object,ByVal eAs System.EventArgs)11 Response.Write(TextBox1.Text)12End Sub13End Class1415
Check to make sure your web.config file is setup right and that your dll is in place (/bin) and not corrupt, as I'm not getting a javascript error when I try your code. It also doesn't work as you wrote it, though, and so I tried adding a label to one of the update panels and having the button change its value based on the text prop of the textbox1, and that worked fine. So I suspect that with update panels (this is just a guess) that you can't use Response.Write; whcih would make sense if you conceive of the Response object as passing a whole page rather than just the partial page the update panel is looking for.

Hi,

Remove all response.write statements & replace them with this.page.registerclientscriptblock(script);

Amit Lohogaonkar

mcp,mcad

lohogaonkaramit@.yahoo.com

Wednesday, March 21, 2012

a first-day atlas user got this error, HELP!

when i following the basic atlas application from the following link, btw, I didn't use visual studio, I just manually do it from text editor and command line compiler.

http://atlas.asp.net/docs/Walkthroughs/GetStarted/Basic.aspx

I got a "syntax error" when I launched the page. then when i input text and pressed button, I got "sample undefined" error and nothing happen.

This is the log :

2006-06-29 20:21:18 192.168.1.1 - 192.168.1.36 80 GET /AtlasScript.aspx - 200 Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.0;+.NET+CLR+1.1.4322;+.NET+CLR+2.0.50727) -
2006-06-29 20:21:19 192.168.1.1 - 192.168.1.36 80 GET /WebResource.axd d=-qnjsxFIQPRe60N1ywfq1ZGbOVMGC5TKMX4JTqrXTR7atJCaMTR4Fc76IpI0uvmBTmmGba1jsr6v9f3MrKscIivr3HdGL-IH8Yqrm9oH01I1&t=632799165960000000 200 Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.0;+.NET+CLR+1.1.4322;+.NET+CLR+2.0.50727)http://www.mydomain.com/AtlasScript.aspx
2006-06-29 20:21:19 192.168.1.1 - 192.168.1.36 80 GET /HelloWorldService.asmx - 302 Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.0;+.NET+CLR+1.1.4322;+.NET+CLR+2.0.50727)http://www.mydomain.com/AtlasScript.aspx
2006-06-29 20:21:19 192.168.1.1 - 192.168.1.36 80 GET /ErrorPage.aspx aspxerrorpath=/HelloWorldService.asmx/js 200 Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.0;+.NET+CLR+1.1.4322;+.NET+CLR+2.0.50727)http://www.mydomain.com/AtlasScript.aspx

hello.

can you be more specific about the error? is it a script error?


yes, it's a script error from browser(IE)

hello again.

well, where are you getting it? what does the error message say? where does it stop in the debugger? what's your code? without knowing this we won't be able to help you.


PROBLEM solved, I followed the installation instruction to modify web.config, it failed, buy when I copied the web.config from atlas folder, it works now!

Thank you very much!

a "must select" AutoCompletion control?

Hi,
I want to implement the autocompletion feature to replace my dropdownlist.
(because the list could be long)
I have an ID and a Text in my dropdownlist:
Select OrganizationID, OrganizationName from Organizations
Today the autocompletion allow the user to type anything and also non existing item but provide the exact behavior wanted.
any sample?
thanks.
Jerome.
You need a custom validator on this field I think, look athttp://atlas.asp.net/quickstart/util/srcview.aspx?path=~/atlas/samples/controls/control4.src