Showing posts with label develop. Show all posts
Showing posts with label develop. Show all posts

Wednesday, March 28, 2012

Multiple Update Panels

Evening all,

As part of a larger development, I had an idea to develop a quiz using two update panels on one page. My idea was that the first update panel would have two dropdown lists binded to a database. Dropdown list 1 would hold the question. When the user selected an entry from the list, the 2nd dropdown list would populate with the answer. I added a delay using theSelectedIndexChanged event as follows:

Protected

Sub DropDownList1_SelectedIndexChanged(ByVal senderAsObject,ByVal eAs System.EventArgs)

System.Threading.Thread.Sleep(10000)

EndSub

I also added an updateProgress control to displayTime is running out.

Now the 2nd update panel had a simple text field and a button. The idea was that the user would try to beat the controls in updatePanel1 displaying the result. The user would enter their answer and click submit. This would then be compared to the actual write answer and a score would be recorded. I guess you have enough here to get my drift.

Now the big problem with this is that whilst updatePanel1 is updating, any event in updatePanel2 throws an error along the lines of: "Invalid Postback or callback argument".

From what I can gather from the complete error message, some sort of validation has been actioned and these simultaneous callbacks/postbacks can't happen. Is this just the way it is or is their a way around this. The error message makes reference to setting a pages element in the config file with the attribute "enableEventValidation=True". Now this stops me getting the error message in my page, but the lists in updatePanel1 don't display the right data.

Any tips on this or idea's on how to achieve my original concept would be hugely appreciated. I have included the relevant code below.

Kind regards

Mike

<

asp:ScriptManagerID="ScriptManager1"runat="server"EnablePartialRendering=true/><div><asp:UpdatePanelID="UpdatePanel1"runat="server"RenderMode="Inline"UpdateMode="Conditional"><ContentTemplate><asp:DropDownListID="DropDownList1"runat="server"DataSourceID="AccessDataSource1"DataTextField="question"DataValueField="qID"AutoPostBack=TrueOnSelectedIndexChanged="DropDownList1_SelectedIndexChanged"></asp:DropDownList><asp:DropDownListID="DropDownList2"runat="server"DataSourceID="AccessDataSource2"DataTextField="answer"DataValueField="answer"OnSelectedIndexChanged="DropDownList2_SelectedIndexChanged"AutoPostBack="True"></asp:DropDownList><asp:AccessDataSourceID="AccessDataSource2"runat="server"DataFile="~/App_Data/quiz.mdb"SelectCommand="SELECT * FROM [answer] WHERE ([qID] = ?)"><SelectParameters><asp:ControlParameterControlID="DropDownList1"Name="qID"PropertyName="SelectedValue"Type="Int32"/></SelectParameters></asp:AccessDataSource><asp:AccessDataSourceID="AccessDataSource1"runat="server"DataFile="~/App_Data/quiz.mdb"SelectCommand="SELECT * FROM [questions]"></asp:AccessDataSource><asp:UpdateProgressID="UpdateProgress1"runat="server"DisplayAfter="0"><ProgressTemplate>

Hurry up.......

</ProgressTemplate></asp:UpdateProgress></ContentTemplate>

</asp:UpdatePanel><br/><hr/><asp:UpdatePanelID="UpdatePanel2"runat="server"RenderMode="Inline"ChildrenAsTriggers=falseUpdateMode="Conditional">

<ContentTemplate>

<asp:ButtonID="Button1"runat="server"Text="Button"OnClick="Button1_Click"OnDataBinding="Button1_DataBinding">

</asp:button>

<asp:TextBoxID="TextBox1"runat="server"></asp:TextBox></ContentTemplate></asp:UpdatePanel>

I seem to have solved the initial error message problem by nesting the updatePanels as opposed to having 2 independent panels. I'll continue with this and see how I get on.

Any tips from anybody else would be hugely appreciated.

Kin Regards

Mike

Monday, March 26, 2012

Multiple XmlHttpRequest

Hi All,

I am new in Ajax Web Technologies. But want to learn deeply. Currently I am trying to develop a web application which reports ISA Server logs according to our needs.For example, I am fetching a dataset from SQL server and displaying them on a table. As soon as page loaded, I am executing Ajax functions which resolve host name from IP address. As you can imagine the result of query is more than 300 rows. So, resolving IP addresses one by one for 300 rows takes too long time and it is not desirable. In order to handle this problem I used Ajax library that I found onhttp://www.szajkowski.com/ajaxsample.html . It is pretty good. It creates multiple xmlhttprequests at same time. And its object handles are being stored separately. So no overwritten requests.

But the problem is, because of the limitations of IE and even Firefox, only two XmlHttpRequests are permitted for requests which points to same domain. As I learnt, it was possible to increase this value by modifying registry settings. But I don't want to do it.

I wondering that is it possible to make many simultaneous Ajax requests by using Web service methods? In XmlHttpRequest If I use POST in stead of GET.

Or is there any other way to be able to accomplish it?

Thanks in advance for your helps.

As far as I know, unless you're using some kind of IFrame-based hack, all the methods you describe are still using XmlHttpRequest objects 'under the hood'.

However, I'd argue that 2 is enough at any given time. Consider paging and chaining calls. For example, let's say that you want 50 items per page. You fire off two ajax calls, and those calls return with the 50 records plus information about which page they are and what the total number of pages is. Your 'OnRequestSuccess' handler on the clientside inspects that information in additon to parsing the data into your page, it decides if there's more data to be gotten, and fires off a request for the next page. You'd probably want to add in some logic to make sure you're not grabbing the same page twice and the like as well, but that's the basic idea. Figure that it'll take the user at least a few seconds to look at each page of data, and even if that's not quite enough time for the next batch to come down, you should be at least one page ahead of him at all times.

paul


Hi Paul,

You are right. I did some modification on server-side code.Now, I am using just one XmlHttpRequest and sending all IPs at once. And in server-side code, I used multi threaded DNS queries. And after all threads exits, it sends the all results together at once.

Thank you very much for your interest and valuable comments.

Ilhan

Wednesday, March 21, 2012

need help Atlas bridge error

hello,

I use atlas framework for my web aplication to prevent refreshing on the page. I had develop my project in my local folder and ran it then it was ok. but when I carry the atlas folder to the iis I faced with a problem like:

Server Error in '/' Application.
------------------------

Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: The element 'buildProviders' cannot be defined below the application level.

Source Error:

Line 63: -->
Line 64: <compilation debug="true">
Line 65: <buildProviders >
Line 66: <add extension=".asbx" type="Microsoft.Web.Services.BridgeBuildProvider"/>
Line 67: </buildProviders
Source File: C:\Inetpub\wwwroot\mos\rac\web.config Line: 65

--------------------

I tried both compiled(published) files and precompiled files to open in iis I had same error.

Please, it is critical for me to solve this problem otherwise I could not publish this site on the net.

I need your help, (I use .net 2005+atlas framework)
Thank you from in advance

Hi,

please check thisthread.

garbin,

I really want thank you again, because I was looking for the solution of this problem for 2 days and found lots of documents but not related to solve this..

thank you again,