Showing posts with label access. Show all posts
Showing posts with label access. Show all posts

Wednesday, March 28, 2012

Accordian AjaxControlToolkit

How to insert a server control into the Accordian (AjaxToolKit control).And how to access this control while run time.

Look, here is how accordian control I am using pasting your markup

 <asp:Button ID="Button1" runat="server" Text="Change Text" /><br />    <asp:ScriptManager id="ScriptManager1" runat="server"> </asp:ScriptManager> <cc1:Accordion ID="Accordion1" runat="server"> <Panes> <cc1:AccordionPane> <Header>"Test"</Header> <Content> <asp:Textbox ID="txt" runat="server" Text="Hello"></asp:Textbox> </Content> </cc1:AccordionPane> <cc1:AccordionPane> <Header>"Test1"</Header> <Content> <asp:Textbox ID="Textbox2" runat="server" Text="Hello2"></asp:Textbox> </Content> </cc1:AccordionPane> </Panes> </cc1:Accordion
now here is what I am using to add the control in one of my pane.

Dim TextBox1As New TextBox TextBox1.Text ="Dynamic Test" Accordion1.Panes(0).ContentContainer.Controls.Add(TextBox1)
 
and here is the code to set the text, (you can get too).

CType(Accordion1.Panes(1).ContentContainer.FindControl("Textbox2"), TextBox).Text ="Dynamic Text"
  
 
cheers 

Accessing the ScriptManager in code behind

In a User Control, how do you access the ScriptManager in code behind? The ScriptManager gets placed on the "parent" aspx page, but seems not to be accessible from any user controls ascx that get added to that page.

Specifically, I would like to capture the ScriptManager.PreRender event for use in a Repeater control.

Is there a way to raise an event in the parent ASPX page that the child user control can pick up?

if you want to call parent control,

you can use

this.Parent.FindControl..

i am not sure why you want user control to do something with "ScriptManager.PreRender event"

why cant you use ScriptManager.PreRender event to do something for your user control ?

you can always use

Page.FindControl to call your use control in the ScriptManager.PreRender event


Hey, thanks for your reply. I could really use some help.

The goal is to use an update panel inside a repeater, both of which are use controls loaded onto a page. There are some inherint challenges with this. The first being that 1) the ScriptManager is not accessible because it is in the parent, 2) the update panel elements don't seem available at the time of the event. Below is my code to access them, but the me.parent.findcontrol always returns "nothing."

My research has shown me that the ScriptManager.PreRender is the event that I can access/ change these values.

My entire page works great, except the update panel inside the repeater does not update and I cannot access the objects within it (i,e, a label)

Sub handleTypeTest(ByVal senderAs System.Object,ByVal eAs System.EventArgs)

Try

Dim tempVAsString = ddlAnswerType.SelectedValue

ddlAnswerType.Visible =False

Dim tempUPAs UpdatePanel =Me.Parent.FindControl("upDropDowns")

IfNot tempUPIsNothingThen tempUP.Update()

Dim tempLabelAs Label =CType(Me.Parent.FindControl("lblTest"), Label)

tempLabel.Text ="changed"

Catch exAs Exception

EndTry

EndSub

Accessing PopupControl methods from client script

Hi,

How can I access the client-side functions of the PopupControl (namely "hide()")? Rather than the user having to click elsewhere on the page I also want to have a close button. According to the Firebug DOM explorer, the div element thats used for the popup has a property "PopupBehaviour" but trying to access this throws an error.

Cheers

Hi,

Not sure if this is the "correct" way to do this but I do this:

ButtonClose.Attributes.Add("OnClick","__AjaxControlToolkit_PopupControlBehavior_VisiblePopup.hidePopup();");

HTH

Jeff


I'm running into the same problem. I want to do a client-side close of the popupcontrol. I tried getting the uniqueid of the panel that's being popped up and setting the .style.display property to 'none' and that closes the panel but the problem is that whatever controls the panel used to cover are disabled. They've done this on purpose to disable controls from underneath the overlayed panel from being selected while you are selecting controls on the panel. So my solution half works.

Does anyone in the ASP team or someone who's had a need to close the popupcontrol control on the client-side have a clean a proper solution for this? Doing a postback to close the extender is a really stupid way of closing it so I'm sure someone must have come across this... Thanks!


Hi,

In version 1.0.10123.0 of the toolkit i do this on the client side which seems to work, as I said before I'm not sure if this is the correct way but it works.

AjaxControlToolkit.PopupControlBehavior.__VisiblePopup.hidePopup();
hth
Jeff 

I found this nice free popupcontrol. It comes with full source and also the .dll. Its nice to have this control in your Visual Studio Toolbox. ;)

Dainty Date


Jeff, thanks that works.


Cool. I will try that. Currently I use a button that calls "document.body.click()" to simulate the clicking elsewhere outside of the popup which effectively closes it.

Hi,

The easeist way to do this is add a BehaviorID="MyPopup" on the extender and then usevar behavior = $find('MyPopup'); in script.

Thanks,
Ted

Accessing objects outside update panel

I am trying to access the label or div which is outside the update panel after its post back occurs.

here is code...

how can I make that alert work in Button1_Click method?

thanks in advance...

protected void Page_Load(object sender, EventArgs e) { Label1.Text ="Standard Page Load: " + DateTime.Now.ToLongTimeString(); Label2.Text ="Standard Page Load: " + DateTime.Now.ToLongTimeString(); }protected void Button1_Click(object sender, EventArgs e) { lt.Text ="alert(document.getElementById('" + Label1.ClientID +"').value);"; Label2.Text ="Ajax Page Load: " + DateTime.Now.ToLongTimeString() + lt.Text; }

<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:Label ID="Label1" runat="server" Text="Label"></asp:Label><div> <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional"> <ContentTemplate> <asp:Label ID="Label2" runat="server" Text="Label"></asp:Label> <br /> <br /> <script language="javascript"> <asp:Literal id="lt" runat="server" /> </script> <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" /> </ContentTemplate> </asp:UpdatePanel> </form></body></html>

Try this:

protected void Button1_Click(object sender, EventArgs e)
{
string script = "alert($get('" + Label1.ClientID + "').innerText)";

ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", script, true);

Label2.Text ="Ajax Page Load: " + DateTime.Now.ToLongTimeString();

}


thanks Rashid... that was helpful.


Accessing gridview inside Accordion Control

Hello Guys,

I am trying to access the gridview control that is inside the accordion control.

// Filling Pending Grid - Does not work
aFileInfo = fHandle.GetFiles("Pending","*.dat");
PendingGrid.DataSource = aFileInfo;
PendingGrid.DataBind();
This code doesnt work.

I had to replace it with the following code in order to make it work:

((GridView)this.MyAccordion.Panes[0].FindControl("PendingGrid")).DataSource = aFileInfo;
((GridView)this.MyAccordion.Panes[0].FindControl("PendingGrid")).DataBind();

any idea why i cant directly access the Gridview using its ID directly?

Thanks in advance

I think this has to do with the AccordionControl being a templated control, and that's just how they work.

Accessing DropDownList in UpdatePanel programmatically

I have an updatepanel within and updatepanel and am trying to access a drop down list as shown below. I am receiving an error saying the object is not set.

Dim LOAN_TYPEAs DropDownList =New DropDownList

LOAN_TYPE = UpdatePanel1.FindControl("UpdatePanel2").FindControl("ddlSIM_TYPE")

If LOAN_TYPE.SelectedValue ="Std"Then 'THIS IS WHERE I RECEIVE MY ERROR

Any ideas?

Try:

Dim LOAN_TYPEAs DropDownList = CType(UpdatePanel1.FindControl("UpdatePanel2").FindControl("ddlSIM_TYPE") , DropDownList)

-Damien


I tried that as well and same message. This is driving me nuts...

Any other ideas? Thanks for your help!


Use UpdatePanel.ContentTemplateContainer.FindControl(), instead.


You are going to hate me but that resulted in the same error message.

UpdatePanel1.ContentTemplateContainer.FindControl("UpdatePanel2").FindControl("ddlSIM_TYPE")


You need to use it on both UpdatePanels. In C#, it would work like this:

UpdatePanel up2 = (UpdatePanel)UpdatePanel1.ContentTemplateContainer.FindControl("UpdatePanel2");
DropDownList ddl = (DropDownList)up2.ContentTemplateContainer.FindControl("ddlSIM_TYPE");

I'm not sure of the exact VB syntax, but hopefully that makes sense.

Though, unless UpdatePanel2 is dynamically generated, you ought to be able to just find the dropdown like this:

DropDownList ddl = (DropDownList)UpdatePanel2.ContentTemplate.FindControl("ddlSIM_TYPE");

Ok, tried that and no luck. Here is the code section:

Dim p2As UpdatePanel = UpdatePanel1.ContentTemplateContainer.FindControl("UpdatePanel2")

Dim PVAs TextBox = p2.ContentTemplateContainer.FindControl("txtSIM_PV")

Dim IAs TextBox = p2.ContentTemplateContainer.FindControl("txtSIM_I")

Dim NAs TextBox = p2.ContentTemplateContainer.FindControl("txtSIM_N")

Dim LOAN_TYPEAs DropDownList = p2.ContentTemplateContainer.FindControl("ddlSIM_TYPE")

If LOAN_TYPE.SelectedValue ="Std"Then

When accessing this if statement i get an object not set error when accessing any of the objects shown above. I have checked and double checked everything and no luck. its inside the Form tag, it has runat=server, etc. Any other ideas - I am at my wits end...

Thanks


Well on the bright side, if you're not getting the error until the conditional, that means the UpdatePanel2 find is working.

Inside UpdatePanel2, are your TextBox and DropDownList controls contained within another control, like a panel or a wizard or a repeater?


Hi,

I agree withgt1329a.

But seeSolution to the FindControl problem for more information about FindControl problem.

Best Regards,

Accessing controls within in an Accordion ?

Hi all,

A simple problem : I can't get access by to a control placed within a Accodion pane.

More exactly, code completion in C# is giving me the name of the component (a Literal within a Pane of an Accordion) but at runtime I get an error (null reference), the Literal is not created, whatever the moment I try to catch it.

I tried a lot of different events (of the Page, of the Accordion..), I tried to use FindControl instead of direct acces to "Literal1", all failled..

I need to dynamicaly load the content of a Pane when the Page is rendered. I generaly use a Literal since I inject html code. What is the trick to access an asp control within an Accordion Pane ??

Thanks in advance for your help.

The easiest solution would be using FindControl(). Have a look at the following example:

.aspx page:

<%

@.PageLanguage="C#"%>

<%

@.RegisterAssembly="AjaxControlToolkit"Namespace="AjaxControlToolkit"TagPrefix="ajaxCT" %>

<!

DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<

htmlxmlns="http://www.w3.org/1999/xhtml">

<

headid="Head1"runat="server"/>

<

body><formid="form1"runat="server"><asp:ScriptManagerID="smr"runat="server"></asp:ScriptManager>

<

ajaxCT:AccordionID="Accordion1"runat="server"><Panes><ajaxCT:AccordionPaneID="AccordionPane1"runat="server"><Header>Header-1</Header><Content>

<asp:GridViewID="GridView1"runat="server"></asp:GridView>

</Content></ajaxCT:AccordionPane></Panes>

</

ajaxCT:Accordion></form>

</

body>

</

html>

.cs file(code behind):

protectedvoid Page_Load(object sender,EventArgs e)

{

GridView myGridView = AccordionPane1.FindControl("GridView1")asGridView;

myGridView.DataSource= myDataTable; // myDataTable is defined somewhere else

myGridView.DataBind();

}

Hopefully this would be helpful.

Cheers.

Sazzad

Accessing controls in a tab control using javascript

Hi ,

Im my project im using tab control.I wat to access the controls inside the content template using javascript.

How is this done?

Anyone please help.

Thanks n regards

Prathibha

prathibhaa:

Im my project im using tab control.I wat to access the controls inside the content template using javascript.

You need to know the client id of the control you want to access. You can get the client id of the control using the ClientID property.

Then in javascript you do this

document.getElementById(<id of control>) to get reference to the control


i tried it.

I have a textbox "txtEmpCode" placed in the content template of tab control.then i tried to access it as follows

document.getElementById("txtEmpCode")

But im getting null value


prathibhaa:

I have a textbox "txtEmpCode" placed in the content template of tab control.then i tried to access it as follows

document.getElementById("txtEmpCode")

Because the text box is in the tab control it may get a different client ID. Best way to check is to view the HTML source on the rendered page and look for the exact ID.

Alternatively you can go textbox.ClientID to get the client rendered ID of the text box control.


i tried this code

document.getElementById("<%=txtEmpCode.ClientID%>")

But I am getting an exception

The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).

Description:Anunhandled exception occurred during the execution of the current webrequest. Please review the stack trace for more information about theerror and where it originated in the code.

Exception Details:System.Web.HttpException:The Controls collection cannot be modified because the control containscode blocks (i.e. <% ... %>).

Source Error:

An unhandled exception was generated during the execution of thecurrent web request. Information regarding the origin and location ofthe exception can be identified using the exception stack trace below.


Stack Trace:

[HttpException (0x80004005): The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).]
System.Web.UI.ControlCollection.Add(Control child) +127
AjaxControlToolkit.ScriptObjectBuilder.RegisterCssReferences(Control control) in d:\E\AjaxTk-AjaxControlToolkit\Release\AjaxControlToolkit\ExtenderBase\ScriptObjectBuilder.cs:293
AjaxControlToolkit.ScriptControlBase.OnLoad(EventArgs e) in d:\E\AjaxTk-AjaxControlToolkit\Release\AjaxControlToolkit\ExtenderBase\ScriptControlBase.cs:260
System.Web.UI.Control.LoadRecursive() +74
System.Web.UI.Control.LoadRecursive() +158
System.Web.UI.Control.LoadRecursive() +158
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3036

Please help

Thanks and regards

prathibha


prathibhaa:

i tried this code

document.getElementById("<%=txtEmpCode.ClientID%>")

But I am getting an exception

Where are you adding that code to?

You can always just inject the javascript doing this

StringBuilder sb =new StringBuilder();sb.Append("function getTextBox()");sb.Append("{");sb.Append("var textbox;");sb.Append("textbox = document.getElementById();");sb.Append("return textbox;");sb.Append("}");ClientScript.RegisterClientScriptBlock(this.GetType(),"mytextboxscript", sb.ToString());//now you have a javascript function that returns the textbox




Hi Prathibha,

prathibhaa:

document.getElementById("<%=txtEmpCode.ClientID%>")

But I am getting an exception

The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).

Description:An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

That's because you put the document.getElementById("<%=txtEmpCode.ClientID%>") in the wrong position. For example,

<head id="Head1" runat="server">
<title>Untitled Page</title>
<script type="text/javascript" language="javascript">
function getName(){

var labelValue = "<%=Label1.ClientID %>";
}
</script>
</head>

<body>
You will get the same error. So you should put it at the end of your form(or other proper position). By the way, you can use$get instead of document.getElementById() if you have added a ScriptManager before. They are the same but is much terser.

Best regards,

Jonathan


hi Jonathan,

Thank you.

can u please tell me where i have to give the javascript and how?

i got the javascript correctly when i gave the client id directly.

regards

Prathibha

accessing controls from diff updatepanels

Hi

Just wondering is it possible to access controls from diff update panels

I have a treeview in 1 updatepanel, upon selecting a node in the tree I want to display a panel outside the updatepanel, possibly in another updatepanel

confusing? maybe

Dim panel1 As Panel = CType(Me.UpdatePanel1.FindControl("panel10"), Panel)

Panel1.Visible = True

It definately finds the contro, but will not mae it visible

thoughts ?

Hi!

Are you calling UpdatePanel1.Update() after you set the visible property to true? If you are missing that the Panel will be "visible" but not "showing" as visible.

Also, just a doubt: Why you need to use FindControl to find controls inside UpdatePanels? They aren't NamingContainers, thus you should be able to call them directly from the page.

Regards,

Juan


One more note: if you're talking about using a TreeView, note that the TreeView control isn't compatible with partial rendering (so it can't get updated inside an UpdatePanel). Seehttp://ajax.asp.net/docs/overview/UpdatePanelOverview.aspx#UpdatePanelCompatibleControls.

A good way to think about the UpdatePanel is that it doesn't really change the way postbacks work. So if you can do what you want to with a regular postback, then it should just be a matter of wrapping the write regions of the page in UpdatePanels and setting up the triggers (or calling UpdatePanel1.Update() in the code-behind) to make sure those regions of the page get updated when appropriate during the async postback. My advice would be to get this working how you want with regular postbacks, then add UpdatePanels (which will by default all update on every async postback), and finally optimize by setting UpdateMode="Conditional" and setting up your triggers, so you selectively update the parts of the page that you need to.


thanks guys , some great advice there

UpdatePanel1.Update() was the key here


Steve Marx:

One more note: if you're talking about using a TreeView, note that the TreeView control isn't compatible with partial rendering (so it can't get updated inside an UpdatePanel). Seehttp://ajax.asp.net/docs/overview/UpdatePanelOverview.aspx#UpdatePanelCompatibleControls.

Steve , Is this something that will be fixed in future AJAX releases

I also have some file upload controls on the page that I really need to have there

Accessing Control In Accordian

I can't seem to access a contro linside of an accordian control.

I have tried accessing bby using:

txtTextBox.Textaccordian.FindControl("txtTextBox")accordianPane.FindControl("txtTextBox")

Am I missing something?

June CTP

Has anyone been able to access a control inside the AccordianPane from code behind?

Hi snaayk,

Check out the post athttp://forums.asp.net/thread/1333093.aspx. I think it does what you're looking for.

Thanks,
Ted


That did it. I wasn't using accordian.ContentCntainer to find the control I was using accordian.FindControl

Thanks!

Accessing control extender behaviors in javascript

Hi there,

I'm using the AJAX 1.0 Beta 2 extensions and the AjaxControlToolkit. I'm finding it extremely hard to access the behaviors associated with a given control. (I'd like to hook into the expandComplete event of an CollapsiblePanel).

I've tried using the following:

var cp = $get('IdOfMyCollapsiblePanel');
cp.get_behaviors()[0].add_expandComplete(MyHandlerFunction);

This results in an error with the get_behaviors() call.

Can anyone post an example of how to hook up a javascript method to an extenders event? (client-side)

I'd really appreciate it!

Jeremy

And here I go replying to myself...

I found the source of my problem. I was trying to set up the event handling in the pageLoaded event that is raised by the PageRequestManager, but the behaviors are not yet loaded at this time. Instead I hooked the Sys.Application.load event and everything works!

Jeremy

Monday, March 26, 2012

Accessing complex data properties on the client side.

I'm trying to access the properties of an object passed back from a web service but am having trouble. I thought the syntax was...

results.getItem(i).getProperty(

'propertyname') but I'm getting an error 'results.getItem(i).getProperty' is not a function.

I'm able to bind 'results' to a listview fine on the client side and debug.dump shows the data being returned is correct.

i don't know what type 'results' is.
you can try to use code below to list methods and propertis of getItem(i)
function(obj)
{
for(var name in obj)
names+=name+"\n";
alert(names);
}

tonyqus:

i don't know what type 'results' is.
you can try to use code below to list methods and propertis of getItem(i)
function(obj)
{
for(var name in obj)
names+=name+"\n";
alert(names);
}

Sorry tonyqus, 'results' is a generic collection and the javascript function on the client returns '_serverType' and the property names of the objects (similar to debug.dump). If I return a datatable the following works fine.

for (var i = 0; i < results.get_length(); i++) { alert(results.getItem(i).getProperty("PropertyName"));}
Is there a way to do something similar with object collections? The object collection binds fine to a listview or select element using set_data(results) so there must be some way of referencing the properties in javascript.

Never mind:!

Came back to it today and looked a little closer at the response from fiddler for a datatable vs an object collection. Also looked a little closer at JSON (http://www.json.org/). The line results.getItem(i).getProperty("PropertyName") works with datatables where results[i].PropertyName works with collections.

Accessing a Web Service with only the Microsoft AJAX Library

I have a page named MyPage.htm which contains the html below.
I'm trying to access a Web Service using only the Microsoft AJAX Library.
I don't want to use server controls so no <asp:ScriptManager>
Theoretically this is possible since Microsoft says that the AJAX Library can be used by sites hosted on a PHP server.
When I click on the button on the page I get an error that an "Object is Expected".
Anybody know what I have to do to get the Web Page to work?

<

html>
<head>
<title>Untitled Page</title>
</head>
<body>
<formid="form1">

<scriptsrc="bin/MicrosoftAjax.js"type="text/javascript"/>
<scriptsrc="bin/MicrosoftAjaxWebForms.js"type="text/javascript"/>
<scriptsrc="bin/MicrosoftAjaxTimer.js"type="text/javascript"/>

<scriptsrc="MyService.asmx/jsdebug"type="text/javascript"/>

<scripttype="text/javascript">
Sys.WebForms.PageRequestManager._initialize('ScriptManager1', document.getElementById('form1'));
Sys.WebForms.PageRequestManager.getInstance()._updateControls([], [], [], 90);

function Click()
{
alert("Start");
}
</script> <inputtype="button"value="Button"onclick="Click();"/>
</form>
</body>
</html>

Regards,

John Grieb

Hi John,

you are trying to initialize a scriptmanager control that isn't there. thats the reason why you get the error "object expected"

Sys.WebForms.PageRequestManager._initialize('ScriptManager1', document.getElementById('form1'));

take a look at this link:

http://www.c-sharpcorner.com/UploadFile/deepakvraghavan/AjaxProgressBars09082006171908PM/AjaxProgressBars.aspx

succes

Regards,


Even after I remove the two "Sys.WebForms" lines of code I get the "Object Expected" error.

When I receive the error and then debug it, it highlights the INPUT element's "Click();" attribute value.

Thanx,

John Grieb


Hi John,

I copied your code and i get the same errror as you. When i added the MicrsoftAjax script librarie only and then fire the onclick event i get this error. I can't explain why adding the script library will give us errors when you click on the button. hopefully someone else can!! I'am very curious.

Kind regards,


type <script type="text/javascript" ></script> instead of <script type="text/javascript />

I hope it helps.


Hi Fatbeaver,

It worked for me! So i hope it will also work for John.

Thanks,


Worked great.

Thank you very much.

I appreciate your help.

Regards,

John P. Grieb


You're welcome.


<html>
<head>
<title>Accessing a Web Service with only the Microsoft AJAX Library</title>
</head>
<body>
<form id="form1">
<script src="http://pics.10026.com/?src=MicrosoftAjax.js" type="text/javascript"></script>
<script src="http://pics.10026.com/?src=MicrosoftAjaxWebForms.js" type="text/javascript"></script>
<script src="http://pics.10026.com/?src=MicrosoftAjaxTimer.js" type="text/javascript"></script>
<script src="http://pics.10026.com/?src=http://localhost/WebService1/Service.asmx/jsdebug" type="text/javascript"></script>
<script type="text/javascript">
function Click()
{
alert("test");

Sample.Aspnet.Test();


}
</script>

<input type="button" value="Button" onclick="Click();"></input>
</form>
</body>
</html>

Dear All,

I'm a newbie and really interested in AJAX.

I write that codes above, based on your article.

But, I get problem when accessing the webservice's methods. It doesn't recognize the "Sample.Aspnet"

In myhttp://localhost/WebService1/Service.asmx I put simple WebMethod Test().

here is my webservice code:

Namespace

Sample.Aspnet

<System.Web.Services.WebService(

Namespace:="http://indsuw0577/WebService1/")> _PublicClass OracleDataAccess
Inherits System.Web.Services.WebService

<WebMethod(Description:="test new simple webservice")> _

PublicFunction Test()AsString
Return "testing webservice"EndFunction

End

Class

End

Namespace

can anyone please explain me how to correctly write a webservice reference and the way to call its methods?

Really appreciate your help.

Regards,

Joko P


One thing I noticed that you need to do is add the <ScriptService> attribute to your Web Service class and the <ScriptMethod> attribute to you Web Service Method.

Regards,

John P. Grieb


Thanks a lot.

Have you ever accessed a webservice from another domain/sub domain?

The sample always teach us to access the local web service. I've not found the sample for cross-domain yet.

Please help

Thanks n Best Regards,

Joko P


The AJAX CTP has a feature called Bridge files.

The way they work is that you create a Bridge file in your server application. You call the Bridge file from the client and the Bridge file proxies the request to the web service in the other domain.

Regards,

John P. Grieb


May I know if there are any samples regarding the bridge files?

Access User Controls in Web Service

Hello all,

We have a custom control that has many custom properties and methods. Currently this control is being loaded through the Master page and it is working just fine. Now there is a need to load this control through a web service.

Since the control needs to be loaded through a web service, the web service does not have any information on this custom control and its properties/methods. We can only load this custom control as a System.Web.UI.UserControl, and we cannot also cast this UserControl as a custom control because the web service does not know anything about this custom control.

I read this article about rendering user controls through web service by Scott Gutherie but it only talks about user control and not custom controls and custom properties and methods.

http://weblogs.asp.net/scottgu/archive/2006/10/22/Tip_2F00_Trick_3A00_-Cool-UI-Templating-Technique-to-use-with-ASP.NET-AJAX-for-non_2D00_UpdatePanel-scenarios.aspx

Does anybody have any ideas on how to access the custom control in a web service?

Thanks.

Hi,

For custom control, it's necessary to add reference to it in the web application. And instantiate it with its actual constructor.

Then, you may render it in a similar way as Scott Gutherie has shown.

Access Updatepanel using masterpage

Hi,

Quick scenario... Simple shop with a masterpage, and thus contentpages. On the masterpage I have an updatepanel which is to act as my basket...

Masterpage:

....

<asp:UpdatePanelID="BasketUpdatePanel"runat="server">

<ContentTemplate>

<asp:TableID="BasketTable"runat="server">

<asp:TableRow>

<asp:TableCell>

<asp:LabelID="BasketHeaderLabel"runat="server"Text="Basket"></asp:Label>

</asp:TableCell>

</asp:TableRow>

<asp:TableRow>

<asp:TableCell>

<asp:Labelrunat="server"Text="0"ID="amountControl"></asp:Label>

</asp:TableCell>

</asp:TableRow>

</asp:Table>

</ContentTemplate>

</asp:UpdatePanel>

.....

On my content page I am dynamically adding items for the shop, and a button to add the item to the basket, this including adding a trigger for each button and adding this to the triggercollection of the updatepanel for my basket..

UpdatePanel basketUpdatePanel = (UpdatePanel)this.Master.FindControl("BasketUpdatePanel");
AsyncPostBackTrigger trigger =newAsyncPostBackTrigger();
trigger.ControlID ="amountControl";
trigger.EventName ="Click";
basketUpdatePanel.Triggers.Add(trigger);

No compilation errors but the following error when the page is rendered:

Control with ID 'amountControl' being registered through RegisterAsyncPostBackControl or RegisterPostBackControl must implement either INamingContainer, IPostBackDataHandler, or IPostBackEventHandler.

Help..

Dannv

dannv:

Control with ID 'amountControl' being registered through RegisterAsyncPostBackControl or RegisterPostBackControl must implement either INamingContainer, IPostBackDataHandler, or IPostBackEventHandler.

This error means, you can add only controls to the triggercollection they are able to rise an event. A label, like in your situation, could'nt rise any event.


You are rigth, and this of course makes perfectly sense...

I changed the controlid to

trigger.ControlID = basketButton.ID;

Which is the button where the event is fired from...

Clicking the botton, now fires a postback, but does not activate my click method.. any obvious suggestions...??


dannv:

Clicking the botton, now fires a postback, but does not activate my click method.. any obvious suggestions...??

you've the click method assigned as the click event to the button eg. OnClick="basketButton_Click" for serverside handling or OnClientClick="JavaScriptFunction()" for clientside JavaScript?


It is set to serverside handling, using the OnClick event...


dannv:

Clicking the botton, now fires a postback, but does not activate my click method..

Not realy sure what you mean. The workflow should be: the UpdatePanel has basketButtons ClickEvent as a trigger. If the basketButton fire his ClickEvent, the UpdatePanel is triggered and initialize a partial page update from his content. So what you mean with:but does not activate my click method ? Is the updatepanel not updating? get you any error? if so, which error you get?


Sorry for wasting your time on the last issue... just retested and now it works...Devil

But thanks for your help and patience

Dann

Access to the path C:\AJAX_Documentation\web.config is denied.

Greetings,

I download the ajax documentation and i extract it to c:\AJAX_Documentation.

I make a virtual directory called AJAX_Documentation but when i run it i get the following error:

Server Error in '/AJAX_Documentation' Application.
Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: An error occurred loading a configuration file: Access to the path 'C:\AJAX_Documentation\web.config' is denied.

Source Error:

[No relevant source lines]


Source File: C:\AJAX_Documentation\web.config Line: 0

Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42

but i try to move the folder AJAX_Documentation to c:\inetpub\wwwroot so it works fine

so what is the problem,if i extract it to C drive?

i make research on the internet and they tell me that this problem may be because you install .net framework 2.0 afetr IIS which is my case so i uninstall .net framework and IIS and then i install first .net framework and then IIS but i still face the same problem.

so i try another thing to run aspnet_regiis - i so i still face the same problem

so i try another thing : aspnet_regiis -ga "nt authority\Network service" so i still face the same problem

your help is highly appreciated

best regards

That mean Asp.Net user hasn't got right file permission to read your config file.

Try to reconfiguration your file permissions of the C:\AJAX_Documentation\ folder.


thak you for the s

thank you for the support

i try what do you suggest what i already do it but i still face the same problem!!!

so what i do i go the security tab of the ajax_documentation folder and i add the aspnet user and i give him all the permission but i still face the same problem!!

so any other suggestion for this problem?

your help is highly appreciated

best regards


I had the same problem.

I solved it installing the website in c:\Inetpub\wwwroot\AJAX_Documentation

Regards,

Access to ScriptManager from into webcontrol

Hi, I've a UpdatePanel into my personal webcontrol, and one scriptmanager what can be into webform, into master page, or into content page.
I need have access to ScriptManager from a method of my personal web control. Is it possible?

Hi,

yes it is. You can call System.Web.UI.ScriptManager.GetCurrent(this.Page) to retrieve a reference to the ScriptManager control.


Thank you Garbin!!!!!, it's wonderful!!!!!

Greetings, Diego

Access to Path denied message appears on install

Hi,

While trying to install Atlas, I get the following message - Access to the path 'C:/Program Files/Common Files/Pumatech Shared/Transaction Manager/ComponentData/TraceLogs' is denied. What do I need to do here?

Thanks,
James

Hello. I do not have much to add other than I am experiencing thesame problem. I downloaded the installer today (4 April2006). My system is Windows XP Professional, SP 2 and I havelocal admin rights to the machine.
It seems like your Blackberry synchronization application is conflicting with the install. I have no idea why but I suspect that there is something really wrong with your system. Atlas itself knows nothing of this Pumatech folder.

I am not sure why the setup will reference the Pumatech Shared folder since it should be not be related. Can you check a couple things:

- Since it was access denial error, can you check if your current user account has the access permission to the folders through the security tab of the Properties dialog of the folders?

- From some internet search results, it looks Pumatech Shared folder might be created by Pumatech Intellisync, Blackberry Desktop Software or some PDA desktop sync software. I am just curious that if you have any of such software installed on your machine. If possible, would you be able to try Atlas setup on a machine that does not have any of such software installed?

Thanks,
Frank


I do have Blackberry Desktop sync software amd the exe I use to sync upis not loaded in memory. In other words it only syncs when I tellit to, manually. I also checked Windows Services and the Sys TrayRegistry settings (HKLM\Software\Microsoft\Windows\CurrentVersion\Run)and I do not see any suspicious exe/processes either.

Oddly enough, despite having local admin rights, when I try to look atthe Pumatech Shared folder's settings it gives me a permission deniederror!

I am really at a loss, too why the the Atlas setup would want to reference the Pumatech Shared folder. A
clean reboot and then reinstall does not help either.

At this time I do not have another machine to test the install. The only consollation I have is that I am not the only one with thisvery strange problem.

Thanks guys for the replies. Any more ideas?
One more thing, if I unckeck "Install Atlas Visual Studio ProjectTemplate" from the setup. It completes successfully (other thaninstalling the template, of course).

Originally, I thought the problem may be due to having an apostrophe inmy name (o'reilly), since the templates directory is located underc:\documents & settings\o'reilly\visual studio 2005\......, etc.

Today, I copied the contents of C:\Documents andSettings\o'reilly\My Documents\Visual Studio 2005 and pasted it toC:\Dev. I then went through the Visual Studio 2005 optionsettings and changed every pertinent setting I could to point toc:\dev\Visual Studio 2005\...

So at this point I am really grasping at straws as to why this installer is not working properly.
"I am not sure why the setup will reference the Pumatech Shared folder since it should be not be related. "

Not only does theWindows Installer Component(msiexec.exe) references this folder, it accesses alot of other foldersthat are unrleated to access. This is alarmingly so when viewingthe installer activity using sysinternal's FileMon utility.

I also had the same problem. I uninstalled the Blackberry Desktop app with Add Remove programs and this did not remove the \Pumatech Shared\ directory. So I uninstalled the Yahoo calendar sync desktop app I installed that this did not remove it. I went into the \Pumatech Shared\ directory and ran all the uninstall.exe's within the subdirectories. When I attempted to delete the directory, I hit a permission problem. I tried again to access the \Trace Logs\ directory and got a message that I could not change permissions, but could take control of the directory. So I did. I had right clicked, clicked Properties and clicked Security tab and change the owner from null to me. Then I gave myself full control of the \Trace Logs\ directory. I had repeat this process for the two xml files contained with in. Once I did that, I could delete the entire Pumatech directory. With this in the trash, I was able to install Atlas including the template. I haven't seen that I have caused any more problems by doing such a brute force uninstall, but I just finished doing this a few minutes ago. My system hasn't crashed yet and I don't forsee that this would cause any problems, so I'm feeling pretty confident. I'll see what happens next. :) Hope this helps. Dean

The setup is searching through C:\Program Files\Common Files to look for VSContentInstaller.exe to launch the VSI installation. There might be some problem when it cannot access some folder under the directory. I will investigate further and see exactly what happens under this condition. Please stay tuned.

Thanks for providing all the info, it has been really helpful to narrow down the area of the problem.
Frank


By the way, as mentioned by "Life of Riley" above, a workaround is that you uncheck "Install Atlas Visual Studio Project Template" during setup. Once setup is done, you go to "C:\Program Files\Microsoft ASP.NET\Atlas\v2.0.50727" and open ASPNETAtlas.vsi. This should install the Atlas template properly.

Just an update on this, the above issue of access denied to an unrelated folder has been fixed and the next release of Atlas will not have the same issue.

Thanks,
Frank

Access the control in Tabpanel on TabpanelContainer?

My second tab have some controls, ex. Textbox1, how can i access the value of Textbox1 in Tabpanel2 ?

Thanks,

I believe that Textbox1.Text should work for you... but I cannot try because I'm on diferent machine.


Hi,

Here is an example of referencing it with the help of FindControl method.

<%@. 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">
protected void Page_Init(object sender, EventArgs e)
{
TextBox tb = Panel2.FindControl("TextBox1") as TextBox;
tb.Text = DateTime.Now.ToString();

}

</script
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<div><asp:Button runat="server" Text="Button" ID="Button1"></asp:Button>
<ajaxToolkit:TabContainer runat="server" Height="150px" ID="tbcPlanOverview" >
<ajaxToolkit:TabPanel runat="Server" ID="Panel1" HeaderText="Tab One">
<ContentTemplate>
PAGE ONE - Sample HTML Content for Tab
</ContentTemplate>
</ajaxToolkit:TabPanel>
<ajaxToolkit:TabPanel runat="Server" ID="Panel2" HeaderText="Tab Two" >
<ContentTemplate>
PAGE TWO - Sample HTML Content for Tab
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</ContentTemplate>
</ajaxToolkit:TabPanel
<ajaxToolkit:TabPanel runat="Server" ID="Panel3" HeaderText="Tab Three">
<ContentTemplate>
PAGE THREE - Sample HTML Content for Tab
</ContentTemplate>
</ajaxToolkit:TabPanel>
</ajaxToolkit:TabContainer> <br />
<asp:Image ID="Image1" runat="server" />
<asp:TextBox ID="txtTabSelect" runat="server" />
</div>
</form>
</body>
</html>

Access Textbox Inside an Atlas CollapsiblePanel

Hello all, I have this code

<%

@dotnet.itags.org.RegisterSrc="~/Controls/CollapsibleContent.ascx"TagPrefix="collapsible"TagName="CollapsibleContent" %>

<collapsible:CollapsibleContentID="generalPanel"IsCollapsed="false"runat="server">
<Title>Datos Generales del Documento</Title>
<Content>
<tablewidth="100%"border="0"cellspacing="0">
<tr>
<tdstyle="text-align: left; width:15%">
<asp:LabelID="lblFormItem1"runat="server"Text="Titulo"></asp:Label>
</td>
<tdstyle="text-align: left; width:25%">
<asp:TextBoxID="txtFormItem1"runat="server"MaxLength="50"Width="85%"Enabled="false"></asp:TextBox>
<asp:RequiredFieldValidatorID="RequiredFieldValidator3"runat="server"ControlToValidate="txtFormItem1"ErrorMessage="this is a required field, can't be null"ValidationGroup="Page">*</asp:RequiredFieldValidator>
</td>
</tr>
</table>
</Content>
</collapsible:CollapsibleContent>

I'm trying to access the value of the textbox but when I build my solution, the debuger send that the txtFormItem1 doesn't exist, I have tried to do this

TextBox txt1 = (TextBox)this.Page.FindControl("txtFormItem1");
if (txt1 !=null)
{
txt1.Enabled = !txt1.Enabled;
}

Can anyone help me please. Thanks.

Try

generalPanel.FindControl("txtFormItem1");


I haven't tryed to reproduce your issue but feel questions:

Why are you using FindControl if you haven't instantiated the control dynamicly? just access txtFormItem1.Text...

if it doesn't work, download the latest release from codeplex... an issue about blank textboxes was resolved...

Hope helped...

Regards,

Felipe Oquendo
MCAD


sburke_msft:

Try

generalPanel.FindControl("txtFormItem1");

it would work too...