ラベル guys の投稿を表示しています。 すべての投稿を表示
ラベル guys の投稿を表示しています。 すべての投稿を表示

2012年3月28日水曜日

Response.redirect - display text in same page.

Hi guys,

I am using A.aspx , B.aspx and C.aspx pages.

From A.aspx I am calling b.aspx via Ajax code. After (Check Login user from database) success status , I am tryint o redirecting to C.aspx. But

C. aspx page content is dispalying in A.aspx. It suppose to be redirec to C.aspx. What I am dong wrong here..??

any suggessions ??

hello.

well, i'mo not following you. can you be more specific?


I am trying to check the Loginuser permissions from the Database. Once he get success permission the page has to redirect to new page.
here is my Code.

Login.aspx (a.aspx) - Enter user id & pwd and click Submit then below code executes


function CheckUser()
{
if (preLoginCheck())
{ var url = serverName+"checkLogUser.aspx?userID="+ document.frmDefault.txtUid.value +"&Pwd="+ document.frmDefault.txtPwd.value;
xmlHttp = GetXmlHttpObject(ChangeHandler);
xmlHttp_Get(xmlHttp, url);
}
}


function ChangeHandler()
{ if (xmlHttp.readyState == 4 || xmlHttp.readyState == 'complete')
{ var getData=xmlHttp.responseText;
if (getData=="Success")
{ document.getElementById("ErrorCode").innerText=" GoooooooooooooooD";
}
else
{
document.getElementById("ErrorCode").innerText=getData; //" Invalid User name /Password";
}
}
}

checkLogUser.aspx (b.aspx) - Ajax will execute this page from here itself I want to redirec to Third Page..


If (tmpUserID <> "" And tmpUserPwd <> "") Then
crapObj = New CRAPManagement
getLogInStatus = crapObj.checkLoginUserAccess(tmpUserID, tmpUserPwd)
If getLogInStatus = "Success" Then
Response.Redirect("UserCreate.aspx") --> C.Aspx
Else
Response.Write(getLogInStatus)
End If
End If

Finanl result is C.Aspx page content is displaed in Login.aspx Page.


hello.

well, if you're using asp.net 2.0, then check the authenticationservice class:

http://www.asp.net/ajax/documentation/live/ClientReference/Sys.Services/AuthenticationServiceClass/default.aspx


Hello,
I could't understand wha should I do exactly...!


hello.

well, instead of writing your own code for making the remote call and then having to build your page on the server that has server logic for authenticating a user, you'll get that for free with the service i've showed you in the previous post (it'll authenticate by using forms authentication and it'll automatically use the current defined membership provider you've set up on the server side).

2012年3月26日月曜日

Response.redirect causing error when used with ajax

Hi Guys,

I hope somebody can help me with my problem, I'm fairly new to ajax.I have a datalist in my app which has a clickable button which directs the user to a subroutine....


1Sub PhotoCommand(ByVal objAs Object,ByVal EAs DataListCommandEventArgs)2Dim CommandAs String = E.CommandName3Dim ArgumentAs String = E.CommandArgument45If Session("UserID")Is Nothing Then6 Response.redirect("index.aspx")7End If8End Sub


This works fine when not in a updatepanel and the updatepanel worksfine without the redirect in it, but when you use the two together andclick the button you get the following error in an alert box.

"Sys.Webforms.PageRequestManagerParserErrorException:The message received from the server could not be parsed. Common causesfor this error are when the response is modified by calls toresponse.write(), response filters, HttpModules or server trace isenabled

Details:Error parsing near'

<!DOCTYPE ht'"

Anyone got any idea why this might be ?

Jon

Hi,

Sorry guys, just found out what the problem was by searching the forum a bit more. FOr the sake of anyone else with the same problem, I had forgotten to add the following to my web.config...

<httpModules>

<addname="ScriptModule"type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

</httpModules>

return alert msg on ajax call

Hello guys

Quick question. Scenario: I have a update button that does an AJAX call and updates DB. I want to return a success/failure message such that it shows up as an alert message box on UI rather than showing a lblMessage and updating its visiblity and text property. Any suggestions?

Thanks in advance.

Hi There,

Try following:

protectedvoid Button1_Click(object sender,EventArgs e)

{

// Alert with messagebox after callback

// Your process here e.g. add/edit/delete from database and etc

// Assume your process take 5 second to complete

System.Threading.Thread.Sleep(5000);

// Build your alert script

StringBuilder sbScript =newStringBuilder();

sbScript.Append("<script language='JavaScript' type='text/javascript'>");

sbScript.Append("alert('hello world!')");

sbScript.Append("</script>" );

// Make use ScriptManager to register the script

ScriptManager.RegisterStartupScript(this,this.GetType(),"@.@.@.@.MyCallBackAlertScript", sbScript.ToString(),false);

}


Hi,

You can write a javascript function taking a string parameter on your page having an alert function call displaying the message in the parameter. I have posted a similar solution in this forum. You can have a look at that. I hope you find it useful. It is at http://forums.asp.net/t/1122462.aspx .

If you have any problem in that, let us know.



Thanks for this d4dennis..it worked..but I am not happy man yet. I have two questions..first, on postback is this still sitting on the client page. If so, is there any chance it might called again unwantedly?

Second, I was hoping to trap the Sys object of ajax. I have seen that when there is an exception thrown, it shows up as an alert message on screen. I want to somehow be able to trap that guy. Any ideas there? sorry for being so picky but that's what I want.

This works and right now to continue, I am using this. thanks again.


Hi There,

This is the solution i can think of.

tinuverma:

First, on postback is this still sitting on the client page. If so, is there any chance it might called again unwantedly?

THIS WILL NOT POP UP ON POSTBACK

tinuverma:

Second, I was hoping to trap the Sys object of ajax. I have seen that when there is an exception thrown, it shows up as an alert message on screen. I want to somehow be able to trap that guy. Any ideas there? sorry for being so picky but that's what I want.

IM NOT SURE THIS IS ACHIEVEABLE, IF SOMEONE HAVE ANY IDEA. ANYWAY, YOU CAN RAISE THIS AS ANOTHER QUESTION.

2012年3月24日土曜日

Returning Values with DynamicPopulateExtender

Hi guys,I need to update two different values on a page, which I'd like to calculate at the same time (Monthly Value and Annual Value). Is it possible to get DynamicPopulateExtender to return two values for different controls?It's not a simple case of *12 for Annual value, and it would really reduce processing time if I could calculate both at the same time.Andi

From what I understand, I don't think so. What about just using two UpdatePanels?

2012年3月21日水曜日

Rounded Corners Fetaure Suggestion

Hey guys/girls/people,

The controls are great - I have a feature suggestion for the Rounded corners...

TopVisible - Boolean - show/hide the top div

BottomVisible - Boolean - show/hide the bottom div

TopText - String - Text to be shown in the top rounded div

TopCssClass - String - cssclass to be used to style the top text

This would allow you to create sidebar panels like they use in the community server...

http://communityserver.org/Default.aspx

Cheers!!

Andrew

Hey!,

This is a great idea, i have the same feature, specially the TopText String Property...

Bye!, Moisés.

rouf:

Hey!,

This is a great idea, i have the same feature, specially the TopText String Property...

Bye!, Moisés.

Have another question... Why when I use a Atlas Update Panel near a Rounder Corners Extender the corners split in various lines?, something like this :
______
__________
_______________

Sorry for my eng...

This is a good idea. Could you please file a feature request at

http://www.codeplex.com/WorkItem/List.aspx?ProjectName=AtlasControlToolkit

Thanks!


This bug is already fixedBig Smile

roundedcorners postback flicker

Hey guys.

I have a formview within a panel. Everything works great and when adding a post the screen wont flicker and the post is viewable in the panel immediately.

I recently tried to apply an ajax roundedcorners tool on the panel and it works but the screen flickers at every postback. Is there a way around this?

Could you post some sample code that reproduces the issue? I tried it out but perhaps I am missing something.

<asp:ScriptManagerrunat="server"></asp:ScriptManager><asp:PanelID="Panel1"runat="server"Width="330px"BackColor="Blue"><asp:FormViewrunat="server"ID="EmployeeFormView"AllowPaging="True"DataSourceID="ObjectDataSource1"></asp:FormView><asp:ObjectDataSourceID="ObjectDataSource1"runat="server"DeleteMethod="Delete"InsertMethod="Insert"OldValuesParameterFormatString="original_{0}"SelectMethod="Select"TypeName="SessionTodoXmlDataObject"UpdateMethod="Update"><DeleteParameters><asp:ParameterName="Original_ItemID"Type="Int32"/></DeleteParameters><UpdateParameters><asp:ParameterName="Title"Type="String"/><asp:ParameterName="Description"Type="String"/><asp:ParameterName="Priority"Type="Int32"/><asp:ParameterName="Original_ItemID"Type="Int32"/></UpdateParameters><InsertParameters><asp:ParameterName="Title"Type="String"/><asp:ParameterName="Description"Type="String"/><asp:ParameterName="Priority"Type="Int32"/></InsertParameters></asp:ObjectDataSource></asp:Panel><cc1:RoundedCornersExtenderID="RoundedCornersExtender1"runat="server"BehaviorID="RoundedCornersBehavior1"TargetControlID="Panel1"Radius="10"Corners="All"/><asp:Buttonrunat="Server"Text="Postback"/>