I have an UpdatePanel with a repeater that is re-linked after the user adds an item to it through a modal popup.
When they press a button to add a new line to the repeater, the code-code looks something like this:
protected void lbtnAddOption_Click(object sender, EventArgs e)
{
SelectedOption = new Option()
{
Account = txtAddOptionAccountNumber.Text,
Margin = chkAddOptionMargin.Checked,
Symbol = txtAddOptionSymbol.Text,
Usymbol = txtAddOptionUsymbol.Text,
};
Presenter.OnAddOption();
RefreshOptions();
mpeAddOptionDialog.Hide();
}
This works great and a new line will display quickly through UpdatePanel.
However, there are often hundreds of rows, and a new one is added based on the currently used sort column.
, jQuery ScrollTo. , div , .
:
№1. , ClientID.
№2 . , ScriptManager.RegisterStartupScript() , JavaScript .
, , , , JavaScript ( ), DOM . , jQuery , , , .
, , :
string clientID = getClientIdOfNewRow();
ScriptManager.RegisterStartupScript(this, typeof(Page), "ScrollScript", String.Format("$(\"#optionContainer\").scrollTo(\"{0}\", 800);", clientID), true);
, , JavaScript , UpdatePanel ?