Retaining PreviousPage Information After Postback?
Jul 29, 2010
I'm using the asp.net PreviousPage functionality and cross-page postback. The problem i'm running into is that if I have any postbacks on my page, the PreviousPage information seems to be lost. I don't want to put it in ViewState because that will be quite large. I've thought about Session, but I don't want the data to persist after i've moved on to another page, and I really don't like the idea of putting code in all my other pages to delete old session variables.
View 1 Replies
Similar Messages:
Jul 20, 2010
I want to open a aspx page in new window.
I am openning a web page using JavaScript open .
StringBuilder cstext3 = new StringBuilder();
cstext3.Append("<script type=text/javascript> function OpenPreviewPage() {");
cstext3.Append("open('Preview.aspx');");
cstext3.Append("} </script>");
And executing following at button click on .cs page
protected void btnPreview_Click(object sender, ImageClickEventArgs e)
{
/*This will call the OpenPreviewPage method of java script from .cs file */
string javaScript =
"<script language=JavaScript>
" +
"OpenPreviewPage();
" +
"</script>";
RegisterStartupScript("ShowPreviewPage", javaScript);
}
The problem is the PreviousPage tag in preview page is null.
repPFareDetail = PreviousPage.FindControl("repFareDetail") as Repeater;
Is there any other way to open the aspx in new window by retaining the PreviousPage.FindControl method.
View 5 Replies
Oct 28, 2010
I have a webform will perform a server.transfer to another webform. Upon postback on the second webform, i am not able to retrieve the previouspage data. is there anyway i can achieve this?
View 4 Replies
Feb 2, 2010
I have a name textbox, label, usercontrol, submit button in my page inside a master page. when the button is clicked iam using the label to show the user "Please enter name". But any postback happens inside the user control then this lable gets cleared, how to retain the value on the postback of the user control.
View 2 Replies
Nov 25, 2010
I created checkbox in a gridview. I hope to retain the checkbox value after postback.
[Code]....
View 2 Replies
Aug 1, 2010
Platform: ASP.Net 2.0 I have multiple checkboxlist controls on a webpage. Along with that i have the same number of buttons on that page. Initially all the checkboxlist controls are hidden. When user clicks on a button, corresponding checkboxlist controls gets visible making others hidden and allows user to select the options.
On postback, if user clicks on the same button again, the corresponding checkboxlist gets visible but the item selection is not retained. However, this happens only in IE. This works fine in FireFox. I am using JQuery to toggle the visibility of checkboxlist.I guess the problem is because i am toggling the visibility of checkboxlist which IE doesnt seem to like. What is the solution to this problem?
View 1 Replies
Nov 15, 2010
I have a ASP DropDownList that gets populated on the Page_Load event, after i select an item and hit a button the selected item gets cleared and the first item in the DropDownList gets selected. (The DropDownList is only populated when the page is not postback)
if (!IsPostBack)
{
List<Country> lCountries = new List<Country>();
List<CompanySchedule> lCompanySchedules = new List<CompanySchedule>();
this.Load_Countries(lCountries);
[code]...
View 1 Replies
Feb 24, 2011
I have a project in VB.NET which is working fine which essentially has a Datagrid that has a TemplateColumn included which is a column of Checkboxes. The code to declare the datagrid is here...
<asp:datagrid id="dgDates" OnItemCommand="gridEventHandler" BorderColor="Black" BorderWidth="1px"
CellPadding="3" runat="server" AutoGenerateColumns="False" HorizontalAlign="Left" AllowSorting="True"
OnSortCommand="SortData" OnItemDataBound="gridItemDataBound">
<HeaderStyle Font-Underline="True" Font-Bold="True" HorizontalAlign="Center" ForeColor="Black"
BackColor="#D4D0C8"></HeaderStyle>
<Columns>
<asp:BoundColumn DataField="strParameterName" SortExpression="strParameterName" HeaderText="Parameter Name"></asp:BoundColumn>
<asp:BoundColumn DataField="dtParameterValue" SortExpression="dtParameterValue" HeaderText="Parameter Value"></asp:BoundColumn>
<asp:TemplateColumn HeaderText="Constant" SortExpression="blnStatic" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:CheckBox ID="cbStaticRolling" Checked="False" Runat="server" AutoPostBack="true"></asp:CheckBox>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
as you can see the Checkbox has Autopostback="true" but there are other things on the page which produce postbacks as well.
My Page_load has this in it, being called on every load of the page, postbacks included...
Dim strGUID As String
strGUID = Session("strGUID")
dgDates.DataSource = SqlHelper.ExecuteDataset(ConfigurationManager.AppSettings(Web. [Global].CfgKeyConnStringADMIN), "dbo.spRptGetSchedulingDates", strGUID)
dgDates.DataBind()
intNumberOfDates = dgDates.Items().Count
as well my code behind has the following code for the gridItemDataBound
Protected Sub gridItemDataBound(ByVal sender As System.Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs)
'hide the intRptSchedulingDatesID for each row in the checkbox's content style variable
If (e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem) Then
CType(e.Item.FindControl("cbStaticRolling"), CheckBox).Style("Content") = CType(e.Item.DataItem, System.Data.DataRowView).Item("intRptSchedulingDatesID")
End If
End Sub
everything you see sbove is working perfectly fine...in the sense that when I click one of the checkboxes, the page_load fires, the gridItemDataBound fires on DataBind() and when all is done, the checkbox retains the value that the user clicked the checkbox.
With all this exact same code converted to C#....the events all fire in the same order, but the checkbox selected value always clears...any thoughts??
View 2 Replies
Jan 19, 2010
i have a <input id="FILE_UPLOAD".....................> file upload html control in my asp.net web applicationwhen a post back occurs the data entered in the control gets lost . how do i retain the data entered
View 24 Replies
Jan 13, 2011
I have a couple of RadioButtons that are created dynamically. But after postback they don't retain their checked property. I also have some CheckBoxes and they work just fine using the same mechanism (code below). I have narrowed down the problem to the "GroupName" property. If I remove it, it works just fine. But I need the RadioButtons to be mutually exclusive.
[Code]....
View 3 Replies
Oct 18, 2010
I have created a composite control with sample details as follows. Basically, the first time on page load the control sets a view state variable and the problem is that on post back (when the button is clicked), the ViewState variable is null. I have researched extensively and I am not able to find a solution. I checked all the Microsoft recommended articles and also from other developers. This approach seem to work for everyone
PS: This code may not work as it is only for illustrative purposes. but this is exactly what i'm doing in my code.
Public class Test : CompositeControl
{
private Button btnTest = new Button();
public string TestViewState[code]....
View 2 Replies
Nov 9, 2010
I have a modalpopupextender and I want to be able to update the information without causing a postback and having to re-show the modal, normally I use an updatepanel and this is working in most cases but I have an issue with a repeater where the ItemCommand has been set but clicking the button does not fire anything, unless I set the repeater as a trigger but this then does postback and I lose where I am. Not the usability I want to provide.
View 4 Replies
Jan 11, 2011
I followed the directions from MSDN on transferring data between asp.net pages.But when using the 'PreviousPage' property to access the previous pages controls, I get a null ref exception that PreviousPage is not set to an instance of an object.Here is my code:
public partial class Portal : System.Web.UI.Page
{
public string Username
[code]...
View 1 Replies
Feb 4, 2011
Somehow my textbox is returning a null.
I have a MasterPage, I have an Edit.aspx page and an Edit.ascx control.
EditPage.aspx
<%@
PreviousPageType
VirtualPath="~/forms/InclusionRule.aspx" %>
[Code].....
View 5 Replies
Aug 3, 2010
i have a problem with a previouspage and getting the value of selecteditem in gridview
here i have my code as you can see i have in my Users.aspx page: 1) a property readOnly UserID 2)an event Grw_utenti_SelectedIndexChanged who transtfer to UsersDetail.aspx
[Code]....
View 4 Replies
Feb 7, 2011
I'm trying to pass post data from one page to the next but PreviousPage always equals null.This is what I have in the original page (inside an updatepanel
<asp:Button ID="mmGo" runat="server" Text="Merge" PostBackUrl="~/Default2.aspx?action=merge"/>
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>
<%@ PreviousPageType VirtualPath="~/Default.aspx" %>
[code]...
View 1 Replies
Aug 20, 2010
I'm trying to get the value of a textbox using the PreviousPage method and the previous page utilizes a MasterPage for the page's layout. I've read through many forums laying out the ground work on how to do this, but for whatever reason I am just being unsucessfull in getting this to work in my project.
Mark-up of previous page using a master page template:
[Code]....
VB Code-behind page for second page:
[Code]....
What really confuses me is that when I step through the code it goes all the way through the if statement but never gets the text value from the previous page.
View 7 Replies
Jan 6, 2011
Bydefault breadcrumbs links are behaving like Navigate Url.Due to this we can not get Previous page data.But can we make that link to behave similar to Postback url, like LinkButton has property PostbackUrl , with the help of this we can get Previous Page data.
View 1 Replies
Jun 25, 2010
I have a selection list that is generated dynamically, it lists a number of checkboxes that are based on an end-user editable table, as such I have no idea what data, or how much, might be contained in this table and how many checkboxes or what they might contain, other than the primary keys of the table. The user will select the checks they wish to see, and then control is passed to another page via PostBackUrl. The second page has to figure out which records to show (build it's where clause) based on the checkboxes checked in the previous page.
So, my problem is several-fold. First, asp:CheckBoxes don't have values. This can be worked around by a number of methods. Right now, i'm using a placeholder and dynamically creating the checkboxes in the ItemDataBound event of the DataList. I set the ID to "CheckboxKey1Key2" (where Key1 and Key2 are the primary keys of the check items). Second, I have to walk through the controls of the PreviousPage to dig out all these values. That in itself is also a pain, but doable. Now, my thinking is to build the where clause of my Linq2Sql query based on the keys I got from decoding the checked checkbox names. This all seems like a lot of jumping through hoops for something that shouldn't be this difficult. Am I missing something? Does anyone have any better solutions?
View 1 Replies
Oct 12, 2010
I Have two pages source.aspx and target.aspx. Source.aspx has one button and other form controls the collect input. The button has its postbackurl property set to target.aspx. On target.aspx I have another button and other form controls that collect input. When the user clicks on the target.aspx button, I want the inputs from both source and target gathered to be inserted into the database. The problem is the Page.PreviousPage property is only available during the initial rendering of the target.aspx page. So when I click on target.aspx button, PreviousPage is now null.
One strategy of mine is to collect the information on page_load and store it in ViewState, but is there any other method that I should consider in this process. I think the cleanest approach would be to somehow access PreviousPage on the button_click event handler, but how can I access this property.
View 2 Replies
Jan 19, 2011
I am making an online form (literal form) that needs to have a certain function: when the user enters a 5-digit number, the form should automatically query the MS SQL DB and retrieve information associated to that number and populate other form elements (text boxes, etc.) accordingly.
So say the # was 12345 and in the DB, the record matching 12345 has name=Fred. So, when I enter 12345 into the form textbox, the name text box should be automatically populated with Fred in it.
If this is not easily achievable, I guess a submit button beside the 5-digit number text box can do.
I am still learning my way around ASP.NET and Visual Studio 2005, however I have ample experience with HTML, CSS, JavaScript, C/C++. The ASP.NET app is to be written in C#.
View 1 Replies
Nov 29, 2010
I have a comboBox within a grid. Basically to get it I have to use findcontrol. I am thinking of another option however. Within the init method I was planning on getting the value and storing it to a private static field:
private static RadComboBox theComboBox
Is it unwise to be storing a relatively complex object like this in a static field?
View 1 Replies
Jan 19, 2010
I have a masterpage with three ContentPlaceHolder and a page derive from it.
Let's call the page derive from it as "PageFrom", the "PageFrom" has a GridView.
Each row in the GridView has a linkbutton which do a cross page postback to another page, "PageTo"
And I am trying to grab any control in the "PageFrom"
I have tried PreviousPage.FindControl() and PreviousPage.Master.FindControl(), none of them works.
The master page code
[Code]....
The PageFrom
[Code]....
The "PageTo" code-behind
[Code]....
View 2 Replies
Mar 10, 2011
I have created .msi and .exe installer for one website. I now want to install this on Windows server 2003 with IIS 6. As the installation is on a already existing site on IIS I want the installer to remove all the exisitng files but retain the IIS settings of the already existing site(such as default document and directory security).
View 1 Replies
Jan 7, 2011
I'm trying to retain "visible" property of a control using view state in the following way
public bool showstatusbox {
get { return Convert.ToBoolean(ViewState["statusbox"]); }
set { ViewState["statusbox"] = value; }
}
Is there anything I should do other than this to retain value. Because, though I store the value in view state, on postback, its becoming null.
View 2 Replies