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

2012年3月28日水曜日

Resetting Scroll Position on AJAX partial postbacks

I'm sure someone has seen this one before:

    I have a grid inside an UpdatePanel displaying data that requires users to scroll to see the last couple of rows

    When a user selects a row in the grid, and AJAX post fires and displays data at the top of the page, but the scroll position is maintained and the user is required to scroll up to to the top of the page manually.

I need to reset the scroll position to 0,0 when a record is selected in my grid. If anyone can shed some light on this one I would greatly appreciate it.

Thanks

PS

Please see my post here:

http://forums.asp.net/t/1196152.aspx


Thank you - perfect solution, and so little code. I knew it wouldn't take much.

2012年3月26日月曜日

restarting the autocomplete extender?

hi everyone,

I have an autocomplete textbox and detailsview control inside of update panel with partial rendering enabled. When I use the autocomplete control first the time and click on the search button, the detailsview control loads the data and displays it.

But when delete the textbox and start typing again, it no longer autocompletes. Does this work or is there something wrong with my code.

thanks,

gavin

Code Behind

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class Lookup : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

}
protected void ButtonLookup_Click(object sender, EventArgs e)
{
DataSet1TableAdapters.StaffTableAdapter TAStaff = new DataSet1TableAdapters.StaffTableAdapter();

DetailsView.DataSource = TAStaff.GetStaffInfoByName(SearchKey.Text);
DetailsView.DataBind();
DetailsView.Visible = true;
}
}

HTML Page

<%@dotnet.itags.org. Page Language="C#" AutoEventWireup="true" CodeFile="Lookup.aspx.cs" Inherits="Lookup" %
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<atlas:ScriptManager runat="server" EnablePartialRendering="true" ID="scriptManager">
</atlas:ScriptManager>
<style type="text/css">
body { font: 11pt Trebuchet MS;
font-color: #000000;
padding-top: 72px;
text-align: center }

.text { font: 8pt Trebuchet MS }
</style>

</head>

<body>
<form id="Form1" action="" runat="server">

<atlas:UpdatePanel ID="Panel2" Mode="Always" runat="server">
<ContentTemplate
<div>
Search for
<asp:TextBox ID="SearchKey" runat="server"></asp:TextBox>
<asp:Button ID="ButtonLookup" runat="server" Text="Lookup" OnClick="ButtonLookup_Click" />

</div>
<hr style='width: 300px'/
<asp:DetailsView ID="DetailsView" runat="server" Height="196px" Width="323px">
</asp:DetailsView>
</ContentTemplate>
</atlas:UpdatePanel
</form>

<div id="completionList"></div>
<div>
<span id="Results">Here's some other text that shouldn't refresh.</span></div
<script type="text/javascript">
function DoSearch()
{
var SrchElem = document.getElementById("SearchKey");
Samples.AspNet.HelloWorldService.HelloWorld(SrchElem.value,
OnRequestComplete);
}

function OnRequestComplete(result)
{
var RsltElem = document.getElementById("Results");
RsltElem.innerHTML = result;
}

</script
<script type="text/xml-script">
<page xmlns:script="http://schemas.microsoft.com/xml-script/2005">
<components>
<textBox id="SearchKey">
<behaviors>
<autoComplete
completionList="completionList"
serviceURL="AutoCompleteService.asmx"
serviceMethod="GetWordList"
minimumPrefixLength="1"
completionSetCount="15"
completionInterval="500" />
</behaviors>
</textBox>
</components>
</page>
</script>
</body>
</htmlHi gfun,

The AutoCompleteExtender isn't part of the Toolkit, so you'll have better luck asking this question in theAJAX UI forum.

Thanks,
Ted