Showing posts with label template. Show all posts
Showing posts with label template. Show all posts

Wednesday, March 28, 2012

How do I start using AJAX controls on an existing project?

I went through the video tutorial where it had me open a template project, then add a confirmbuttonextender which worked very well. I noticed when i opened the template on the aspx page by following the videos instructions, it already contained a scriptmanager. On my existing poject I do the same steps to setup the button control, only this time i manually added a scriptmanager, but my button does nothing. Is there something i have to do to my project to enable it to Use the AJAX controls or something I have to do to the scriptmanager?

jwkeenan:

I went through the video tutorial where it had me open a template project, then add a confirmbuttonextender which worked very well. I noticed when i opened the template on the aspx page by following the videos instructions, it already contained a scriptmanager. On my existing poject I do the same steps to setup the button control, only this time i manually added a scriptmanager, but my button does nothing. Is there something i have to do to my project to enable it to Use the AJAX controls or something I have to do to the scriptmanager?

also there is a confiuration.

the best way to start using AJAX controls on an existing project . open an ASP.NET AJAX-Enabled Web Site . then add the pages in the existing project.

Regards.


ok i opened a new asp.net ajax web enabled site and added all the items form my other project, but the control still does nothing. Any other ideas i can try?


Hi, I try this way several times. I had several project and do this way.

note: don't add the web.config file from the exist project.

is ther an error appear to you?


It works! I was reloading my old web config file. Thanks for your help.


I started by...

Downloaded the ASP.NET AJAX Control Toolkit and load it's sample website into an instance of vs2005. You can run the sample website in debug mode and copy/paste desired code segments directly into your application. After you get the hang of specific controls then you can pick them directly from your AJAX Control Toolkit tab on the tools browser. This process will also helps in understanding the usage of the update panel.

PS - check out my schools site at:www.jeromessite.com.

If you like the way it works the let me know and I will direct you to the source code.

Thanks,

Jerome

Monday, March 26, 2012

How do I get Javascript Inside Content Template to fire on postback

I have 3 ASP controls inside of a ContentTemplate (some of mysyntax may be a little off below (doing it from memory here) but you'll get the idea):

<contenttemplate>

<asp:dropdownlist id= "control1" runat="server".../>

<asp:dropdownlist id "control2" runat="server".../.../>

<input type='button' onclick ='changeControlVisibility();' "control1".../>

<script type='Javascript>

'changeControlVisibility();

</script>

</contenttemplate>

Now, the''changeControlVisibility' javascript SETS a hidden value back and forth from 1 to 0 each time its clicked,AND it sets the 'style.visibility' property of both Control1 and Control2 .

So, when the changeControlVisibility runs during the the Load of the page, Control1 is then visible and Control2 is not visible. After the page has been loaded, each time the BUTTON is clicked after that, its the opposite actions (control1 =hidden & control2=visible) to (control1-visible & control2=hidden). This all works great.

The issue is this, when the selectedindexchanged of either of the dropdowns fires a postback (which is what I want) the

<script type='Javascript>

'changeControlVisibility();

</script>

never gets called or run, therefore all the controls within the contenttemplate get set to style.visiblity =visible (so they all appear) becasue that script never gets called during the postback.

Any suggestions on how to get it run or any good workarounds?

Thanks very much and I will immediated mark the issue resolved to the genius who comes up with a solid answer.

You can solve this by having that JavaScript outside of your UpdatePanel (in the <head> tag would work) of your page and then call it everytime the UpdatePanel gets updated. Have a look at the PageRequestManager class which enables you to execute JavaScript before, during, after UpdatePanels are loaded.

<

scripttype="text/javascript">
Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(pageLoaded);
function pageLoaded(sender, args){
if (args.get_panelsUpdated().length > 0){
changeControlVisibility();
}
}
</script>

That's a basic example and you can add better checks for specific UpdatePanels but you get the idea.

Al


thanks, that sound like the answer.

last thing, it looks like in your example that the line 'Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(pageLoaded);'

is adding a new script, if I am wanting to call an existing one, is there a differnt even I should use?


Never mind, i get it now...

So when I create my javascript then

'Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(pageLoaded);

is actually part of my actual javascript.

thanks so much!


Cool. Yes.

I had started to reply to your other message:

"
pageLoaded is name of the handler method that gets called, you can name it anything and have it execute any existing script also.

Details about the pageLoaded event can be found here:
http://ajax.asp.net/docs/ClientReference/Sys.WebForms/PageRequestManagerClass/PageRequestManagerPageLoadedEvent.aspx
"

Sounds like you've got it.

Cheers,
Al


Thanks Al you made my day!

Saturday, March 24, 2012

How Datagrid rows items drag and drop into another datagrid footer template ....

Hi all...

I am using ATLAS + ASP.NET + C#... i have a requirement like, i wants to drag an datagrid item from one column... and drops into another datagrid footer control. i am new to Atlas technology...Please help me, if anybody have the ATLAS information to learn more abt ATLAS please send me to thisbasavareddygopsen@dotnet.itags.org.rediffmail.com...

Regards,

Basawareddy

HI,

i am sorry dont have a reply to your query, but will surely work out to find it out. But i too have a query, i hope u might be able to help me out.

I am also using ATLAS + ASP.NET+ C#...for developing on of the web based applications. The issue that we are facing right now is that we are not able to get pop up error messages when we are using Atlas, can you help me out to educate me that is it possible to integrate pop up error messages while using Atlas, if YES then please let me know how...

Thanks a lotSmile

Prakhar Saxena

Wednesday, March 21, 2012

how can I pass a value to a javascript function on image clickBehavior atlas?

Hi Guys, I have the image template below and on imageURL I bind theDBImageName that comes from database via webservices objects. I also call a function DoAdditionalHandling because I need to construct the actual image URL. Now I need to define a click event which I am using theclickBehavior . How can I pass to the function a value that comes from database, let's say how can I passDBImageName field that is being bound to imageURL. Please advice!

<image id=

"ImageThumbPath">

<bindings>

<binding dataPath=

"DBImageName" property="imageURL" transform="DoAdditionalHandling" />

<binding dataPath=

"DBImageALT" property="alternateText" />

</bindings>

<behaviors>

<clickBehavior click=

"ImageClickHandler" />

</behaviors>

</image>

From your event handler, use the sender's dataContext to get the value, like so:

function imageClickHandler(sender, eventArgs){ var DBImageName = sender.get_dataContext().DBImageName;}

I just posted a working exmaple of this to my blog:http://smarx.com/posts/how-to-pass-a-value-to-a-javascript-event-handler.aspx.


Steve,

I asked you also the other day. Can you help me with<atlas:InitialDatarunat="server"id="InitialData1" >

I need to know how to specify the method name and the parameters to method. The example you showed me does not specify it, but it seems like it has its default methods because the web service on that example inherits froma dataservice. Please help me and give me more details if you can. I appreacite your help.


If I understand your question correctly, you want to specify what method to call on the web service (like using "loadMethod=..." on a dataSource in xml-script). Looking at theclass browser documentation for InitialData, it doesn't look like that's possible. :-(

Yes, the example works because it inherits from DataService and provides one method with the attribute [DataObjectMethod(DataObjectMethodType.Select)], so the right thing happens by default.


so any work around? Please advice.

Nothing that I'm aware of (but others please chime in if you have an answer).

I think you'll have to just not use <atlas: InitialData /> and just use your dataSource with autoLoad="true". InitialData is just there to improve performance a little by allowing you to send the data down with the initial page load instead of requiring a second roundtrip to the server.

I'll ping the product team and see if a LoadMethod parameter will be added to InitialData in the future.


is it anyway to specify the method call and parameters ondataSource with autoLoad="true? Please advice Steve!


Yes, just use the "serviceURL=..." and "loadMethod=..." properties on your <dataSource /> xml-script tag. I believe you can just specify <parameters foo="bar" baz="blah" ... /> inside your <dataSource /> to pass parameters.

If you need to databind those parameters, use <binding dataPath="..." property="parameters" propertyKey="foo" />.


not sure how. do u have the syntax of the datasource parameters? how can then I bind it to a dataview?

More explicitly, here's the syntax:

<dataSource id="myDataSource" serviceURL="myservice.asmx" loadMethod="myLoadMethod">
<parameters param1="foo" param2="bar" />
</dataSource>

(Assuming you have myLoadMethod(string param1, string param2); in your web service.)

Databinding your dataView doesn't need to change at all. It's still:

<dataView id="myDataView">
<bindings>
<binding dataContext="myDataSource" dataPath="data" property="data" />
</bindings>
</dataView>

I believe you already had this working in your code from theother thread.


I did that exactly and got a javascript error invalid xml mark up script. On the other example, I have it simply by clicking in a buton. But my other task is when page loads, the data has to be displayed.

I'll look into getting you a full working example.

To follow up on what I said earlier "I'll ping the product team and see if a LoadMethod parameter will be added to InitialData in the future," I checked with the product team, and it sounds like InitialData will have all the functionality of dataSource (so that includes specifying the method to call on the web service and any parameters), but they're not sure of the timeframe.


Thank you! Please email me atnesfrank@.yahoo.com

Steve,

Here is what I am doing but I get invalid xml mark up script. may be the syntax for parameters is diffrent? Please advice!

<dataSource id=

"dataSource1" autoLoad="true" serviceURL="~/AtlasTestService.asmx" loadMethod="GetTestData">

<parameters Code=

"cu0001" paramboolean="true" />

</datasource>


It's probably because your closing tag doesn't match your opening tag. Try changing "datasource" to the correct capitalization: "dataSource".

How can I install the AJAX website template trough VS Orcas?

How can I install the AJAX website template trough VS Orcas?

It work with VS2005...

Thanks

Greg

AJAX functionality is default in Orcas. You can choose the normal website template.