Preserve List Contents On Postbacks?

Jun 1, 2010

On the page load event of my webpage i fill the list of with the contents of the structure

Structure MainStruct
Dim Ans1 As String
Dim Ans2 As String
End Structure


Dim Build As New List(Of MainStruct)

The problem i that on post-back the contents of the list-of get lost.So, how can i preserve the contents of the list-of in ASP.NET?

View 1 Replies


Similar Messages:

Web Forms :: Preserve Line Breaks While Reading XML Contents?

May 12, 2010

I have an xml file as shown below. In that the MailBody has contents stored in tabular form. In that table I have a column 'Description' which needs to preserve line breaks and paragraph format if user input is in paragraphs.

At present that column displays data as one whole paragraph even if user enters data with line breaks by Enter key.

[Code]....

View 1 Replies

Preserve Onchange For A Dropdown List When Setting The Value With Javascript?

Apr 8, 2010

I have a dropdown list with a piece of code that is run when the value is changed:

<select name="SList" onchange="javascript:setTimeout('__doPostBack('SList','')', 0)" id="SList">

Everything works fine when manually done. As an option is selected, the onchange code is called.

The problem begins when I try to change the selected value using a piece of Javscript. I want to be able to automatically change the selected option using JS, whilst still having the onchange code called, exactly as if done manually.

I try calling this:

form.SList.value = "33";

The right option is selected, but the onchange code does not get called. So then I try doing this:

form.SList.value = "33";
javascript:setTimeout('__doPostBack('SList','')', 0);

The right value is not selected and nothing happens.

FYI, the code is done in ASP.NET and Javascript.

What can I run to change the selected option whilst still calling the onchange code?

View 1 Replies

C# - Maintain Generic List Between Postbacks?

Sep 14, 2010

Here is what is in my code-behind:

List<Event> events = new List<Event>();
protected void Page_Load(object sender, EventArgs e)
{
}
protected void AddEvent_Click(object sender, EventArgs e)
{
Event ev = new Event();
ev.Name = txtName.Text;
events.Add(ev);
}

I want to add an item to the list every time the Add button is clicked, but the list is reset after every postback. How can I keep the data in the list between postbacks?

View 3 Replies

State Management :: Persisting DropDown List Attributes Across Page Postbacks?

Oct 12, 2010

how can DropDownList attributes be persisted accross page Postbacks?

Example:

DropdownList1.AutoPostBack = True
DropdownList1.items(0).Attributes.Add("Attribute1","somevalue")

On Postback the attribute is no longer available (ie. attributes.count=0).

I tried persisting using the code below, but was unsuccessful:

Before PostBack: ViewState.Add("DDL","DropdownList1")
On PostBack: DropdownList1 = ViewState("DDL")

This generated the error: DropDownlist is not marked as serializable.

I than tried:

Before PostBack: Session.Add("DDL","DropdownList1")
On PostBack: DropdownList1 = Session("DDL")

This did not err but attributes were still not available.

View 4 Replies

How To View Contents Of List

Aug 3, 2010

When programming web pages with VB, what is the easiest way to view the contents in a list (to confirm some code is working)?

A textbox on the page?

View 9 Replies

List Contents Of A Drive

Nov 9, 2011

I have been told 'they' want to be able to see the documents on Drive:H

Is this doable from within a web application project?

View 10 Replies

C# - Transferring Contents Of HTML List To Text?

Jan 6, 2011

How can this be done? The .InnerText Property (when used on the containing div element) is giving me the html only. Is it possible to iterate through all the li elements contained and extract their values?

View 5 Replies

C# - Allowing User To Save Contents Of Html List To Text File?

Dec 2, 2010

I'm working on an application (ASP.NET, Webforms) that generates a list of outputs based on a user input. I want to allow the user to save the contents of said list as text file, or possibly as other filetypes such as .csv. What is the best way to approach this? Can it be done client-side with Javascript?

View 2 Replies

How To Extract The Contents Of The Pdf File And Show The Contents In Web Page

Feb 22, 2010

I have a pdf file, how can I extract the contents of the pdf file and show the contents in one of my web page

View 4 Replies

Configuration :: Deploying MVC2 Application In IIS 7 - Error "The Web Server Is Configured To Not List The Contents Of This Directory"

Sep 9, 2010

I have created a ASP.NET MVC 2 application in VS2010. It runs in integrated development server fine. But when i deploy that in IIS it gives me "The Web server is configured to not list the contents of this directory." error. Anybody know what went wrong?? There is no default.aspx page when creating a MVC2 project in VS2010. is that the problem? I can assure the routes are configured correctly in global.aspx.

View 4 Replies

Web Forms :: C# Get Contents Of Textbox And Set A Label To Those Contents?

Jan 17, 2011

i want to get the contents of a textbox and set them to a asp label for output, we can cause a postback to if that makes it easier, so far i did this and it comes up trumps

View 11 Replies

MVC :: Preserve Order Of Listbox In 2?

Mar 9, 2011

I have a listbox in my mvc 2 application.

now my problem is that i need to preserve the order of the list items after postback.

the code is as shown below:

controller code:

public ActionResult Create()
{
CreateFormModel model = new CreateFormModel();
return View(model);
}

[code]....

View 3 Replies

How To Modify Re Dim Preserve For Dynamic Array

Oct 21, 2010

I wrote the following code to preserve the values of a dynamic array

but the 2nd time around I get the 'ReDim' can only change the rightmost dimension.

Here is the code ...how should I modify it? Initial lead_count value is 0

[Code]....

View 1 Replies

How To Preserve Dynamically Created Controls?

Jan 25, 2011

I want to preserve the dynamically created control when postback occurs .

protected void Page_Load(object sender, EventArgs e)
{

} It can be achieved by calling CreateTable() in Page_Load. Is there any alternative way to preserve the control
[code]....

View 2 Replies

DropDownList In A DetailsView = How To Preserve The Values That Are Already In

Jan 13, 2010

I really have a big problem(stuck) with two dropdownlists inside a detailsview.I have 4 detailsview : DdlRt,DdlRt2,ddlMobv1,ddlMobv2. Basically what happens here is that DdlRt2 gets populated when DdlRt is selected and ddlMobv2 gets populated when a specific value from ddlMobv1 is selected.

In code posted above the detailsview has a "Update" command and the problem is when the update command is executed the data is successfully posted to the db BUT! THE VALUES from DdlRt2 and ddlMobv2 dissapear! And I can't insert any more Items. The only Item that stays in these two dropdownlists is the default "Select Department" item which is't set in codebehind but is set in .aspx.....I can't figure what I'm doing wrong here It must be something with databinding & events.

So my question is "Why can't I insert any more items to these two dropdownlists after the "Update" command on the DetailsView is set or how can I preserve the values that are already in"?

<asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" DataSourceID="odsRegister"
DefaultMode="Edit" Height="50px" Width="125px" > [code]....

View 1 Replies

C# - Preserve Line Breaks In Textbox?

Sep 24, 2010

I have a multiline textbox whose .Text property get saved in an SQL 2008 DB. When I submit the textbox, I loose the returns. How do I handle this?

I've used Enviroment.Newline() to do some html conversion stuff, but I've never ran into this specific problem.

Edit: Nevermind, it was working just fine, but I was replacing " " incorrectly. Stupid mistake. I have to convert the " " to <p> tags. I've done this before, but if anybody wants to answer, I'll mark their answer as correct.

View 1 Replies

Preserve Session Variables Across HttpHandlers?

Aug 19, 2010

I have an ASP.NET application with 5 .ashx HTTPHandlers that implement RequiresSessionState or IReadOnlySessionState.Upon calling the first handler I create a variable and store it in the session.When I call the next HttpHandler the variable is not available in the session object.I am use context.Session.I have a global.asax where I retrieve the sessionId.Is there a way to preserve session variables across HttpHandlers or does each Handler get its own session?

View 1 Replies

Preserve Ampersand In URL's Querystring When Using RegisterClientScriptInclude?

Sep 1, 2010

I have the need to add a javascript include to my ASP.NET page. The url of the javascript file has two key/value pairs in the query string. But the ampersand is being escaped and I don't want that.

Page.ClientScript.RegisterClientScriptInclude("myKey",
"https://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.2&s=1")
This results in the following HTML:
<script
src="https://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.2&s=1"
type="text/javascript"></script>
But what I really want is:
<script
src="https://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.2&s=1"
type="text/javascript"></script>

View 1 Replies

Iis - One Application, Different Domains: How To Preserve Sessions

Mar 18, 2010

I have an application with different sections. Each section is accessed through a domain. Example:

[URL] I need to preserve the session when the user navigates from one to another URL. The application is the same in IIS. How to accomplish that?

View 5 Replies

How To Preserve Values In ASPX Page

Feb 21, 2011

I am trying to figure out how to preserve the values of the controls on this page (just the user-submitted commission value and the sales region (eastern is 10% and western is 20%)).

The code is as follows:

<form id='frmShowCommSingleDocKeepState' action='afShowCommSingleDocKeepState.aspx' method='get' >
<div>
<%
Dim strSale As String
Dim dblSale As Double
Dim strRegion As String
Dim dblComm As Double
Dim E As Double = 0.1
Dim W As Double = 0.2........

View 2 Replies

Web Forms :: Preserve DDL Values Among Several Pages?

Mar 10, 2011

I have a form, mostly consisting DDL's. I constructed this form using a Master page with about 10 different pages attached. Each page consists of roughly 10 to 20 DDL's. My goal now is to navigate from one page to the next and back with out loosing the selected values in each of my DDL's on each page. I have thought about assigning each to a Session but that would really bog things down considering the amount of Data i would be storing. I would love to go the easiest route but my mission here is most efficient.

View 12 Replies

Javascript - Preserve A Value In An User Control?

Feb 10, 2011

I've written a user control that has a button that a user can click to display an additional DIV. I discovered that it would be nice to make the control remember whether or not the DIV is visible after postback so that when the page reloads, the DIV stays visible if the user wants it that way.

What is a good way to implement this with jQuery at my disposal?

View 3 Replies

Preserve Scrolling Position On Panel On Postback

Jan 11, 2010

I have a panel inside an update panel. The panel has a scrollbar. When a control inside the panel is clicked, the scrollbar resets, scrolling the panel back to the top. Is there a simple way to preserve the scrolling position of a panel inside and update panel when a postback happens from inside that panel?

View 5 Replies

C# - Adding A Way To Preserve A Comma In A CSV To DataTable Function

May 17, 2010

I have a function that converts a .csv file to a datatable. One of the columns I am converting is is a field of names that have a comma in them i.e. "Doe, John" when converting the function treats this as 2 seperate fields because of the comma. I need the datatable to hold this as one field Doe, John in the datatable.

Function CSV2DataTable(ByVal filename As String, ByVal sepChar As String) As DataTable
Dim reader As System.IO.StreamReader
Dim table As New DataTable
Dim colAdded As Boolean = False
Try
''# open a reader for the input file, and read line by line
reader = New System.IO.StreamReader(filename)
Do While reader.Peek() >= 0
''# read a line and split it into tokens, divided by the specified
''# separators
Dim tokens As String() = System.Text.RegularExpressions.Regex.Split _
(reader.ReadLine(), sepChar)
''# add the columns if this is the first line
If Not colAdded Then
For Each token As String In tokens
table.Columns.Add(token)
Next
colAdded = True
Else
''# create a new empty row
Dim row As DataRow = table.NewRow()
''# fill the new row with the token extracted from the current
''# line
For i As Integer = 0 To table.Columns.Count - 1
row(i) = tokens(i)
Next
''# add the row to the DataTable
table.Rows.Add(row)
End If
Loop
Return table
Finally
If Not reader Is Nothing Then reader.Close()
End Try
End Function

View 6 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved