Free Download:
|
| |
| dj4uk | Asp.Net User |
| Using ViewState in a control | 3/4/2004 4:46:42 PM |
0/0 | |
|
I have the following code which works great up to the point that a postback occurs. At this point all the properties set in Page_Load seem to disappear. I've read about and it would seem that I need to use viewstate but I'm not sure where to start - any help would be appreciated!
using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
namespace HROC.Extranet.FolderControls {
public class FolderTaskPane: Control, INamingContainer {
private string folderPath;
private string[] splitPath;
private string folderName;
private bool addFolder;
private bool uploadFile;
private bool editUsers;
private string width;
private string height;
private string left;
private string top;
private LinkButton folderLink;
private LinkButton fileLink;
private LinkButton userLink;
private ImageButton folderImage;
private ImageButton fileImage;
private ImageButton userImage;
public event EventHandler AddFolderClick;
public event EventHandler UploadFileClick;
public event EventHandler EditUsersClick;
protected override void OnInit( EventArgs e )
{
this.folderPath = "/";
this.folderName = "";
this.addFolder = false;
this.uploadFile = false;
this.editUsers = false;
this.width = "163px";
this.height = "400px";
this.left = "";
this.top = "";
}
protected override void CreateChildControls()
{
if ( left!="" || top!="" ) {
this.Controls.Add( new LiteralControl( "<div style=\"position: absolute; z-index:100; left: " + left + "; top: " + top + "; width: " + width + "; height: " + height + "; overflow: auto;\">\n" ) );
} else {
this.Controls.Add( new LiteralControl( "<div style=\"width: " + width + "; height: " + height + "; overflow: auto;\">\n" ) );
}
if ( Directory.Exists( Page.MapPath( folderPath ) ) ) {
if (this.addFolder || this.uploadFile || this.editUsers) {
this.Controls.Add( new LiteralControl( "<table cellpadding=\"4\" cellspacing=\"0\" style=\"border: 1px solid #D4D0C8; width: " + width + ";\">\n" ) );
this.Controls.Add( new LiteralControl( "<tr>\n" ) );
this.Controls.Add( new LiteralControl( "<th colspan=\"2\" style=\"font-family: Arial; font-size: 8pt; font-weight: bold; color: black; text-align: left; background-color: #D4D0C8;\">File and Folder Tasks</th>\n" ) );
this.Controls.Add( new LiteralControl( "</tr>\n" ) );
if (this.addFolder) {
this.Controls.Add( new LiteralControl( "<tr style=\"background-color: #FFFFFF;\">\n<td>\n" ) );
folderImage = new ImageButton();
folderImage.ImageUrl = "/images/newfolder.gif";
folderImage.ToolTip = "Creates a new folder";
folderImage.AlternateText = "Creates a new folder";
folderImage.BorderStyle = BorderStyle.None;
folderImage.Width = 16;
folderImage.Height = 16;
//folderImage.CommandName = "AddFolderClick";
this.Controls.Add( folderImage );
this.Controls.Add( new LiteralControl( "\n</td>\n<td>\n" ) );
folderLink = new LinkButton();
folderLink.Text = "Make a new folder";
folderLink.ToolTip = "Creates a new folder";
folderLink.CommandName = "AddFolderClick";
this.Controls.Add ( folderLink );
this.Controls.Add( new LiteralControl( "</td>\n</tr>\n" ) );
}
if (this.uploadFile) {
this.Controls.Add( new LiteralControl( "<tr style=\"background-color: #FFFFFF;\">\n<td>\n" ) );
fileImage = new ImageButton();
fileImage.ImageUrl = "/images/uploadfile.gif";
fileImage.ToolTip = "Upload a new file";
fileImage.AlternateText = "Upload a new file";
fileImage.BorderStyle = BorderStyle.None;
fileImage.Width = 16;
fileImage.Height = 16;
//fileImage.CommandName = "UploadFileClick";
this.Controls.Add( fileImage );
this.Controls.Add( new LiteralControl( "\n</td>\n<td>\n" ) );
fileLink = new LinkButton();
fileLink.Text = "Upload a new file";
fileLink.ToolTip = "Upload a new file";
fileLink.CommandName = "UploadFileClick";
this.Controls.Add ( fileLink );
this.Controls.Add( new LiteralControl( "</td>\n</tr>\n" ) );
}
if (this.editUsers) {
this.Controls.Add( new LiteralControl( "<tr style=\"background-color: #FFFFFF;\">\n<td>\n" ) );
userImage = new ImageButton();
userImage.ImageUrl = "/images/editusers.gif";
userImage.ToolTip = "Edit user access";
userImage.AlternateText = "Edit user access";
userImage.BorderStyle = BorderStyle.None;
userImage.Width = 16;
userImage.Height = 16;
//userImage.CommandName = "EditUsersClick";
this.Controls.Add( userImage );
this.Controls.Add( new LiteralControl( "\n</td>\n<td>\n" ) );
userLink = new LinkButton();
userLink.Text = "Edit user access";
userLink.ToolTip = "Edit user access";
userLink.CommandName = "EditUsersClick";
this.Controls.Add ( userLink );
this.Controls.Add( new LiteralControl( "</td>\n</tr>\n" ) );
}
this.Controls.Add( new LiteralControl( "</table>\n<br />\n" ) );
}
this.Controls.Add( new LiteralControl( "<table cellpadding=\"4\" cellspacing=\"0\" style=\"border: 1px solid #D4D0C8; width: " + width + ";\">\n" ) );
this.Controls.Add( new LiteralControl( "<tr>\n" ) );
this.Controls.Add( new LiteralControl( "<th style=\"font-family: Arial; font-size: 8pt; font-weight: bold; color: black; text-align: left; background-color: #D4D0C8;\">Details</th>\n" ) );
this.Controls.Add( new LiteralControl( "</tr>\n" ) );
this.Controls.Add( new LiteralControl( "<tr style=\"background-color: #FFFFFF;\">\n" ) );
this.Controls.Add( new LiteralControl( "<td>" + folderName + "<br />\nFile Folder<br /><br/>Date Modified: " + String.Format( "{0:dd MMMM yyyy, HH:mm}", Directory.GetLastWriteTime( Page.MapPath( folderPath ) ) ) + "</td>\n</tr>\n" ) );
this.Controls.Add( new LiteralControl( "</table>\n" ) );
} else {
this.Controls.Add( new LiteralControl( "<table cellpadding=\"4\" cellspacing=\"0\" style=\"border: 1px solid #D4D0C8; width: " + width + ";\">\n" ) );
this.Controls.Add( new LiteralControl( "<tr>\n" ) );
this.Controls.Add( new LiteralControl( "<th style=\"font-family: Arial; font-size: 8pt; font-weight: bold; color: black; text-align: left; background-color: #D4D0C8;\">Details</th>\n" ) );
this.Controls.Add( new LiteralControl( "</tr>\n" ) );
this.Controls.Add( new LiteralControl( "<tr style=\"background-color: #FFFFFF;\">\n" ) );
this.Controls.Add( new LiteralControl( "<td><b style=\"color: red;\">Error: Folder not found!</b></td>\n</tr>\n" ) );
this.Controls.Add( new LiteralControl( "</table>\n" ) );
}
this.Controls.Add( new LiteralControl( "</div>\n" ) );
}
protected override bool OnBubbleEvent( object source,
EventArgs e )
{
bool handled = false;
if (e is CommandEventArgs) {
CommandEventArgs ce = (CommandEventArgs)e;
if (ce.CommandName == "AddFolderClick") {
OnAddFolderClick(ce);
handled = true;
} else if (ce.CommandName == "UploadFileClick") {
OnUploadFileClick(ce);
handled = true;
} else if (ce.CommandName == "EditUsersClick") {
OnEditUsersClick(ce);
handled = true;
}
}
return handled;
}
protected virtual void OnAddFolderClick (EventArgs e)
{
if (AddFolderClick != null) {
AddFolderClick(this,e);
}
}
protected virtual void OnUploadFileClick (EventArgs e)
{
if (UploadFileClick != null) {
UploadFileClick(this,e);
}
}
protected virtual void OnEditUsersClick (EventArgs e)
{
if (EditUsersClick != null) {
EditUsersClick(this,e);
}
}
public string FolderPath {
get
{
return this.folderPath;
}
set
{
this.folderPath = value;
this.splitPath = value.Split( new char[] {'/'} );
this.folderName = splitPath[ splitPath.Length - 1 ];
}
}
public bool AddFolder {
get
{
return this.addFolder;
}
set
{
this.addFolder = value;
}
}
public bool UploadFile {
get
{
return this.uploadFile;
}
set
{
this.uploadFile = value;
}
}
public bool EditUsers {
get
{
return this.editUsers;
}
set
{
this.editUsers = value;
}
}
public string Width {
get
{
return this.width;
}
set
{
this.width = value;
}
}
public string Height {
get
{
return this.height;
}
set
{
this.height = value;
}
}
public string Left {
get
{
return this.left;
}
set
{
this.left = value;
}
}
public string Top {
get
{
return this.top;
}
set
{
this.top = value;
}
}
}
}
Cheers
DJ |
| joteke | Asp.Net User |
| Re: Using ViewState in a control | 3/4/2004 4:52:44 PM |
0/0 | |
|
Every Control has ViewState property and respective, private, view state collection by default. Just put your properties to use it instead of using member variables
Something like:
public string Height
{
get
{
string h=ViewState["Height"];
return(h==null)?String.Empty : (string)h;
}
set
{
ViewState["Height"] = value;
}
}
After this you have properties and no need for respective member variables. When you set / get something, you'd do it via the property.
Thanks, Teemu Keiski Finland, EU |
| dj4uk | Asp.Net User |
| Re: Using ViewState in a control | 3/5/2004 10:44:24 AM |
0/0 | |
|
Right so, for example:
get
{
string f=ViewState["FolderPath"];
return (f==null)?String.Empty : (string)f;
}
set
{
ViewState["FolderPath"] = value;
ViewState["splitPath"] = value.Split( new char[] {'/'} );
ViewState["folderName"] = ViewState["splitPath"][ ViewState["splitPath"].Length - 1 ];
}
And then the declarations:
private string folderPath;
private string[] splitPath;
private string folderName;
private bool addFolder;
private bool uploadFile;
private bool editUsers;
private int width;
private int height;
private int left;
private int top;
Are no longer need and therefore I need to substitute all instances of these for their new viewstate versions?
Am I correct in thinking this?
DJ |
| dj4uk | Asp.Net User |
| Re: Using ViewState in a control | 3/5/2004 12:26:33 PM |
0/0 | |
|
joteke - thanks so much for your help - it is working perfectly!
I've tweaked the code a little - see below. If I made FolderName and SplitPath Private methods would it still work the same (obviously these wouldn't be accessible outside the class which is what I want).
If you have time could you let me know if my code is in a good standard format as this is my first custom control and I would like to check I'm not going to pick up bad habits.
In particular have I implemented a public enum correctly?
Thanks again.
DJ
using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
namespace HROC.Extranet.FolderControls {
public class FolderTaskPane: Control, INamingContainer {
public enum PositionEnum { None = 0, Absolute = 1, Relative = 2 }
private LinkButton folderLink;
private LinkButton fileLink;
private LinkButton userLink;
private ImageButton folderImage;
private ImageButton fileImage;
private ImageButton userImage;
public event EventHandler AddFolderClick;
public event EventHandler UploadFileClick;
public event EventHandler EditUsersClick;
protected override void OnInit( EventArgs e )
{
this.FolderPath = String.Empty;
this.FolderName = String.Empty;
this.AddFolder = false;
this.UploadFile = false;
this.EditUsers = false;
this.Width = 163;
this.Height = 400;
this.Position = PositionEnum.None;
this.Left = 0;
this.Top = 0;
}
protected override void CreateChildControls()
{
if ( this.Position != PositionEnum.None ) {
this.Controls.Add( new LiteralControl( "<div style=\"position: " + this.Position.ToString() + "; z-index:100; left: " + Left + "px; top: " + Top + "px; width: " + Width + "px; height: " + Height + "px; overflow: auto;\">\n" ) );
} else {
this.Controls.Add( new LiteralControl( "<div style=\"width: " + Width + "px; height: " + Height + "px; overflow: auto;\">\n" ) );
}
if ( FolderPath != String.Empty ) {
if ( Directory.Exists( Page.MapPath( FolderPath ) ) ) {
if (this.AddFolder || this.UploadFile || this.EditUsers) {
this.Controls.Add( new LiteralControl( "<table cellpadding=\"4\" cellspacing=\"0\" style=\"border: 1px solid #D4D0C8; width: " + Width + ";\">\n" ) );
this.Controls.Add( new LiteralControl( "<tr>\n" ) );
this.Controls.Add( new LiteralControl( "<th colspan=\"2\" style=\"font-family: Arial; font-size: 8pt; font-weight: bold; color: black; text-align: left; background-color: #D4D0C8;\">File and Folder Tasks</th>\n" ) );
this.Controls.Add( new LiteralControl( "</tr>\n" ) );
if (this.AddFolder) {
this.Controls.Add( new LiteralControl( "<tr style=\"background-color: #FFFFFF;\">\n<td>\n" ) );
folderImage = new ImageButton();
folderImage.ImageUrl = "/images/newfolder.gif";
folderImage.ToolTip = "Creates a new folder";
folderImage.AlternateText = "Creates a new folder";
folderImage.BorderStyle = BorderStyle.None;
folderImage.Width = 16;
folderImage.Height = 16;
folderImage.CommandName = "AddFolderClick";
this.Controls.Add( folderImage );
this.Controls.Add( new LiteralControl( "\n</td>\n<td>\n" ) );
folderLink = new LinkButton();
folderLink.Text = "Make a new folder";
folderLink.ToolTip = "Creates a new folder";
folderLink.CommandName = "AddFolderClick";
this.Controls.Add ( folderLink );
this.Controls.Add( new LiteralControl( "</td>\n</tr>\n" ) );
}
if (this.UploadFile) {
this.Controls.Add( new LiteralControl( "<tr style=\"background-color: #FFFFFF;\">\n<td>\n" ) );
fileImage = new ImageButton();
fileImage.ImageUrl = "/images/uploadfile.gif";
fileImage.ToolTip = "Upload a new file";
fileImage.AlternateText = "Upload a new file";
fileImage.BorderStyle = BorderStyle.None;
fileImage.Width = 16;
fileImage.Height = 16;
fileImage.CommandName = "UploadFileClick";
this.Controls.Add( fileImage );
this.Controls.Add( new LiteralControl( "\n</td>\n<td>\n" ) );
fileLink = new LinkButton();
fileLink.Text = "Upload a new file";
fileLink.ToolTip = "Upload a new file";
fileLink.CommandName = "UploadFileClick";
this.Controls.Add ( fileLink );
this.Controls.Add( new LiteralControl( "</td>\n</tr>\n" ) );
}
if (this.EditUsers) {
this.Controls.Add( new LiteralControl( "<tr style=\"background-color: #FFFFFF;\">\n<td>\n" ) );
userImage = new ImageButton();
userImage.ImageUrl = "/images/editusers.gif";
userImage.ToolTip = "Edit user access";
userImage.AlternateText = "Edit user access";
userImage.BorderStyle = BorderStyle.None;
userImage.Width = 16;
userImage.Height = 16;
userImage.CommandName = "EditUsersClick";
this.Controls.Add( userImage );
this.Controls.Add( new LiteralControl( "\n</td>\n<td>\n" ) );
userLink = new LinkButton();
userLink.Text = "Edit user access";
userLink.ToolTip = "Edit user access";
userLink.CommandName = "EditUsersClick";
this.Controls.Add ( userLink );
this.Controls.Add( new LiteralControl( "</td>\n</tr>\n" ) );
}
this.Controls.Add( new LiteralControl( "</table>\n<br />\n" ) );
}
this.Controls.Add( new LiteralControl( "<table cellpadding=\"4\" cellspacing=\"0\" style=\"border: 1px solid #D4D0C8; width: " + Width + ";\">\n" ) );
this.Controls.Add( new LiteralControl( "<tr>\n" ) );
this.Controls.Add( new LiteralControl( "<th style=\"font-family: Arial; font-size: 8pt; font-weight: bold; color: black; text-align: left; background-color: #D4D0C8;\">Details</th>\n" ) );
this.Controls.Add( new LiteralControl( "</tr>\n" ) );
this.Controls.Add( new LiteralControl( "<tr style=\"background-color: #FFFFFF;\">\n" ) );
this.Controls.Add( new LiteralControl( "<td>" + FolderName + "<br />\nFile Folder<br /><br/>Date Modified: " + String.Format( "{0:dd MMMM yyyy, HH:mm}", Directory.GetLastWriteTime( Page.MapPath( FolderPath ) ) ) + "</td>\n</tr>\n" ) );
this.Controls.Add( new LiteralControl( "</table>\n" ) );
} else {
this.Controls.Add( new LiteralControl( "<table cellpadding=\"4\" cellspacing=\"0\" style=\"border: 1px solid #D4D0C8; width: " + Width + ";\">\n" ) );
this.Controls.Add( new LiteralControl( "<tr>\n" ) );
this.Controls.Add( new LiteralControl( "<th style=\"font-family: Arial; font-size: 8pt; font-weight: bold; color: black; text-align: left; background-color: #D4D0C8;\">Details</th>\n" ) );
this.Controls.Add( new LiteralControl( "</tr>\n" ) );
this.Controls.Add( new LiteralControl( "<tr style=\"background-color: #FFFFFF;\">\n" ) );
this.Controls.Add( new LiteralControl( "<td><b style=\"color: red;\">Error: Folder not found!</b></td>\n</tr>\n" ) );
this.Controls.Add( new LiteralControl( "</table>\n" ) );
}
} else {
this.Controls.Add( new LiteralControl( "<table cellpadding=\"4\" cellspacing=\"0\" style=\"border: 1px solid #D4D0C8; width: " + Width + ";\">\n" ) );
this.Controls.Add( new LiteralControl( "<tr>\n" ) );
this.Controls.Add( new LiteralControl( "<th style=\"font-family: Arial; font-size: 8pt; font-weight: bold; color: black; text-align: left; background-color: #D4D0C8;\">Details</th>\n" ) );
this.Controls.Add( new LiteralControl( "</tr>\n" ) );
this.Controls.Add( new LiteralControl( "<tr style=\"background-color: #FFFFFF;\">\n" ) );
this.Controls.Add( new LiteralControl( "<td><b style=\"color: red;\">Error: No folder specified!</b></td>\n</tr>\n" ) );
this.Controls.Add( new LiteralControl( "</table>\n" ) );
}
this.Controls.Add( new LiteralControl( "</div>\n" ) );
}
protected override bool OnBubbleEvent( object source,
EventArgs e )
{
bool handled = false;
if (e is CommandEventArgs) {
CommandEventArgs ce = (CommandEventArgs)e;
if (ce.CommandName == "AddFolderClick") {
OnAddFolderClick(ce);
handled = true;
} else if (ce.CommandName == "UploadFileClick") {
OnUploadFileClick(ce);
handled = true;
} else if (ce.CommandName == "EditUsersClick") {
OnEditUsersClick(ce);
handled = true;
}
}
return handled;
}
protected virtual void OnAddFolderClick (EventArgs e)
{
if (AddFolderClick != null) {
AddFolderClick(this,e);
}
}
protected virtual void OnUploadFileClick (EventArgs e)
{
if (UploadFileClick != null) {
UploadFileClick(this,e);
}
}
protected virtual void OnEditUsersClick (EventArgs e)
{
if (EditUsersClick != null) {
EditUsersClick(this,e);
}
}
public string FolderPath {
get
{
string f = (string) ViewState["FolderPath"];
return ( f == null ) ? String.Empty : (string) f;
}
set
{
ViewState["FolderPath"] = value;
this.SplitPath = value.Split( new char[] {'/'} );
}
}
public string[] SplitPath {
get
{
string[] f = (string[]) ViewState["SplitPath"];
return (string[]) f;
}
set
{
ViewState["SplitPath"] = value;
this.FolderName = value[ value.Length - 1 ];
}
}
public string FolderName {
get
{
string f = (string) ViewState["FolderName"];
return ( f == null ) ? String.Empty : (string) f;
}
set
{
ViewState["FolderName"] = value;
}
}
public bool AddFolder {
get
{
return (bool) ViewState["AddFolder"];
}
set
{
ViewState["AddFolder"] = value;
}
}
public bool UploadFile {
get
{
return (bool) ViewState["UploadFile"];
}
set
{
ViewState["UploadFile"] = value;
}
}
public bool EditUsers {
get
{
return (bool) ViewState["EditUsers"];
}
set
{
ViewState["EditUsers"] = value;
}
}
public int Width {
get
{
return (int) ViewState["Width"];
}
set
{
ViewState["Width"] = value;
}
}
public int Height {
get
{
return (int) ViewState["Height"];
}
set
{
ViewState["Height"] = value;
}
}
public int Left {
get
{
return (int) ViewState["Left"];
}
set
{
ViewState["Left"] = value;
}
}
public int Top {
get
{
return (int) ViewState["Top"];
}
set
{
ViewState["Top"] = value;
}
}
public PositionEnum Position {
get
{
return (PositionEnum) ViewState["Position"];
}
set
{
ViewState["Position"] = value;
}
}
}
}
|
| joteke | Asp.Net User |
| Re: Using ViewState in a control | 3/5/2004 1:14:21 PM |
0/0 | |
|
You should always also prepare for the situation when there's no value in ViewState for the corresponding key.
For example:
public PositionEnum Position {
get
{
return (PositionEnum) ViewState["Position"];
}
set
{
ViewState["Position"] = value;
}
}
If you access this property before any value is set, it would throw an exception because null cannot be casted to the enum type.
I'd write the property this way:
public PositionEnum Position
{
get
{
object obj=ViewState["Position"];
return (obj==null)? PositionEnum.None : (PositionEnum)obj;
set
{
ViewState["Position"] = value;
}
}
This follows the pattern that property has default value which is returned in case there is nothing in ViewState, as is if no value is set.
Thanks, Teemu Keiski Finland, EU |
| dj4uk | Asp.Net User |
| Re: Using ViewState in a control | 3/5/2004 3:11:13 PM |
0/0 | |
|
After thinking about it:
int types do not accept null values so for these I could use:
public int Top {
get
{
object obj = ViewState["Top"];
return (obj == null) ? 0 : (int) ViewState["Top"];
}
set
{
ViewState["Top"] = value;
}
}
Notice I set the default value the same as in OnInit.
I'm a bit stuck for Boolean and string[].
Help appreciated.
DJ |
| master4eva | Asp.Net User |
| Re: Using ViewState in a control | 3/5/2004 3:23:26 PM |
0/0 | |
|
It is a matter of changing this line:
return (obj == null) ? 0 : (int) ViewState["Top"];
To:
return (obj == null) ? false : (bool) ViewState["Top"];
// or
return (obj == null) ? new string[0] : (string[])ViewState["Top"];
The trick here is casting types.
:: Notice I set the default value the same as in OnInit.
There is no need to. Even when you set these values, the values are going to be saved to view state now -- although you do not need it to be there for default values.
-- Justin Lovell |
|
| |
Free Download:
|
Books: Developing Microsoft ASP.NET Server Controls and Components Authors: Nikhil Kothari, Vandana Datye, Pages: 689, Published: 2002 Professional Web Parts and Custom Controls with ASP.NET 2.0 Authors: Peter Vogel, Pages: 449, Published: 2005 Professional ASP.NET 1.1 Authors: Alex Homer, Dave Sussman, Rob Howard, Brian Francis, Karli Watson, Richard Anderson, Pages: 1337, Published: 2004 Expert ASP.NET 2.0 Advanced Application Design: Advanced Application Design Authors: Dominic Selly, Andrew Troelsen, Tom Barnaby, Pages: 459, Published: 2005 Professional ASP.NET 3.5: In C# and VB Authors: Bill Evjen, Scott Hanselman, Devin Rader, Pages: 1673, Published: 2008 Mastering ASP.NET with C# Authors: A. Russell Jones, Pages: 816, Published: 2002 Pro ASP.NET for SQL Server: High Performance Data Access for Web Developers Authors: Brennan Stehling, Pages: 408, Published: 2007 Professional ASP.NET 2.0 Server Control and Component Development Authors: Shahram Khosravi, Pages: 1186, Published: 2006 Component-Based Development with Visual C# Authors: Ted Faison, Edmund W. Faison, Pages: 1008, Published: 2002 Maximizing ASP.NET: Real World, Object-oriented Development Authors: Jeffrey Putz, Pages: 309, Published: 2005 Web:ViewState and Dynamic Control NET tries to restore a control's ViewState with a velue which is saved for another ... *One can override this behavior using ViewStateModeByIdAttribute. ... Using page trace to reduce your ViewState in SharePoint Sep 3, 2008 ... The image above shows the FieldValue control, which only ever displays the content of a field...its still using ViewState and 224 bytes at ... Using the viewstate in a control whose viewstate is disabled (you ... Using the viewstate in a control whose viewstate is disabled (you need a page base class). The Datagrid is a lovely control when you need a web page whose ... ViewState :: DotNetJohn The Control.ViewState property is associated with each server control in your ... You can also explicitly save information in the ViewState using the State ... Flex 3 - About view states For an example, see Example: Controlling layout using view states. Use transitions to control the changes between view states; for example, ... Control State vs. View State Example Even if view state is disabled, or when state is managed using Session, control state travels to the client and back to the server in the page. ... ASP.NET Custom Server Control - Extend TextBox Control ViewState ... Extend Dynamic TextBox & DropDownList Control View State To Store .... HtmlControls; using System.Diagnostics; namespace TextBoxSample { public class ... Page ViewState, Control ViewState and ControlState - ASP.NET ... May 8, 2008 ... I was working on some Web User Control and needed to persist information across postbacks and thought of using ViewState. ... Failed to load viewstate ? Typical problem, with an obvious ... Otherwise, again as per the sample code above, had we been using viewstate, then the problem would resolve itself, if we recreated the control also after ... Control.ViewState Property (System.Web.UI) A server control's view state is the accumulation of all its property values. In order to preserve these values across HTTP requests, ASP. ... Videos: ElementFlow control (showing CoverFlow with reflection) The ElementFlow custom control for WPF. This video shows the CoverFlow viewstate with reflections turne d ON. |
|
Search This Site:
|
|