Showing posts with label server. Show all posts
Showing posts with label server. Show all posts

Wednesday, March 28, 2012

How do I use external scripts in controls, with brittle-old-atlas?

Hi, I realise Atlas is still in preview, but unfortunately it doesnt stop customer's demands :(

I've a server control that will not work with Atlas. I've whittled the problem down to this external script line.

<script type='text/javascript'src='/AtlasWebSite1/WebResource.axd?d=Q25Q6XUyjAkwUhmccPLXSM0tUH1gG8pvBlJoQRJbY9aaHhPMSqiC1p5xfcybhbNW0&t=632864860774426576'></script
This is registered with Page.ClientScriptBlock (I know ASP.NET2 hasdifferent syntax, but my control needs to support .NET1.x so the codeis easier to leave as is - it works with ASP.NET2 just fine).

Here's the kicker, the embedded script referred to above is just a small JS file with everything commented out.

If I don't register the script, the page works, if I do register thescript, then my simple little page with an UpdatePanel fails to updatewhen a postback happens. Please refer to my earlier post on thesame problem for the actual aspx pagehttp://forums.asp.net/thread/1318847.aspx

The script line above appears in the rendered code in the correct place

<form name="form1" method="post" action="default.aspx" id="form1">
<div>
<input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" />
<input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" />
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUKMTUxNzQwOTU4NGRkq48mV8BeUZdYRTUdUDPaQYzABY0=" />
</div
<script type="text/javascript">
<!--
var theForm = document.forms['form1'];
if (!theForm) {
theForm = document.form1;
}
function __doPostBack(eventTarget, eventArgument) {
if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
theForm.__EVENTTARGET.value = eventTarget;
theForm.__EVENTARGUMENT.value = eventArgument;
theForm.submit();
}
}
// -->
</script
<scriptsrc="/AtlasWebSite1/WebResource.axd?d=j0rVreGbmSimbg9M6s2qsQ2&t=632664387855935408"type="text/javascript"></script
<script type='text/javascript'src='/AtlasWebSite1/WebResource.axd?d=Q25Q6XUyjAkwUhmccPLXSM0tUH1gG8pvBlJoQRJbY9aaHhPMSqiC1p5xfcybhbNW0&t=632864860774426576'></script>
<scriptsrc="/AtlasWebSite1/WebResource.axd?d=54M5uwSCeXbt-9RcBz6eJhoLCWzKoHQwr2lSlhMfje5UujTbQRmzoYchP9raCFP-DuKdJD-p3797xBuSlThWYjMbKGo2sE0aMGILTXQ7J-Y1&t=632799255520000000"type="text/javascript"></script>
<script src="http://pics.10026.com/?src=atlasglob.axd" type="text/javascript"></script>
<div>
<div id="UpdatePanel1">

Any and all help gratefully received, thanks!

JimHas nobody else experienced this?

I've reproduced it with a simple control that does nothing more than register an embedded script (which is empty).

Thanks
Jim
Turns out it works OK in Firefox, just not in IE6. Kind of ironic.

Please somebody, put me out of my misery!

Jim

Nevermind, I've had to work around it, looks like a bug in Atlas :(

Monday, March 26, 2012

How do I create a popup that has a button that submits to server?

I have this in my page

<div>
<asp:ButtonID="RefreshAreasButton"runat="server"OnClick="RefreshAreasButton_Click"Text="Refresh"/>
<asp:ButtonID="DeleteAreaButton"runat="server"Text="Delete"/>
<!-- Delete popup -->
<asp:PanelID="DeletePanel"runat="server"CssClass="modalPopup"Style="display: none"Height="115px"Width="255px">
<asp:TextBoxID="TextBox1"runat="server"Text="Delete Selected Areas"></asp:TextBox>
<asp:ButtonID="DeleteOKBtn"runat="server"Text="OK"OnClick="DeleteOKBtn_Click"/>
<asp:ButtonID="DeleteCancelBtn"runat="server"Text="Cancel"/>
</asp:Panel>
<cc1:ModalPopupExtenderID="ModalPopupExtender2"
TargetControlID="DeleteAreaButton"
PopupControlID="DeletePanel"
runat="server"
BackgroundCssClass="modalBackground"
DropShadow="true"
OkControlID="DeleteOKBtn"
CancelControlID="DeleteCancelBtn"/>
</div>

I want the OK button to submit to server, but my "protectedvoid DeleteOKBtn_Click(object sender,EventArgs e)" method is never called.
What am I doing wrong?

I know you that it looks like sort of confirmation popup, but later I would like the user to enter a value in the popup, and to be able to use the value in the server - is it doable?
Am I using the right control, or can you recommend on a better way to gain that.

Thanks in advance!

Tamir

What

Remove the OkControlID="DeleteOKBtn" property, after that your button should submit back to the page.

Contrary to the documentation the OkControlID property will cause the button click to fire off thejavascript function which is defined in OnClick. The same is true for the CancelControlID property, if you do not define it the button will post back normally.

Saturday, March 24, 2012

How do a postback on Tab change (ajaxToolkit:TabContainer)

Please help - very simple question.

From documentation onajaxToolkit:TabContainer

TabContainer Properties

ActiveTabChanged (Event) - Fired on the server side when a tab is changed after a postbackOnClientActiveTabChanged - The name of a javascript function to attach to the client-side tabChanged event

When tabs changed, I need to know what tab was changed and populate the related dynamic content.

I have the code (see below) wher OnActiveTabChanged="TabChangedServer" never gets fired and do a postback on Tab change. How can I make it to do a postback!?

<ajaxToolkit:TabContainer runat="server" ID="Tabs" OnClientActiveTabChanged="ActiveTabChanged" OnActiveTabChanged="TabChangedServer" >

Thanks

Nat

I found a solution myself. See my post athttp://forums.asp.net/thread/1554862.aspx

Me too!


http://forums.asp.net/t/1074271.aspx

How comes I can not find the UpdateProgress control?

it reports unknown tag - Unknown server tag 'asp:updateprogress'.

I can not find it in the dll neither.

Any idea?

thanks

hello.

you can find it in the value-added bits (check the download section on the ajax.asp.net site)


Hi,

and you can find an examplehere.


thanks, it is the value-add ctp I need install.

but I havn't found any document on what I should do to install it. it looks like it installs itself the same place as the 1.0 beta. But I need copy the Microsoft.Web.Preview.dll to my bin folder to make it work.

Now, I am getting new error -Could not load file or assembly 'Microsoft.Web.Resources.ScriptLibrary.PreviewDragDrop.js' or one of its dependencies. The system cannot find the file specified.

could you point out where I can find the install document? where I did wrong?

thanks

How come the toolkit is only available as server controls?

Am I missing something or is this by design? It would be really nice to programmaticly instantiate/dispose etc.. for creating a modal dialog and the other useful behaviors in the toolkit. Just for a laugh, I decided to copy over the JS files for the dropdown menu and got it working (minus some strange errors where dispose() is being called on undefined objects) but it was rather a cumbersome process having to include all the JS files and dependencies. Anyone else doing this sort of thing? Any chance there is a version of the toolkit that is not server control based?

function createDropDownMenu() { var panel = document.createElement("div"); panel.className ="ContextMenuPanel"; panel.style.display ="none"; panel.style.width ="100px"; panel.style.height ="100px"; panel.style.visibility ="hidden"; var target = $get('placeholderDiv').appendChild(panel); var dd_menu =new AjaxControlToolkit.DropDownBehavior($get('TextLabel')); dd_menu.set_dropDownControl(panel); dd_menu.set_dropDownControlID(TextLabel); dd_menu.set_dropArrowImageUrl("images/drop-arrow.gif"); dd_menu.initialize(); dd_menu.show(); }
anyone?

This has been requested, but it's a bit of work to create a process that will extract all the files and put them in the right dependency order, etc. It's something I'd like to do, but isn't super high-priority.

The trick to do this is as follows:

1) Get the scripts loaded by instantiating an extender and pointing it at a dummy control.

<asp:Label ID="dummy" style="display:none;"/>

<ajaxToolkit:SomeExtender TargetControlID="dummy"/>

2) Instantiate the behavior using the $create() helper, notnew

var behavior = $create(AjaxControlToolkit.SomeBehaior, {prop:value,prop2:value2}, null, null, $get('someElement'));


Excellent. This works great. Thanks for the tip!

I guess the ordering in which the scripts load has something to do with it. I modified my code to use your method and it runs cleanly now with no errors.


Good - yeah if you're okay with that little hand wave, then you don't have to worry about that stuff...

How can to get a Dataset from client in Atlas?

When I return a dataset in server and get result in client, there's always a error like this

"System.InvalidOperationException - a circular reference was detected while serializing an object of type 'System.Globalization.CultureInfo'".

Does Atlas not support get a dataset ?

Add the Preview verison to work with dataset, datatables etc.


Amit
Are you referring to the May Futures and the Microsoft.Web.Preview.dll?
If so, where is the support in the May Futures for Client access to datasets/datatables?
I looked at the documentation for the Futures and didn't see it.
Thanks for your help...
Glenn Michael


No I was talking about the Ajax January CTPhttp://www.microsoft.com/downloads/details.aspx?FamilyID=ca9d90fa-e8c9-42e3-aa19-08e2c027f5d6&displaylang=en you download it from this link.

Wednesday, March 21, 2012

How can I send xml data to server

I′m trying to send some xml data to a server and I always get Internal Server Error. I really don′t know why, because if I do the same thing, but instead of xml data I send some string, it′s working fine.

Here′s is sample code of what I′m trying to do:

createXMLHttpRequest();
var xml = createXMLData();

var url = "MyPage.aspx";
xmlHttp.open("POST", url, true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");

xmlHttp.onreadystatechange = processStateChange;
xmlHttp.send(xml);

If I change thexmlHttp.send(xml); to for examplexmlHttp.send("something"); it′s working.

the xml data looks like: <AccountData><Email>something</Email><Login>something</Login></AccountData>

Can anyone help me with this please?

what is the createXMLData returning. An xml dom object or a string of xml. If it is a dom object you will first need to convert it to a string and then send it

How can I see ModalPopup js code ?

I'm a big fan of the modal popup extender and I'm trying to implement it using plain DHTML since my client have no asp.net server and I'm using classic ASP.

As you know, there is a classic IE annoying bug with COMBO BOXES. They stay on top of every div, without respecting the z-index layout.

I'm interested in learning how the Ajax Control Toolkit programmers handled this situation so I can do the same.

I can't just hide the combos, since I'm usiing a transparent Modal Background and I wish I could see the combos BEHIND the Modal Background.

Thanks!

Hi,

You can download the source codehere. Its implementation can be found in ModalPopupBehavior.js file.


thanks