By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,533 Members | 1,497 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,533 IT Pros & Developers. It's quick & easy.

Using ajax in Existing ASP.net Application

P: n/a
Hi i want to use AJAX.net in my Existing Application

I have already installed the ajax .net
..net 3.0
and using VS 2005

in the old application i have added a new web form then script manager
and then update panel and some control in it to test it.

When i run the programme ir does not work . imean ajax does not works
post back happens

when i checked the page in javascript console it show me a warning

sys noit defined
Plz help me
Jan 6 '07 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Hi Mukesh,

Could you please post your code here so that I can help you find the cause?

Also, does the sample code here work on your side:

#ASP.NET AJAX Sample ASP.NET AJAX Application
http://ajax.asp.net/docs/tutorials/C...plication.aspx

Sincerely,
Walter Wang (wa****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications. If you are using Outlook Express, please make sure you clear the
check box "Tools/Options/Read: Get 300 headers at a time" to see your reply
promptly.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Jan 8 '07 #2

P: n/a
It sounds like an installation issue. Start with an uninstall and then a
fresh install. Then, follow the tutorials to get a simple example working.

--
Regards,
Alvin Bruney
------------------------------------------------------
Shameless author plug
Excel Services for .NET is coming...
OWC Black book on Amazon and
www.lulu.com/owc

"Mukesh" <ef*****@newsgroups.nospamwrote in message
news:OT**************@TK2MSFTNGP02.phx.gbl...
Hi i want to use AJAX.net in my Existing Application

I have already installed the ajax .net
.net 3.0
and using VS 2005

in the old application i have added a new web form then script manager and
then update panel and some control in it to test it.

When i run the programme ir does not work . imean ajax does not works post
back happens

when i checked the page in javascript console it show me a warning

sys noit defined
Plz help me

Jan 8 '07 #3

P: n/a
Hi walter

Thx for ur response

I have solved the issue myself by doing changes in web.config file.

I have created a new ajax web prj then added a web.config to hte prj. and
merjed the web config with my old prjects web.config file now the project is
working. fine
--
Regards,
Mukesh Kumar Agarwal
Senior Software Engineer
Efextra Solutions Pvt. Ltd
Noida- 201301
Delhi India
"Walter Wang [MSFT]" wrote:
Hi Mukesh,

Could you please post your code here so that I can help you find the cause?

Also, does the sample code here work on your side:

#ASP.NET AJAX Sample ASP.NET AJAX Application
http://ajax.asp.net/docs/tutorials/C...plication.aspx

Sincerely,
Walter Wang (wa****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications. If you are using Outlook Express, please make sure you clear the
check box "Tools/Options/Read: Get 300 headers at a time" to see your reply
promptly.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Jan 8 '07 #4

P: n/a
// The ascx.cs file
<%@ Control Language="C#" AutoEventWireup="true"
CodeFile="EditProfile.ascx.cs" Inherits="UserControls_EditProfile" %>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<table>
<tr>
<td>
First Name
</td>
<td>
<asp:TextBox ID="tbFirstName" runat="server" ReadOnly="True"
></asp:TextBox></td>
</tr>
<tr>
<td>
Middle Name
</td>
<td>
<asp:TextBox ID="tbMiddleName" runat="server" MaxLength="50"
></asp:TextBox></td>
</tr>
<tr>
<td>
Last Name
</td>
<td>
<asp:TextBox ID="tbLastName" runat="server" ReadOnly="True"
></asp:TextBox></td>
</tr>
<tr>
<td>
Email</td>
<td>
<asp:TextBox ID="tbEmail" runat="server" ReadOnly="True"
></asp:TextBox></td>
</tr>
<tr>
<td>
Date Of Birth</td>
<td>
<asp:TextBox ID="tbDate" runat="server" AutoCompleteType="Disabled"
></asp:TextBox>
<div style="font-size: 90%">
<em>(Set the focus to the textbox to show the calendar)</em></div>
<ajaxToolkit:CalendarExtender
ID="CalendarExtender1" runat="server" Format="MMMM d, yyyy"
TargetControlID="tbDate" FirstDayOfWeek="Sunday">
</ajaxToolkit:CalendarExtender>
</td>
</tr>
<tr>
<td>
Gender
</td>
<td>
<asp:RadioButtonList ID="rblGen" runat="server"
RepeatDirection="Horizontal">
<asp:ListItem Selected="True" Value="1">Male</asp:ListItem>
<asp:ListItem Value="0">Female</asp:ListItem>
</asp:RadioButtonList></td>
</tr>
<tr>
<td>
Telephone
</td>
<td>
<asp:TextBox ID="tbTelIsd" runat="server" MaxLength="4"
></asp:TextBox><asp:RegularExpressionValidator
ID="revTelIsd" runat="server" ControlToValidate="tbTelIsd"
ErrorMessage="Enter the Proper ISD Code"
SetFocusOnError="True" ValidationExpression="([0-9]+)$"
>*</asp:RegularExpressionValidator>
<asp:TextBox ID="tbTelStd" runat="server" MaxLength="7"
></asp:TextBox><asp:RegularExpressionValidator
ID="revTelStd" runat="server" ControlToValidate="tbTelStd"
ErrorMessage="Enter the Proper STD Code,max Length is 4"
SetFocusOnError="True" ValidationExpression="([0-9]+)$"
>*</asp:RegularExpressionValidator><asp:TextBox ID="tbTelLcl" runat="server"
MaxLength="20" ></asp:TextBox><asp:RegularExpressionValidator
ID="revTelLcl" runat="server" ControlToValidate="tbTelLcl"
ErrorMessage="Only integers value allowed"
SetFocusOnError="True" ValidationExpression="([0-9]+)$"
>*</asp:RegularExpressionValidator></td>
</tr>
<tr style="color: #000000">
<td>
Mobile
</td>
<td>
<asp:TextBox ID="tbMobIsd" runat="server" MaxLength="4"
></asp:TextBox><asp:RegularExpressionValidator
ID="revMobIsd" runat="server" ControlToValidate="tbMobIsd"
ErrorMessage="Enter the Proper ISD Code"
SetFocusOnError="True" ValidationExpression="([0-9]+)$"
>*</asp:RegularExpressionValidator>
<asp:TextBox ID="tbMobLcl" runat="server" MaxLength="20"
></asp:TextBox><asp:RegularExpressionValidator
ID="revMobLcl" runat="server" ControlToValidate="tbMobLcl"
ErrorMessage="Only integers value allowed"
SetFocusOnError="True" ValidationExpression="([0-9]+)$"
>*</asp:RegularExpressionValidator>
</td>
</tr>
<tr>
<td colspan="2">
Address
</td>
</tr>
<tr>
<td>
Country</td>
<td>

<ContentTemplate>
<asp:DropDownList ID="ddlCountry" runat="server" AutoPostBack="True"
DataSourceID="XmlDataSource1"
DataTextField="name" DataValueField="countryCode"
OnDataBound="ddlCountry_DataBound"
OnSelectedIndexChanged="ddlCountry_SelectedIndexCh anged">
<asp:ListItem Selected="True" Value="0">--- Select Country
---</asp:ListItem>
</asp:DropDownList><asp:XmlDataSource ID="XmlDataSource1" runat="server"
DataFile="~/App_Data/CountriesStates.xml"
XPath="root/Countries/country"></asp:XmlDataSource>
</ContentTemplate>

</td>
</tr>
<tr>
<td>
State</td>
<td>

<ContentTemplate>
<asp:DropDownList ID="ddlStt" runat="server" AutoPostBack="True"
DataSourceID="XmlDataSource2"
DataTextField="Name" DataValueField="id"
OnSelectedIndexChanged="ddlStt_SelectedIndexChange d"
OnDataBound="ddlStt_DataBound">
<asp:ListItem Selected="True" Value="0">--- Select State
---</asp:ListItem>
</asp:DropDownList><asp:TextBox ID="tbState" runat="server" MaxLength="50"
Visible="False"></asp:TextBox><asp:XmlDataSource
ID="XmlDataSource2" runat="server"
DataFile="~/App_Data/CountriesStates.xml"
XPath="root/states/state"></asp:XmlDataSource>
</ContentTemplate>

<asp:RegularExpressionValidator
ID="revSta" runat="server" ControlToValidate="tbState"
ErrorMessage="RegularExpressionValidator"
SetFocusOnError="True"
ValidationExpression="^(\w*\W*\w*\W*)*[^0-9][^<>]"
>*</asp:RegularExpressionValidator></td>
</tr>
<tr>
<td>
City</td>
<td>

<ContentTemplate>
<asp:DropDownList ID="ddlCti" runat="server"
OnSelectedIndexChanged="ddlCti_SelectedIndexChange d" AutoPostBack="True">
</asp:DropDownList>
<asp:TextBox ID="tbCity" runat="server" MaxLength="50"
Visible="False">My City</asp:TextBox>
</ContentTemplate>

<asp:RegularExpressionValidator
ID="revCty" runat="server" ControlToValidate="tbCity"
ErrorMessage="RegularExpressionValidator"
SetFocusOnError="True"
ValidationExpression="^(\w*\W*\w*\W*)*[^0-9][^<>]"
>*</asp:RegularExpressionValidator></td>
</tr>
<tr>
<td>
Locality</td>
<td>

<ContentTemplate>
<asp:DropDownList ID="ddlLocal" runat="server"
OnSelectedIndexChanged="ddlLocal_SelectedIndexChan ged" AutoPostBack="True">
</asp:DropDownList>
<asp:TextBox ID="tbLcl" runat="server" MaxLength="50" Visible="False">My
Locality Name</asp:TextBox>
</ContentTemplate>

<asp:RegularExpressionValidator
ID="revLcl" runat="server" ControlToValidate="tbLcl"
ErrorMessage="RegularExpressionValidator"
SetFocusOnError="True" ValidationExpression='^(\w*\W*\w*\W*)*[^<>"]'
>*</asp:RegularExpressionValidator></td>
</tr>
<tr>
<td>
Street1</td>
<td>
<asp:TextBox ID="tbStr1" runat="server" MaxLength="100"
></asp:TextBox></td>
</tr>
<tr>
<td>
Street2</td>
<td>
<asp:TextBox ID="tbStr2" runat="server" MaxLength="100"
></asp:TextBox></td>
</tr>
<tr>
<td style="height: 26px">
Pincode</td>
<td>

<ContentTemplate>
<asp:TextBox ID="tbPin1" runat="server" MaxLength="15"
Visible="False"></asp:TextBox><asp:TextBox ID="tbPin" runat="server"
MaxLength="6" ></asp:TextBox>
</ContentTemplate>

<asp:RegularExpressionValidator
ID="revPin" runat="server" ControlToValidate="tbPin" ErrorMessage="Only
6 digit is allowed"
SetFocusOnError="True" ValidationExpression="\d{6}"
>*</asp:RegularExpressionValidator></td>
</tr>
<tr>
<td align="center" colspan="2">
<asp:ValidationSummary ID="vsUsrPerIn" runat="server" >
</asp:ValidationSummary>
<asp:Label ID="lblMessage" runat="server"
EnableViewState="False"></asp:Label></td>
</tr>
<tr>
<td align="center" colspan="2">
<asp:Button ID="btnSubmit" runat="server" OnClick="btnSubmit_Click"
Text="Submit" /></td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>


//------------------------- the ascx.cs
file-----------------------------------------
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;

public partial class UserControls_EditProfile : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
/// chk for sseion
/// call prefill
Propertywala.User user =
(Propertywala.User)Session[Propertywala.Constants.CommonConsts.USER_SESSION_N AME];
bool chkNull = Convert.IsDBNull(user.HomeAddress.Country);
if (!Convert.IsDBNull(user.HomeAddress.Country))
{
tbFirstName.Text = user.FirstName;
tbMiddleName.Text = user.MiddleName;
tbLastName.Text = user.LastName;
tbEmail.Text = user.PrimaryEmail;
DateTime dob = new DateTime();
DateTime.TryParse(user.DateOfBirth, out dob);
string dobst = dob.ToLongDateString();
tbDate.Text = dobst.Remove(0, dobst.IndexOf(",") + 1);
rblGen.SelectedIndex = 1;
if (user.IsUserMale)
{
rblGen.SelectedIndex = -1;
rblGen.SelectedIndex = 0;
}

tbTelIsd.Text = user.TelephoneIsd;
tbTelLcl.Text = user.TelephoneLocal;
tbTelStd.Text = user.TelephoneStd;
tbMobIsd.Text = user.MobileIsd;
tbMobLcl.Text = user.MobileLocal;
tbStr1.Text = user.AddressStreet1;
tbStr2.Text = user.AddressStreet2;
if (user.HomeAddress.Pin != "")
{
tbPin.Text = user.HomeAddress.Pin;
tbPin1.Text = user.HomeAddress.Pin;
}
tbCity.Text = user.HomeAddress.City;
tbLcl.Text = user.HomeAddress.Locality;
tbState.Text = user.HomeAddress.State;
}
}
}

protected void btnSubmit_Click(object sender, EventArgs e)
{
Page.Validate("EditProfile");
if (Page.IsValid)
{
Propertywala.User user =
(Propertywala.User)Session[Propertywala.Constants.CommonConsts.USER_SESSION_N AME];
user.MiddleName = tbMiddleName.Text;
user.DateOfBirth = tbDate.Text;
user.IsUserMale = false;
if (rblGen.SelectedValue == "1")
{
user.IsUserMale = true;
}
user.TelephoneIsd = tbTelIsd.Text;
user.TelephoneLocal = tbTelLcl.Text;
user.TelephoneStd = tbTelStd.Text;
user.MobileIsd = tbMobIsd.Text;
user.MobileLocal = tbMobLcl.Text;

user.AddressStreet1 = tbStr1.Text;
user.AddressStreet2 = tbStr2.Text;
user.HomeAddress = new Propertywala.Address();
user.HomeAddress.Country = ddlCountry.SelectedValue;
if (string.Compare(user.HomeAddress.Country, "In", true) == 0)
{
user.HomeAddress.StateId = long.Parse(ddlStt.SelectedValue);
if (ddlCti.SelectedValue.Length 0)
{
user.HomeAddress.CityId = long.Parse(ddlCti.SelectedValue);
}
if (ddlLocal.SelectedValue.Length 0)
{
user.HomeAddress.LocalityId = long.Parse(ddlLocal.SelectedValue);
}
user.HomeAddress.City = tbCity.Text;
user.HomeAddress.Locality = tbLcl.Text;
user.HomeAddress.Pin = tbPin.Text;

}
else
{
user.HomeAddress.State = tbState.Text;
user.HomeAddress.City = tbCity.Text;
user.HomeAddress.Locality = tbLcl.Text;
user.HomeAddress.Pin = tbPin1.Text;
}

user.updateUserData();
lblMessage.Text = Propertywala.Common.CreateWarning("Profile Updated");
Response.Redirect("../User/Profile.aspx?view=ext");
}
}
protected void ddlCountry_DataBound(object sender, EventArgs e)
{
Propertywala.User user =
(Propertywala.User)Session[Propertywala.Constants.CommonConsts.USER_SESSION_N AME];
bool chkNull = Convert.IsDBNull(user.HomeAddress.Country);
if (!chkNull)
{
ddlCountry.Items.FindByValue(user.HomeAddress.Coun try).Selected = true;
}
VisibleInputFields();
}

protected void ddlStt_DataBound(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
bool isIndian = false;
if (ddlCountry.SelectedItem.Text == "India")
{
isIndian = true;
}
Propertywala.User user =
(Propertywala.User)Session[Propertywala.Constants.CommonConsts.USER_SESSION_N AME];
bool chkNull = Convert.IsDBNull(user.HomeAddress.State);
if (!chkNull && isIndian)
{
ddlStt.SelectedIndex = -1;
ListItem state = ddlStt.Items.FindByText(user.HomeAddress.State);
if (state != null)
{
state.Selected = true;
}
else
{
tbState.Text = user.HomeAddress.State;
tbState.Visible = true;
}
}
ListItemCollection licLocal =
Propertywala.Address.GetLocalCollection(long.Parse (ddlStt.SelectedValue),
true, "City");
foreach (ListItem li in licLocal)
{
ddlCti.Items.Add(li);
}
chkNull = Convert.IsDBNull(user.HomeAddress.City);
if (!chkNull && isIndian)
{
ddlCti.SelectedIndex = -1;
ListItem city = ddlCti.Items.FindByText(user.HomeAddress.City);
if (city != null)
{
city.Selected = true;
ddlCti.DataBind();
licLocal =
Propertywala.Address.GetLocalCollection(long.Parse (ddlCti.SelectedValue),
true, "Locality");
foreach (ListItem li in licLocal)
{
ddlLocal.Items.Add(li);
}
chkNull = Convert.IsDBNull(user.HomeAddress.Locality);
if (!chkNull && isIndian)
{
ddlLocal.Visible = true;
ddlLocal.SelectedIndex = -1;
ListItem local =
ddlLocal.Items.FindByValue(user.HomeAddress.Locali tyId.ToString());
if (local != null)
{
local.Selected = true;
ddlLocal.DataBind();
}
else
{
tbLcl.Text = user.HomeAddress.Locality;
tbLcl.Visible = true;
ddlLocal.SelectedIndex=ddlLocal.Items.Count-1;

}
}
}
else
{
tbCity.Text = user.HomeAddress.City;
tbCity.Visible = true;
tbLcl.Text = user.HomeAddress.Locality;
tbLcl.Visible = true;
ddlLocal.Visible = false;
ddlCti.SelectedIndex = ddlCti.Items.Count - 1;
}

}

}

}
protected void ddlCountry_SelectedIndexChanged(object sender, EventArgs e)
{

VisibleInputFields();
}

protected void ddlStt_SelectedIndexChanged(object sender, EventArgs e)
{
ddlCti.Visible = true;
tbCity.Visible = false;
ddlCti.Items.Clear();

ListItemCollection licLocal =
Propertywala.Address.GetLocalCollection(long.Parse (ddlStt.SelectedValue),
true, "City");
foreach (ListItem li in licLocal)
{
ddlCti.Items.Add(li);
}
}
protected void ddlCti_SelectedIndexChanged(object sender, EventArgs e)
{
ddlLocal.Items.Clear();
if (ddlCti.SelectedValue.Length 0 && ddlCti.SelectedValue != "0")
{
ListItemCollection licLocal =
Propertywala.Address.GetLocalCollection(long.Parse (ddlCti.SelectedValue),
true, "Locality");
foreach (ListItem li in licLocal)
{
ddlLocal.Items.Add(li);
}
ddlLocal.Visible = true;
tbLcl.Visible = false;
tbCity.Visible = false;
}
else
{
ddlLocal.Visible = false;
tbLcl.Visible = true;
if (ddlCti.SelectedIndex 0)
{
tbCity.Visible = true;
}
}
tbLcl.Text = "";
tbPin.Text = "";
tbPin1.Text = "";
}
protected void ddlLocal_SelectedIndexChanged(object sender, EventArgs e)
{
tbLcl.Visible = false;
if (ddlLocal.SelectedValue.Length < 1 || ddlLocal.SelectedValue == "0")
{
if (ddlLocal.SelectedValue == "0")
{
tbLcl.Visible = true;
}
tbPin1.Text = "";
tbPin.Text = "";
}
else
{
tbPin1.Text =
Propertywala.Address.GetPincode(long.Parse(ddlLoca l.SelectedValue));
tbPin.Text = tbPin1.Text;
}
}
private void VisibleInputFields()
{
bool isIndian = false;
if (ddlCountry.SelectedItem.Text == "India")
{
isIndian = true;
}
tbState.Visible = (!isIndian);
ddlStt.Visible = isIndian;
ddlCti.Visible = isIndian;
ddlLocal.Visible = isIndian;
tbPin.Visible = isIndian;
tbPin1.Visible = (!isIndian);
if (!isIndian)
{
tbLcl.Visible = true;
tbCity.Visible = true;
}
if (Page.IsPostBack)
{
ddlStt.SelectedIndex = -1;
ddlLocal.Visible = false;
ddlCti.Visible = false;
tbLcl.Text = "";
tbCity.Text = "";
tbPin.Text = "";
tbPin1.Text = "";
tbStr1.Text = "";
tbStr2.Text = "";
tbState.Text = "";
}
}

}
Apr 6 '07 #5

P: n/a
Hi all,

I m using asp.net 2.0 version and want to retrieve the particular string
from resource file dynamically... Following is the my code ... but in this
every time I get exception that resource key not found... ... might be
possible as i think that resource file which is being loaded is not fund ...
plz suggest me how to find the base name of project so that the resource file
will be loaded .....

using System;
using System.Resources;
using System.Reflection;

namespace ResourcesDemo
{
/// <summary>
/// Class for resource retrival
/// </summary>
public class ResourceText
{
private ResourceText()
{}

private static ResourceManager _resourceManager;

//Following method will be called from Global.asax Application_Start

public static void InitializeResources() //
{
string gg = Assembly.GetExecutingAssembly().FullName;
Assembly assembly = Assembly.GetExecutingAssembly();
_resourceManager = new ResourceManager("ResourcesDemo.TextRes",
assembly);
_resourceManager.IgnoreCase = true;
}

public static string GetString(string key)
{
string gg = Assembly.GetExecutingAssembly().ToString();
try
{
string s = _resourceManager.GetString( key );
if( null == s ) throw(new Exception());
return s;
}
catch
{
//for resource key not found
return String.Format("[?:{0}]", key);
}
}
}
}

// resource schema...
...
<data name="EMPLOYEE">
<value>Employee</value>
</data>
<data name="DELETE_EMPLOYEE_CONFIRMATION">
<value>Are you sure you want to delete this employee?
Doesn't matter it will be deleted any way...</value>
</data>
...
Reply soon …
Thanks for giving me your time

Jun 12 '07 #6

This discussion thread is closed

Replies have been disabled for this discussion.