Showing posts with label sample. Show all posts
Showing posts with label sample. Show all posts

Wednesday, March 28, 2012

ASP.NET AJAX Sample applications - SimpleList

Hi,

I also just started learning ASP.NET AJAX for real and I wanted to check out theSamples that one can download. I thought using the SimpleList would be the easiest but I soon found out that when you want to run the DragOverlayExtender began complaining. Seemed the web.config isn't complete. I added these extra lines in order to get it to work:

 <profile> <properties> <add name="dragOverlayPosition"/> </properties> </profile>

and

 <profileService enabled="true" readAccessProperties="dragOverlayPosition" writeAccessProperties="dragOverlayPosition" />

I hope this helps other people out that are just starting to play around with the samples

If you like to read more about it...

Grz, Kris.

Thanks for sharing Kris...Please continue to do so.

Salute,

Mark Wisecarver

ASP.NET AJAX RC on PROD server is not working

Hi

I have a sample ASP.NET AJAX application built using ASP.NET AJAX RC. it AJAXes and it does behave as expected on VS 2005. When i deployed it on my local server. It does not AJAX and get the following javascript error

Error:'Sys' is undefined

am running XP Pro, SP2 & IIS 5.1. earlier i had not installed any beta releases or ATLAS. i dont see what is going on.

thanks in advance for the help

Anil

7 pages of posts just like this, lots of solutions and things to try in there

http://forums.asp.net/thread/1498667.aspx

Monday, March 26, 2012

ASP.NET Ajax beginner question

Hi all,
I followed first walk through sample from
http://ajax.asp.net/docs/tutorials/IntroductionUpdatePanel.aspx to create my first testing page, The problem is after I clicked that botton, it still trigged a postback. Do I miss something?

Following is my code:

ASPX Page

<%@dotnet.itags.org. Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %
<%@dotnet.itags.org. Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Web.UI" TagPrefix="asp" %
<!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>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Label ID="Label1" runat="server" Text="Parcel created"></asp:Label>
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click"
Text="Button" />
</ContentTemplate>
</asp:UpdatePanel>
</div>
</form>
</body>
</html
Code behind

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

}

protected void Button1_Click(object sender, EventArgs e) {
Label1.Text = "Refreshed at " + DateTime.Now.ToString();
}
}

Html code generated by page

<!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><title>
Untitled Page
</title></head>
<body>
<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="/wEPDwULLTEyNTU5OTE4NDBkZFFbG+xINimfJjnJzMPyN5/bdPcr" />
</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
<script
src="http://forums.asp.net/AjaxSandbox/WebResource.axd?d=uPSIJPV09GNZkXa1aWLuZA2&t=632961560341637622" type="text/javascript"></script
<script
src="http://forums.asp.net/AjaxSandbox/ScriptResource.axd?d=Rdf9isNeXMPi-qNzO-XVRmXNOH0DmLQG-4RxW5WORPfrZ2K0YD5Icg_Bz9c5f0-wuytwMMng0hZa1k1SSKrW5yqEjrhREy__cV5gKfSghPU1&t=633053156500271737" type="text/javascript"></script>
<script
src="http://forums.asp.net/AjaxSandbox/ScriptResource.axd?d=Rdf9isNeXMPi-qNzO-XVRmXNOH0DmLQG-4RxW5WORPfrZ2K0YD5Icg_Bz9c5f0-wuytwMMng0hZa1k1SSKrW572e2ypQhyGf_JtyUNuUy11_drtp-tXJrGLYVAgwBUoK0&t=633053156500271737" type="text/javascript"></script>
<div>
<script type="text/javascript">
//<![CDATA[
Sys.WebForms.PageRequestManager._initialize('ScriptManager1',
document.getElementById('form1'));
Sys.WebForms.PageRequestManager.getInstance()._updateControls(['tUpdatePanel1'], [], [], 90);
//]]>
</script
<div id="UpdatePanel1"
<span id="Label1">Parcel created</span>
<input type="submit" name="Button1" value="Button" id="Button1" /
</div>
</div>

<div
<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION"
value="/wEWAgLk5+S6DwKM54rGBofhZslYBM4FNpmEHJadJ6r8Aq3Z" />
</div
<script type="text/javascript">
<!--
Sys.Application.initialize();
// -->
</script>
</form>
</body>
</html>

Hey,

For your script manager, add EnablePartialRendering="true", and for your updatepanel, add Mode="Always".


Neither of those things should be necessary. (They're both the defaults.) Also, it's "UpdateMode" now (not "Mode" as it was in early CTPs).

My guess is that something's wrong in your web.config... did you start from the "ASP.NET AJAX-Enabled Web Site" template? Are there any JavaScript errors on the page when you first load it?


Steve Marx:

Neither of those things should be necessary. (They're both the defaults.) Also, it's "UpdateMode" now (not "Mode" as it was in early CTPs).

My guess is that something's wrong in your web.config... did you start from the "ASP.NET AJAX-Enabled Web Site" template? Are there any JavaScript errors on the page when you first load it?

You are right, I didn't start a new web site with "ASP.NET AJAX-Enabled Web Site" template. I adjusted web.config manually, and it works.

Wednesday, March 21, 2012

ASP AJAX SlideShow SlideShowServiceMethod

Can anybody help me with theSlideShowServiceMethod?

I need sample code to look for the images.

Anybody using this control?

Thank you in advance.

Take a look at the Toolkit SampleWebsite SlideShow demo code.


I already saw the SampleWebsite SlideShow demo but they do not explain how to get the pictures. Do you have some sample code?


Here is some sample code that gets pictures. I was referring to the sample website's aspx page which also has a pagemethod that shows how to get the pictures.

 [WebMethod]public AjaxControlToolkit.Slide[] GetSlides() {return new AjaxControlToolkit.Slide[] {new AjaxControlToolkit.Slide("images/Autumn Leaves.jpg","Autumn Leaves.jpg","Autumn Leaves.jpg"),new AjaxControlToolkit.Slide("images/Creek.jpg","Creek.jpg","Creek.jpg"),new AjaxControlToolkit.Slide("images/Desert Landscape.jpg","Desert Landscape.jpg","Desert Landscape.jpg"),new AjaxControlToolkit.Slide("images/Forest Flowers.jpg","Forest Flowers.jpg","Forest Flowers.jpg"),new AjaxControlToolkit.Slide("images/Forest.jpg","Forest.jpg","Forest.jpg"),new AjaxControlToolkit.Slide("images/Frangipani Flowers.jpg","Frangipani Flowers.jpg","Frangipani Flowers.jpg"),new AjaxControlToolkit.Slide("images/Garden.jpg","Garden.jpg","Garden.jpg"),new AjaxControlToolkit.Slide("images/Creek.jpg","Creek.jpg","Creek.jpg"),new AjaxControlToolkit.Slide("images/Humpback Whale.jpg","Humpback Whale.jpg","Humpback Whale.jpg"),new AjaxControlToolkit.Slide("images/Green Sea Turtle.jpg","Green Sea Turtle.jpg","Green Sea Turtle.jpg")}; }

ask a question: an exception about tabcontainer

these sample code throwed an exception :

Specified argument was out of the range of valid values.
Parameter name: value

1TabPanel tp =new TabPanel();2tp.HeaderText = tableName;3string cmdText =string.Format("SELECT * FROM {0}", tableName);4MySqlCommand cmd =new MySqlCommand(cmdText, conn);5MySqlDataReader dr = cmd.ExecuteReader();6GridView gv =new GridView();7while (dr.Read())8{9 gv.DataSource = dr;10}11gv.DataBind();12tp.ContentTemplate.InstantiateIn(gv);13tabPanels.Add(tp);

How can i add tabpanels into a tabcontainer ??

Hi Franky,

Please use tp.Controls.Add(gv) instead of tp.ContentTemplate.InstantiateIn(gv); Here is the whole sample.

Aspx

<%@. Page Language="C#" AutoEventWireup="true" CodeFile="Dynamically.aspx.cs" Inherits="Tab_Dynamically" %>

<!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>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<ajaxToolkit:TabContainer ID="TabContainer1" runat="server">
</ajaxToolkit:TabContainer>
</form>
</body>
</html>


C# code.

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections.Generic;
using AjaxControlToolkit;

public partial class Tab_Dynamically : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
TabPanel tp = new TabPanel();
tp.HeaderText ="111";
List<string> myList = new List<string>();
myList.Add("11111");
myList.Add("22222");
myList.Add("33333");
GridView gv = new GridView();
gv.DataSource = myList;
gv.DataBind();
tp.Controls.Add(gv);

TabContainer1.Tabs.Add(tp);
TabContainer1.ActiveTabIndex = 0;
}

}

For more about InstantiateIn, please visithere.

I hope this help.

Best regards,

Jonathan


Array.Add error on Accordion Sample

Hi all !

I've just tried to run the Accordion Sample but i have a problem.

My accordion appears normal and the correct selectedIndex is selected but when i click on other tabs nothing happend.


This is probably because I javascript error. On the page loading I have :

Array.add is not a function
http://localhost:55969/SampleWebSite/WebResource.axd?d=mfyjuyIi_kyiiageb8-dhJuhhEl4d31tjtLnqXaaEJUweLlnyGkeivorEaIgdU-PbZW9-5qoeQV4YUrf2DMON_wD741USQBsSK41MaLx_5k1&t=633001666170937500
Line: 156

Thanks !

Bye

When i look in the webResource.axd the problem is in the initialize : function().




Sounds like maybe the server doesn't have ASP.NET AJAX Beta *2*?