Click here to Skip to main content
15,881,803 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: Calling a js function from a different aspx.cs page problem. Pin
Sandeep Mewara12-Mar-10 19:05
mveSandeep Mewara12-Mar-10 19:05 
GeneralRe: Calling a js function from a different aspx.cs page problem. Pin
betreyal15-Mar-10 4:22
betreyal15-Mar-10 4:22 
AnswerRe: Calling a js function from a different aspx.cs page problem. Pin
Not Active12-Mar-10 15:02
mentorNot Active12-Mar-10 15:02 
AnswerRe: Calling a js function from a different aspx.cs page problem. Pin
betreyal15-Mar-10 9:39
betreyal15-Mar-10 9:39 
AnswerRe: Calling a js function from a different aspx.cs page problem. Pin
carlecomm14-Mar-10 15:51
carlecomm14-Mar-10 15:51 
GeneralRe: Calling a js function from a different aspx.cs page problem. Pin
betreyal15-Mar-10 4:33
betreyal15-Mar-10 4:33 
AnswerRe: Calling a js function from a different aspx.cs page problem. Pin
betreyal15-Mar-10 5:00
betreyal15-Mar-10 5:00 
QuestionHIddenfield value lost on postback - why? Pin
AndyASPVB12-Mar-10 4:08
AndyASPVB12-Mar-10 4:08 
Hi
I have a hiddenfield, which I want to save the scroll position of asp.panel scrollbar during postback, and when during postback this value is called back to set the scroll position.

Using javascript I can grab the value from the scrollbar, and assign it to the hidden field, but when I post the page back the value has gone.

Here is my code snippet:


<script type="text/javascript" language="javascript">



function SetScroll(val) {

alert(document.getElementById('div1').childNodes('ScrollPos').value);



}

function ScrollTo(what) {

var test = what.split('/');

document.getElementById(test[0]).scrollTop = document.getElementById('div1').childNodes('ScrollPos').value;

}



</script>

<div id="div1" class="Style">

<input type="hidden" id="ScrollPos" name="Pos" runat="server" enableviewstate="true"/>

<asp:Panel ID="pnl1" runat="server" Enabled="true" Height="600px" ScrollBars="Vertical"

Width="100%" onscroll="javascript:SetScroll(this);">

<br />

<div class="divTagBGColours">

</div>

<br />

<asp:BulletedList ID="BulletedList2" runat="server">

<asp:ListItem Text="Hello" Value="blah" />

<asp:ListItem Text="Hello" Value="blah" />

<asp:ListItem Text="Hello" Value="blah" />

<asp:ListItem Text="Hello" Value="blah" />

<asp:ListItem Text="Hello" Value="blah" />

<asp:ListItem Text="Hello" Value="blah" />

<asp:ListItem Text="Hello" Value="blah" />

<asp:ListItem Text="Hello" Value="blah" />

<asp:ListItem Text="Hello" Value="blah" />

<asp:ListItem Text="Hello" Value="blah" />

<asp:ListItem Text="Hello" Value="blah" />

<asp:ListItem Text="Hello" Value="blah" />

<asp:ListItem Text="Hello" Value="blah" />

<asp:ListItem Text="Hello" Value="blah" />

<asp:ListItem Text="Hello" Value="blah" />

<asp:ListItem Text="Hello" Value="blah" />

<asp:ListItem Text="Hello" Value="blah" />

<asp:ListItem Text="Hello" Value="blah" />

<asp:ListItem Text="Hello" Value="blah" />

<asp:ListItem Text="Hello" Value="blah" />

<asp:ListItem Text="Hello" Value="blah" />

<asp:ListItem Text="Hello" Value="blah" />

<asp:ListItem Text="Hello" Value="blah" />

<asp:ListItem Text="Hello" Value="blah" />

<asp:ListItem Text="Hello" Value="blah" />

<asp:ListItem Text="Hello" Value="blah" />

<asp:ListItem Text="Hello" Value="blah" />

<asp:ListItem Text="Hello" Value="blah" />

<asp:ListItem Text="Hello" Value="blah" />

<asp:ListItem Text="Hello" Value="blah" />

<asp:ListItem Text="Hello" Value="blah" />

<asp:ListItem Text="Hello" Value="blah" />

<asp:ListItem Text="Hello" Value="blah" />

<asp:ListItem Text="Hello" Value="blah" />

<asp:ListItem Text="Hello" Value="blah" />

<asp:ListItem Text="Hello" Value="blah" />

<asp:ListItem Text="Hello" Value="blah" />

<asp:ListItem Text="Hello" Value="blah" />

<asp:ListItem Text="Hello" Value="blah" />

<asp:ListItem Text="Hello" Value="blah" />

<asp:ListItem Text="Hello" Value="blah" />

<asp:ListItem Text="Hello" Value="blah" />

<asp:ListItem Text="Hello" Value="blah" />

</asp:BulletedList>

</asp:Panel>

</div>

protected void Page_PreRender(object sender, EventArgs e)

{

EnsureChildControls();

if (!IsPostBack)

{

Session["panelNames"] = pnl1.ClientID;

Session["panelNames"] += "/" + pnl2.ClientID;

Session["panelNames"] += "/" + pnl3.ClientID;

string var4 = Session["panelNames"].ToString();

Session["panels"] = "ScrollTo('" + var4 + "');";

((HtmlControl)(this.Page.Master.FindControl("mainBody"))).Attributes.Add("onload", Session["panels"].ToString());

string var = ScrollPos.Value;



}

}

Am I missing something? How do I keep the value during post back?
AnswerRe: HIddenfield value lost on postback - why? Pin
R. Giskard Reventlov12-Mar-10 4:22
R. Giskard Reventlov12-Mar-10 4:22 
GeneralRe: HIddenfield value lost on postback - why? Pin
Not Active12-Mar-10 4:24
mentorNot Active12-Mar-10 4:24 
GeneralRe: HIddenfield value lost on postback - why? Pin
R. Giskard Reventlov12-Mar-10 5:28
R. Giskard Reventlov12-Mar-10 5:28 
GeneralRe: HIddenfield value lost on postback - why? Pin
AndyASPVB12-Mar-10 5:25
AndyASPVB12-Mar-10 5:25 
AnswerRepost [modified] Pin
Not Active12-Mar-10 4:23
mentorNot Active12-Mar-10 4:23 
AnswerRe: HIddenfield value lost on postback - why? Pin
Not Active12-Mar-10 4:30
mentorNot Active12-Mar-10 4:30 
QuestionWeb site related Pin
Sasmi_Office12-Mar-10 1:59
Sasmi_Office12-Mar-10 1:59 
AnswerRe: Web site related Pin
Not Active12-Mar-10 2:19
mentorNot Active12-Mar-10 2:19 
QuestionHow do we find out During Month transactions took place in our Database. Pin
shiva.kore12-Mar-10 1:24
shiva.kore12-Mar-10 1:24 
AnswerRe: How do we find out During Month transactions took place in our Database. Pin
Rod Kemp12-Mar-10 1:28
Rod Kemp12-Mar-10 1:28 
QuestionTextbox Pin
FEMDEV11-Mar-10 23:14
FEMDEV11-Mar-10 23:14 
AnswerRe: Textbox Pin
ademsandeepreddy12-Mar-10 1:00
ademsandeepreddy12-Mar-10 1:00 
QuestionDrop Dwown list item disabling using javascript Pin
Jinoju11-Mar-10 18:21
Jinoju11-Mar-10 18:21 
AnswerRe: Drop Dwown list item disabling using javascript Pin
R. Giskard Reventlov11-Mar-10 21:16
R. Giskard Reventlov11-Mar-10 21:16 
AnswerRe: Drop Dwown list item disabling using javascript Pin
koolprasad200312-Mar-10 1:54
professionalkoolprasad200312-Mar-10 1:54 
AnswerRe: Drop Dwown list item disabling using javascript Pin
saanj19-Mar-10 0:01
saanj19-Mar-10 0:01 
QuestionHow do I get the emails of all the members of a given group in ActiveDirectory - Need help Pin
Slow Learner11-Mar-10 15:34
Slow Learner11-Mar-10 15:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.