Showing posts with label instead. Show all posts
Showing posts with label instead. Show all posts

Wednesday, March 28, 2012

AJAX Beta 1 has forced my pages to US Date format !

Since adding AJAX Beta 1 to my PC all my IIS sites are now showing and requiring dates in MM/dd format instead of dd/MM as they were before.

I have tried:

<globalization culture="en-NZ" uiCulture="en-NZ"/> in by config file and set each page to the same.

Anyone else know why this is and how I can get around this issue ?

Thanks

Matthew Hill

hello.

hum...strange...atals used to have some globalization support but in only influenced client side locale methods. how are you putting the dates on the pages?


I have FormView & GridView controls that display various data from a database. The queries to the database returns the dates as Date fields as per normal but since adding AJAX Beta 1 and the corresponding AJAX Toolkit the dates are showing as MM/dd/yyyy. I set the locale to en-NZ in every page and in the global settings but still they are showing wrong. I also checked my locale settings.

Is it possible that something may be corrupt in the website?

Mat


hello.

though i'm no globalization expert, i think that the problems you're facing are related with ASP.NET and not AJAX extensions. It's really strange that it only has affected your app after adding the extensions...does removing the extensions solve the issue?


Thanks for your reply.

I have tested copying it to another server with AJAX and the dates are around the right way. I still can't figure out why none of the settings are changing the dates back to en-NZ. If I view the site from another PC it is around the wrong way. Argggghhh.

Mat


hello.

quick question: are you pages configured to use localization? if so, are they configured so that they get the values from the browser? if that is tru, then what might be happening is that the browser may be using US culture by default and sending that info back to the site...


I have checked and can't find a US date setting anywhere in IIS, IE7, Regional Settings, Visual Studio, Ajax, Ajax Toolkit. I'm hoping it's not gettings it's settings from the system's Regional properties (the ones created during Windows install) as I don't know how to change them. Also I don't know why they have only just started to effect IIS.

If you visit my website from another PC it shows in US format too, so it is definately an IIS issue.'

Mat


I have checked and can't find a US date setting anywhere in IIS, IE7, Regional Settings, Visual Studio, Ajax, Ajax Toolkit. I'm hoping it's not gettings it's settings from the system's Regional properties (the ones created during Windows install) as I don't know how to change them. Also I don't know why they have only just started to effect IIS.

If you visit my website from another PC it shows in US format too, so it is definately an IIS issue.'

Mat


In ScriptManager's element try to add attribute EnableScriptGlobalizationwith value false:

<atlas:ScriptManagerrunat="server"ID="scriptManager"EnableScriptGlobalization="false"EnablePartialRendering="true"/>

Probaly it's because of your preffered languages in IE7 (as rule there is "English [en-us]").

Monday, March 26, 2012

Ajax auto complete extender

I am using ajax autocompleteextender. I have declared the service method in the user control itself instead of declaring it in aspx page. But the extender does not work .How can i do it? I want to declare it in ascx page,as i will be reusing the component.

my master page script
=====================
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true" EnablePartialRendering="true"/asp:ScriptManager
my aspx page where i am inheriting masterpage
==============================================

<%@. Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="frmTestAuto.aspx.cs" Inherits="frmTestAuto" Title="Untitled Page" %>
<%@. Register src="http://pics.10026.com/?src=ctlAutoExtender.ascx" TagName="ctlAutoExtender" TagPrefix="uc1" %>
<%@. Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<asp:ScriptManagerProxy ID="ScriptManagerProxy1" runat="server" /asp:ScriptManagerProxy>
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td>TEST AUTO PAGE</td>
</tr>
<tr>
<td>uc1:ctlAutoExtender ID="CtlAutoExtender1" runat="server" /</td>
</tr>
<tr>
<td>Footer</td>
</tr>
</table>
</asp:Content
my ascx page
=============
<%@. Control Language="C#" AutoEventWireup="true" CodeFile="ctlAutoExtender.ascx.cs" Inherits="ctlAutoExtender" %>
<%@. Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<asp:ScriptManagerProxy ID="ScriptManagerProxy1" runat="server"></asp:ScriptManagerProxy>
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td>
<asp:TextBox runat="server" ID="myTextBox" Width="300" />

<ajaxToolkit:AutoCompleteExtender runat="server" ID="autoComplete1" TargetControlID="myTextBox" Enabled="true"
ServiceMethod="GetCompletionList" ServicePath="ctlAutoExtender.ascx.cs" MinimumPrefixLength="3"
CompletionInterval="1000" EnableCaching="true"
CompletionSetCount="12"/>
</td>
</tr>
</table
my ascx.cs page
===============

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 System.Data.SqlClient;
using System.Web.Services;
using System.Web.Script.Services;

[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[ScriptService]

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

}

[WebMethod]
[ScriptMethod]
public static string[] GetCompletionList(string prefixText, int count)
{
string sql = String.Format("select clt_tVLongNm from mclient where clt_tVLongNm like @.companyname + '%'");

List<string> companyList = new List<string>();

using (SqlConnection connection = new SqlConnection("server=192.168.2.57;uid=sa;pwd=d28rg6yp;database=fnocash_report"))

using (SqlCommand command = new SqlCommand(sql, connection))
{
connection.Open();
command.Parameters.AddWithValue("@.companyname", prefixText);
using (SqlDataReader reader = command.ExecuteReader())
{
while (reader.Read())
{
companyList.Add(reader.GetString(0));
}
}
}
return companyList.ToArray();
}
}

please help me out asap


Hi,

In ASP.NET, a request for a .ascx file will be?handled?by?System.Web.HttpForbiddenHandler?HttpHandler,?that's?to?say,?it's?refused.
So you can't use a method in the UserControl, I suggest trying to use a web service(.asmx) to achieve this.
Hope this helps.

Hi,

I am declaring the autocompleteextender in the user control. So, should I give service path for the extender as .asmx file in the extender?

eg:

My ascx page:

<%

@.ControlLanguage="C#"AutoEventWireup="true"CodeFile="ctlAutoExtender.ascx.cs"Inherits="ctlAutoExtender" %>

<%

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

<

tablecellpadding="0"cellspacing="0"border="0"width="100%"><tr><td><asp:TextBoxrunat="server"ID="myTextBox"Width="300"/>

<ajaxToolkit:AutoCompleteExtenderrunat="server"ID="autoComplete1"TargetControlID="myTextBox"Enabled="true"ServiceMethod="GetCompletionList"ServicePath="App_Code/WebService.cs"MinimumPrefixLength="3"CompletionInterval="1000"EnableCaching="true"CompletionSetCount="12"/></td></tr>

</

table>


Yes,?like?this:??ServicePath="the relative path of the .asmx file"
Thanks, that solved my problem.

Saturday, March 24, 2012

AJAX and web server controls

Please some one explain me the following in ajax.

1) Is it necessary that I have to use html controls instead of web server control in order to support AJAX in my web page?. (I know we can use Magic AJAX – penal control to do the same. But I don't want to use any third party component or library).

2) As per my understanding in AJAX like technology I can send some information to the server and I can get some info from the server based on the info sent. But if I want to add a new row to my web server datagrid control. How can we do this with AJAX. I mean if I add a blank row to my collection class then how will I reflect that in UI.

3) Is there any simple code sample available in the net that demonstrates the web server control manipulation with AJAX.

Hi,

you can use normal web controls when you use Atlas, which is the AJAX implementation/framework from Microsoft.

For more information and quickstartsplease take a look here.

Grz, Kris.