Showing posts with label embedding. Show all posts
Showing posts with label embedding. Show all posts

Saturday, March 24, 2012

working AJAX with a paging user control

Hi,

I am currently working with embedding AJAX into a previously developed website, and until now have had no issues, what i am trying to do i am not sure is possible, let me explain...

I have a simple web form which contains a repeater, and a user control (which is used for paging "ucPaging"), this user control has a dropdownlist embedded in it. I want the drop down list to fire an AsyncPostBackTrigger to the upnlPlayers update panel, and the repeater to use the SelectedValue of the dropdownlist in the paging user control.


I have tried to create a new AsyncPostBackTrigger in the code behind of the main aspx page, but at runtime, it says that the dropdownlist does not exist. Is what i am trying to do possible? I really don't want to have to resort to using the ASP paging control that is provided, as i am potentially returning hundreds of thousands of records.

Provided is the code in the main Players.aspx page...


<controls:Paging ID="ucPaging" runat="server" />
<ajax:UpdatePanel ID="upnlPlayers" runat="server">
<ContentTemplate>
<asp:Repeater ID="repPlayers" runat="server" OnItemDataBound="repPlayers_OnItemDataBound"....... etc etc etc you know the deal

</ContentTemplate>
<Triggers>
<ajax:AsyncPostBackTrigger ControlID="btnSearch" EventName="Click" />
</Triggers>
</ajax:UpdatePanel>

And the user control code...

<div id="Paging">
<div class="Previous"><asp:HyperLink ID="hlPrevious" runat="server" /></div>
<div class="Page"><asp:Label ID="lblViewingRecords" runat="server" /> <asp:DropDownList ID="ddlRecords" runat="server" OnSelectedIndexChanged="ddlRecords_OnSelectedIndexChanged" AutoPostBack="true" /></div>
<div class="Next"><asp:HyperLink ID="hlNext" runat="server" /></div>
</div>

Thanks for your help!

e

Since the DropdownList is in User Control, You have to add it as programmatically rather than declaratively. For Example in the Page load event add the following codes:


if (!IsPostBack)
{
AsyncPostBackTrigger tr = new AsyncPostBackTrigger();

tr.ControlID = YourDropDownList.ClientID;
tr.EventName = "SelectedIndexChanged";
YourUpdatePanel.Triggers.Add(tr);
}

Wednesday, March 21, 2012

XMLHTTP and Digest Authentication

Hi, I'm having some problems with XMLHTTP.open and digest authentication.


I am embedding the user name and password into the XMLHTTP.open function (method, file, async, "UserName", "Password"). The server is Apache. Basically, when I switch to Basic authentication, the script works fine. However, it does not work correctly when I switch authentication to Digest. HTTP status returns an odd number, (5 digits). And it looks like the callback function is never executed.

Anyone have any insights on this?

Hi,

It seems that the target page might have some errors.

Need more help on XML Http post, below link might help you..

http://www.devx.com/DevX/Tip/17500

Happy Coding

Please mark as "Answer" if you find this post helpful


1) The target page just spits out text. There's no scripting of any kind on the target page. The only sort of server action is .htaccess for authentication.

2) I'm not using POST. I'm using GET. However, that's irrelevant. The error exists either way.


Hi,

It's clear to us in helping if you post all your javascript and target page code.