Showing posts with label provided. Show all posts
Showing posts with label provided. Show all posts

Wednesday, March 28, 2012

AJAX Beginner HELP!!

I checked out the instructional videos provided on this site for the Microsoft AJAX but it is all for the ATLAS release.

Take for example here is some of the code that I have from one of the videos

<%

@dotnet.itags.org.PageLanguage="VB"AutoEventWireup="false"CodeFile="Default.aspx.vb"Inherits="_Default" %>

<%

@dotnet.itags.org.RegisterAssembly="Microsoft.Web.Atlas"Namespace="Microsoft.Web.UI"TagPrefix="atlas" %>

<%

@dotnet.itags.org.RegisterAssembly="AtlasControlToolkit"Namespace="AtlasControlToolkit"TagPrefix="atlastoolkit" %>

<!

DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<

htmlxmlns="http://www.w3.org/1999/xhtml">

<

headrunat="server">

<

atlas:ScriptManagerID="PageScriptManager"runat="server"EnablePartialRendering="True"/>

<

atlastoolkit:HoverMenuExtenderID="HoverMenuExtender1"runat="server"><atlastoolkit:HoverMenuPropertiesTargetControlID="btnProduct"PopupControlID="PanelPopUp"PopupPosition="Left"PopDelay="25"/></atlastoolkit:HoverMenuExtender>

<

title>Untitled Page</title>

<

styletype="text/css">

/*Hover Menu*/

.popupMenu

{position:absolute;visibility:hidden;background-image:url(images/header.png);opacity:.9;filter:alpha(opacity=90);

}

.popupHover

{background-image:url(images/header-opened.png);background-repeat:repeat-x;background-position:lefttop;background-color:#F5F7F8;

}

</

style>

</

head>

<

bodystyle="text-align: left"><formid="form1"runat="server"><br/><table><tr><tdstyle="width: 80px"><asp:PanelID="PanelPopUp"runat="server"Width="80"BackColor="white"CssClass="popupMenu"><asp:LinkButtonID="BtnUpdate"runat="server"CausesValidation="True"CommandName="Update"Text="Update"></asp:LinkButton> <br/><asp:LinkButtonID="BtnDelete"runat="server"CausesValidation="False"CommandName="Cancel"Text="Delete"></asp:LinkButton> </asp:Panel></td><tdstyle="width: 100px"><asp:LinkButtonID="btnProduct"runat="server"Width="273px">Product Number One</asp:LinkButton></td></tr></table></form>

</

body>

</

html>

Now the big issue is I just installed the new Beta 2 I do not have the ATLAS installed. I do not get any options for AJAX controls or code and I created a new website using the option for "ASP.NET AJAX-Enabled Web Site"

Please tell me what is going wrong do I need to uninstall and reinstall everything.

Also I am using the Visual Studio Express Web

Thank you for any help you can provide on this

hello.

1st, the ajax extensions have changed the prefix name used...there's a breaking change document which explains this on the ajax.asp.net site

you should also note that you need to download the toolkit pack from codeplex in order to use it...

Saturday, March 24, 2012

AJAX and Membership API

Hi All,

I have grown fed up with the restrictions placed on using the Login Controls provided by VWD, so I've decided to build my own controls and then call on the membership API class to insert records. I mainly did this to allow my application to use AJAX on the login features, but I have run into a problem.

Here is the code for my problem:

 
"ScriptManager1" runat="server" /> "UpdatePanel1" runat="server"> "Button1" runat="server" Text="Button" OnClick="Button1_Click" /> "LoginName1" runat="server" /> "msg" runat="server" Text="Label"> "LoginStatus1" runat="server" />

It is a simple page that has a login button, and when you click the button it runs this code:
protected void Button1_Click(object sender, EventArgs e) {if (Membership.ValidateUser("Brainify","BrainifyPassword")) { FormsAuthentication.SetAuthCookie("Brainify",true); msg.Text ="Login success!!!. Please check your user name and password and try again."; }else { msg.Text ="failed"; } } }

The code will try to validate a user (hardcoded) that I've put into the database. And if successful it will cause the msg label to change text. That works fine. But I would also like it change the the loginname control. This is all done through AJAX.

The problem is when I click on the button once, it validates and it changes the msg label to what I want. How the login name control never appears. I actually have to click on the button ONE more time to get the login name control to display the username! I have NO Idea what is going on...it appears AJAX is working, but I don't know why I have to click the button twice for everything to appear.

Any help would be greatly appreciated.Hi,

This is because the LoginName is determined by the current request's?user identity. When you click the button to login, the request?still doesn't contain a valid UserName.
The value can only be retrieved in the requests after this. So that an additional click is required.

You can use?Sys.Services.AuthenticationService to authenticate on the client before a postback happens.
Like this:

<"Button1" runat="server" Text="Button"?OnClientClick="javascript function that invokes Sys.Services.AuthenticationService" OnClick="Button1_Click" /
Hope this helps.