Showing posts with label user. Show all posts
Showing posts with label user. Show all posts

Monday, March 26, 2012

Instant Update Panel

I have a page on my site that displays one image, the user can post a comment about the image and rate it from 1-5 using the ajax rating control. The page entire page postbacks when the user posts a comment about the image. I am trying to get the comments gridview to postback on its own. The rating control and comment text box and gridview of comments is in a usercontrol. I put it on my photo.aspx page and then put it in an updatepanel. The user now can add a comment (and it does add) but the page still needs to be reloaded how to do you it to instantly update for new comments? Ive seen this on facebook if anyone is wondering where the influence for trying to do this is, can anyone recomend how to do this? thanks in advance ! si!

Throw your code here and let me see..


it took about an hour but it makes sense now! after the comment has been posted, I get it to reset the gridviews datasource and then databind it! haha, thanks thoughBig Smile si!

Saturday, March 24, 2012

Invalid Callback Or Postback Argument

I wrote an ASP.NET 2.0 web page, which populates a drop down list according to the user input values. I put the drop down list into an AJAX UpdatePanel, which is triggered by some server controls. But when I try to run it, the following error prompts out:

Invalid postback or callback argument. Event validation is enabled using <pages enableeventvalidation="true" /> in configuration or <%@dotnet.itags.org. page enableeventvalidation="true" %> in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.

Anybody knows how to solve it?

hello.

can you build a small demo page that reproduces this problem and put it here?

thanks.

Invalid postback or callback arguement?

Hey, i have a page with a gridview in an update panel, which has a triggered by the user clicking button1, the gridview has a row_command that deletes the data in the gridview, the code worked fine before i added the update panel, but now i tested my page again, i clicked button1, and then tryed to delete the new item in the gridview.

I got the error message "Event validation is enabled using <pages enableEventValidation="true"/> in the config or in the page head.

My page head bit reads :

<%@dotnet.itags.org. Page Language="C#" MasterPageFile="MasterPage.master" EnableEventValidation="true" AutoEventWireup="true" Inherits="Masters_Default2" Title="Untitled Page" %>

But i still get the error,... where am i going wrong? thanks Si!

Have a look at this blog:http://blogs.msdn.com/amitsh/archive/2007/07/31/why-i-get-invalid-postback-or-callback-argument-errors.aspx

-Damien


Make it false and then try...

Let me know what happend

Invalid postback or callback argument on page back

Hello,

I ran into this by placing myselft as the final user of my web application.

I have several pages using AJAX controls (update panel, autocomplete extender, etc), and I noticed that when I have redirect to another page, and till there, using the IE back page button, the previous page is loaded and then a message error is prompt (Invalid postback or callback argument)

By now I'm disabling the - PageEventValidation - but, actually I'd like to solve it in a better way.

Thanks in advance guys,

Hi Manotas,

Do you have databound controls, like a DropDownList or a GridView? If so, did you make sure they are initialized in a block that checks for inital page load?

For example:

if (false == Page.IsPostBack)

{

// code for initial load goes here

}

else

{

// code for PostBack from same page goes here

}

Pete


Hi Peter,

Thanks for reply.
I do have bound control. After reading at your post, I checked the initialization of my databound controls.
I realized that there is a gridview which I am initializing at first loading but not during postbacks, however, when the page is reload by using the back button on the browser, there is a postback and maybe is there where is my error. The thing is that I'm not sure what kind of validation I could do there since I wouldn't like to change the data of the parameters used on the select's datasource ...

I tried to find a pattern on the error... I must correct what I said about the invalid postback after the page's loading. In fact, I realized that it was happening only sometimes, and only when I was clicking on certain linkbuttons, on the other side, if I click on others buttons I was not having any problem at all. Also, as you mentioned the fact of look at databoud controls, I began testing and I found that I was getting the error only when I was turning back to the page and my gridview was visible (I'm using a multiview control, and the gridview I mentioned above is contained in its view).

By now, I restored the PageEventValidation and added at the update panel a postback trigger for the controls which are making visible my gridview.

Since I'm not receving the error message anymore... let's see I'l heard about it later...

Cheers

Invoke an exe file on server side

I created a page with a button. The user presses this button and it is supposed to invoke an exe file that works on the server side. I tried the following code behind:

Label2.Text ="The bot began it's work. Pleas wait..."Dim startInfo As System.Diagnostics.ProcessStartInfoDim pStart As New System.Diagnostics.ProcessstartInfo = New System.Diagnostics.ProcessStartInfo("http://.../files/BotScript1.exe")pStart.StartInfo = startInfopStart.Start()pStart.WaitForExit()Label2.Text = "The bot has finished it's work"

My problem is that this doesn't work on the server side: Pressing the button asks the user if he wants to open the file. I want this file to work on the server.

If this can't be done for security reasons (I don't see why not - this file has nothing to do with the user, but is part of the server script), I would like to use the source code of this exe file and run it on the server. The problem doing it this way is that the script is in c# and my pages are in VB.NET.

Thanks
Yoni

If the .exe is on your web server, try using Server.MapPath in the ProcessStartInfo() to get the actual file location, instead of the HTTP (virtual) location.


doyleits:

If the .exe is on your web server, try using Server.MapPath in the ProcessStartInfo() to get the actual file location, instead of the HTTP (virtual) location.

I tried that, and the exe runs, but as a diff problem came up, I decided to put the source code in my code behind page. I now face a new problem:

I have created a listbox inside an update panel, but when I use the code behind to add items to the listbox (in order to notify the user whats going on) - they added items don't appear until the server is done with the code. How can I get the listbox to refresh itself every time I add/remove/edit items from it?

Thanks,
Yoni


Put the ListBox inside UpdatePanel. Also set the UpdateMode property toConditional

When items will be added/deleted call UpdatePanel1.Update()

http://www.asp.net/ajax/documentation/live/mref/M_System_Web_UI_UpdatePanel_Update.aspx


chetan.sarode:

Put the ListBox inside UpdatePanel. Also set the UpdateMode property toConditional

When items will be added/deleted call UpdatePanel1.Update()

http://www.asp.net/ajax/documentation/live/mref/M_System_Web_UI_UpdatePanel_Update.aspx

I did as you said: I added a UpdateMode="Conditional" property to the Update Panel and used the Update() function after every change I did to the list - but still nothing. Any ideas?

Thanks
Yoni


Hi Yoni,

I recommend copying those source code into a class library. And reference the assembly in your web application. It's better than changing security settings.

After the class library has been compiled into an assembly, it can be used regardless of what language it's written in.


Sorry, I didn't notice that you've solved the running exe issue.

yonidebest:

I tried that, and the exe runs, but as a diff problem came up, I decided to put the source code in my code behind page. I now face a new problem:

I have created a listbox inside an update panel, but when I use the code behind to add items to the listbox (in order to notify the user whats going on) - they added items don't appear until the server is done with the code. How can I get the listbox to refresh itself every time I add/remove/edit items from it?

Thanks,
Yoni

I think you can add a timer on the page to refresh the page at a specific interval.

Invoking javascript routine on dropdown change

I'm trying to implement a ASP.NET 2.0/Ajax page where a client-side javascript routine is invoked when the user changes the value of a dropdown list. The dropdown list is populated in the Page_Load event.

In the aspx file, I declare the drop down as:

<asp:DropDownList ID="cbIDs" runat="server"OnSelectedIndexChanged="idChanged()" >

Visual Studio complains about "'idChanged' is not a member' of the page.

I've tried searching Google and ASP.Net but haven't been able to find an example on how to do this. Can someone please help me out?

Thanks,

Richard

onselectedindexchanged is a server side event. That is not the right place to hook in client-side code.

Doing the searchhttp://www.google.com/search?q=asp.net+dropdownlist+javascript

brings me the first article at: http://weblog.vb-tech.com/nick/archive/2005/03/25/607.aspx

which shows how to add the onchange attribute to your drop down list. There you can hook in a client side event. Be careful to make sure you fire both client-side and server-side events if you need to.

--JJ


richardr:

OnSelectedIndexChanged="idChanged()" >

richardr:

Visual Studio complains about "'idChanged' is not a member' of the page.

OnSelectedIndexChanged is a server side event... so compiler would try to findidChanged()handler in code behind which is not there..

you need to useOnChange event instead of OnSelectedIndexChanged.


a sample code below:

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
<script type="text/javascript" language="javascript">
function idChanged()
{
alert("on change event...");
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:DropDownList ID="DropDownList1" runat="server"onchange="idChanged()">
<asp:ListItem Text="1" Value="1" />
<asp:ListItem Text="2" Value="2" />
<asp:ListItem Text="3" Value="3" />
<asp:ListItem Text="4" Value="4" />
<asp:ListItem Text="5" Value="5" />
</asp:DropDownList>
</div>
</form>
</body>
</html>

Invoking postback for an update panel in a parent document

The default page for my website contains a div with links to user data that is only visible when a user is logged into my site. The login control lives in an IFrame within the default page (see sample code below).

Now, how can I get the udpate panel on the default page to recognize an event or a button click inside of the login control? I'm not looking for a tutorial on getting the login control to work, but rather any link button inside of the IFrame's update panel forcing the default page's update panel to post back. Both pages have a script manager.

chopped down version of existing code:

dafault page:

1<asp:update panel id="upUserPrefs" runat="server" updatemode="conditional">2 <contenttemplate>3 <div id="userPrefs" runat="server"><a href="prefs.aspx">preferences</a></div>4 </contenttemplate>5</asp:update panel>

IFrame source page:

1 <asp:UpdatePanel ID="updateSignon" runat="server" UpdateMode="conditional">2 <ContentTemplate>3 <asp:Table ID="tblLoginCtrl" runat="server" visible="false" Width="100%" HorizontalAlign="Left" CellPadding="0" CellSpacing="0">4 <asp:TableRow>5 <asp:TableCell ID="tcLoginCtrl">6 <uc1:LoginControl ID="LoginControl" Enable runat=server LoginStyle=Login_Home />7 </asp:TableCell>8 </asp:TableRow>9 </asp:Table>10 </ContentTemplate>11 </asp:UpdatePanel>
Any help would be greatly appreciated.

</p><p> (this.Parent.Parent as UpdatePanel).Update();</p><p>

is what I use.....however i have other problems...LOL. but that should fix yours.


Hi,

I think you can add a invisible button in the default page, set it as a trigger for the update panel.

Then add a javascript function in the contained page, in which invoke the click event of the button in the container.

Please feel free to let me know if there is any problem.


I tried that before, but when I have 2 instances of the same control on my page, it fires events for both of them. Or did I do something wrong?? Should this be happening? Have you ever heard of this??


In my opinion, it's normal that two control of the same type would behavior the same.

Is 242 KB atlas download too huge .... huge... for you?

Atlas make life easier at the same time make user experiences harder with huge atlas script.

1. There are several ways to reduce the size by setting EnableScriptComponents=false. It still come down to 56kb.

When EnableScriptComponents=false, the webservices bridge will not run, any body know which component need to be included to make it run?

2. Anything that can make the javascripts become 20kb?

J

hi,
i ran into this issue a couple of weeks ago and was somewhat concerned that pages I was creating for a site may start to run to 500k or something. which was worrying to say the least. after a good deal of searching (as it still early days i suppose) i discovered that:
1/ if you are using visual studio / visual web devloper or whatever, and you have debug=true in you web config, this will prevent the atlas javascripts from getting cached on the client browser. when set to false (ie release) the scripts will be cached on the first time any page utilising the atlas framework is called. All subsepquent page loads etc will then be quicker.
2/ add this to your web config under the httpModules nodes
<add name="WebResourceCompression" type="Microsoft.Web.Services.WebResourceCompressionModule"/>
the download size for all pages running atlas controls etc will be significantly reduced and no settings are disabled.

Wednesday, March 21, 2012

Is Atlas Ready? 3 questions

I'm building an ASP.NET 2.0 eCommerce application that has a pretty standard item order form. When a user configures an item, I'd like the price to change completely on the client side. Each item has 0 to 15 options, some options don't effect the price, some do. When the user selects an options, say by clicking a checkbox, I'd like the UI to respond all client side with the SubTotal and Total prices updating to reflect the selection.

1) Is the current December release of Altas reliable and fully functional for this requirement?

2) Can I install Atlas in an existing ASP.NET 2.0 application? (all the docs I've seen basically are starting an ASP.NET 2.0 Atlas application from scratch. My current application is about 100 files and is near completion. The current plan is do use DHTML, but Altas is much cooler if it is ready, willing and able)

3) Can Altas be used in a production environment? (e.g. do I need a Beta licence like we did for ASP.NEt 2.0 before November?

TIA,

geo

As for #2 - you sure can - simply make a reference to the Atlas.dll - copy the script folder into your solution

I've been using it since the Dec CTP came out


1. No. Wel Yes. It is fully functional but expect things to change in the next release.

2. Yes

3. No.


For clarity on number 3, as I oringinally asked the question poorly

Can I use Atlas in a production environment??

Thanks again,
geo
While you can do anything you want, the legal and technical answer is that
there is no license available for using Atlas in a production environment.

Wally

wrote in message news:1162230@.66.129.67.202...
> For clarity on number 3, as I oringinally asked the question poorly
>
> Can I use Atlas in a production environment??
>
> Thanks again,
> geo
>

Is Atlas scheduled for release to production environments? Do you have an estimated date when it will be available? Will there be any cost associated with it?

TIA,

Walt


As far as I know, the "go live" is for late 2006.

Wally


when is the next release?

i heard there would be one every month, including this sometime this month.

thanks

Is it possible to catch a GetPostBackEventRefrence in an UpdatePanel?

I've got a custom gridview control where inside the RowDataBound event, I am setting an attribute to the row to allow the user to just click anywhere on the row, instead of clicking the 'Select' command.

This works fine, but it does a postback. Is it possible to capture that in the updatepanel?


e.Row.Attributes.Add("onclick", Page.ClientScript.GetPostBackEventReference(this, "Select$" + e.Row.RowIndex.ToString()));

There should be no difference in behavior whether you're in an UpdatePanel or not. The only constraint I can think of is that you can't alter anything that isn't contained in an UpdatePanel during the PostBack.

So, if you can catch the GetPostBackEventReference normally, you should still be good in an UpdatePanel.


I have the same problem. It works perfectly without the updatepanel, but when the gridview is placed inside the update panel, it does not update when the user clicks the row.


Hi,gidikh

To troubleshoot this issue, we really need the source code to reproduce the problem, so that we can investigate the issue in house. It is not necessary that you send out the complete source of your project. We just need a simplest sample to reproduce the problem. You can remove any confidential information or business logic from it.

Thanks


I figured out my problem. I was updating a formview outside of the updatepanel. As soon as I put that formview into an updatepanel of it's own, everything worked as it should.