.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Storing data into property

Posted By:      Posted Date: August 28, 2010    Points: 0   Category :ASP.Net
Hi, I have written a property globally on page load i am storing setting some value into that property but on button click i am not able to retrieve the data. Is there any alternate way to save the data other than viewstate or sessionstate. Ex: Partial Class _Default Inherits System.Web.UI.Page Private s As String Public Property Test() As String Get Return s End Get Set(ByVal value As String) s = value End Set End Property Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Not IsPostBack Then s = "Test" End If End Sub Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click s = "Champ" End Sub Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click MsgBox(s.ToString()) End Sub End Class

View Complete Post

More Related Resource Links

Storing User Data



I'm trying to get the current logged in UserId Value, using this code

Protected Sub UserProfileDataSource_Selecting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.SqlDataSourceSelectingEventArgs) Handles UserProfileDataSource.Selecting      ' Get a reference to the currently logged on user      Dim currentUser As MembershipUser = Membership.GetUser()      ' Determine the currently logged on user's UserId value      Dim currentUserId As Guid = CType(currentUser.ProviderUserKey, Guid)      ' Assign the currently logged on user's UserId to the @UserId parameter      e.Command.Parameters("@UserId").Value = currentUserId End Sub

But, I getting an error (NullReferenceException), I did set a url authorization on the page that i try to get the logged in user information, witch is info.aspx, and I made the login.aspx control to be redirected to the info.aspx after the login process, But the info.aspx  only shows me (access in denied), how can i make this page knows that i am already logged in?

Web Q&A: Storing SQL Data, URL Query Length, and More


Find out the best way to store large amounts of XML data in SQL Server, along with the performance implications. What's the maximum length of an XML query to SQL Server in a URL?

Edited by Nancy Michell

MSDN Magazine May 2003

Automatically set a property value for a new record in a Dynamic Data application.


I have a SalesOrderItem table, and it has a UnitPrice column in case the salesperson wishes to override the unit price of the Product for that order item.

In an ASP.NET Dynamic Data application, what would be the best way to set that UnitPrice property on a new SalesOrderItem based on the standard UnitPrice for the product? In other words, when the user clicks New on the 'Items' screen for a sales order, the UnitPrice field should already be filled in with the normal unit price for the product.

This was originally asked by myself on StackOverflow at: http://stackoverflow.com/questions/3538234/automatically-set-a-property-value-for-a-new-record-in-a-dynamic-data-application

Getting "wrong" data out of a microsoft.sqlserver.management.smo.database object property (using pow

My problem:I do something like this:$dbsvr = new-object microsoft.sqlserver.management.smo.server "servername"$dbsvr.databases | ft name,size -autosizeWhen i run this from two different PC's i get database sizes that are all the same (5.25 mb), the size of the first database listed - which is master.I started to try out a few things, and found out that when i run the same command from one of our servers it returns the correct sizes...Anyone have any idea if this a SMO issue, or maybe some package software version issue...- or what?

Storing multiple data types in a class?

I need help writing a class that will contain three values per item.  I'll be passing parameters to a report: Parameter Name, Data type (int, string, date, etc), and Value. When I pass those values to the report using the class they should be in original form (i.e. an integer should be a numeric, a string should be a string, etc.).  I can do it converting the data's value to strings on one end, and reconverting to the original data type on the other, which seems like a lot of runaround. Is there a simple way?  Also, if I'm able to store & retrieve the data in it's native format I don't need the "Data type" stored. Any help or tips will be appreciated.

SSRS 2008 R2 Dataset Field Value Property Data Type not numeric

We're building SSRS 2008 R2 reports using SSAS as data sources.  There are several occaissions where the data types of certain dataset field values that represent cube measures are not numeric.  As such, when these fields are used in an aggregate function they throw an error.  Is there a way to remedy this in the dataset? Thanks for your help.

Data Annotation not triggering the client side validation when used on an overriden model property

Hi all, This is a saga from a post that was recently answered:http://forums.asp.net/t/1598187.aspxMy main problem is the lack of client side validation when we use a child model class, the server side validation works like a charm whether you use the virtual/override solution or the new attribute on the child class with the getter and setter linking the property to the base class's one.The client side validation does not work with none of the solutions presented below.This is a sample code of the first solution: [Serializable] public class DateViewModel { ... [Display(typeof(App_GlobalResources.Messages), "Date_Year")] public virtual int? Year { get; set; } ... } [Serializable] public class BirthDateViewModel : DateViewModel { ... [Display(typeof(App_GlobalResources.Messages), "Date_Year")] [YearRange(ErrorMessageResourceType = typeof(App_GlobalResources.Messages), ErrorMessageResourceName = "Validation_Range")] public override int? Year { get; set; } ... } This is a code sample of the second solution : [Serializable] public class DateViewModel { ... [Display(typeof(App_GlobalResources.Messages), "Date_Year")] public int? Year { get; set; } ... } [Serializable] public class BirthDateViewModel : DateViewMod

Storing and retrieving historic data

Hi, I am looking at making my database historic and would like some pointers. Data older than 1 year does not need to be kept so every 12 months, data is "recycled". So far I have come up with the following using DATEPART and all data is in the same table (tables simplified): 1. When I insert records: INSERT INTO [Table] VALUES (newid(), @FKID, @Value, GETDATE()) 1. When I update records: UPDATE [Table] SET [Column] = @Value WHERE [FK] = @FKID AND (DATEPART(month, GETDATE()) = DATEPART(month, [TimeStamp])) 2. When I select records: SELECT * FROM [Table] WHERE [FK] = @FKID AND (DATEPART(month, GETDATE()) = DATEPART(month, [TimeStamp])) 3. WHEN I delete records: DELETE FROM [Table] WHERE [FK] = @FKID AND (DATEPART(month, GETDATE()) = DATEPART(month, [TimeStamp]))   Is this efficient? I was looking at partitioning, but I am not sure that it would be feasible as I want to recycle data every 12 months. Or is there a better way to do it? Regards, James

Is sharepoint good for storing relation data ?

Hi I would like to start discussion or find your opinion around "if sharepoint 2007 is a good platform to store relational data"? I found that quite often bussness doesn't feel that and push dev to create solution for relation data on top of sharepoint infrastructe. On the end we get huge customization with make everybody frustrated and those poor dev gays are blame for that. I believe that needs for relation data in particular solution draws clear line between apps build on top of Sharepoint or apps build with use of good old SQL database. Can I get your opinion around that ? I have three years expieriance with SharePoint and this is my personal opinion. If you could share your thoughts then for sure this would be helpfull for me and for other dev to show to the bussness why we somethimes suggesting them to go diffrent way. To build this discussion on some example let say that we need to build solution where: we have product table (with details around products) with contain two relation fields : user by country, owner by country we have country table (dictionary for countries), which contain field pointing to the region we have region table (dictionary for regions) we have few diffrents tables describing diffrent types of docs associated to products (like specyfication, safty documents, test documents) and let say there there goanna be a lot

Storing large data in Session State

Hi, We have a scenario where we need to store large tables of data on Session in asp.net page. on a highlevel we have to store following data  1> A table (table 1) with 1000 rows and 8 to 10 columns. 2> A table(table 2) with 500 rows and 8 to 10 columns (actually user can add the data from table 1 to table 2, so as user keeps on adding from table 1 we remove the data and put it in table 2) 3> Another table(table 3) with 1000-1200 rows each having 3 columns. We are having a webfarm, so we need to store it in either SateServer of Oracle DB, please advise which one is better. What would be the performance implications of storing such huge data on the server. One more thing is at any point of time max of 70 -80 people will be accessing our website, so will this cause any performance degradation? Thanks in anticipation Harsha

Storing Data in database


Hi everyone,

I'm try to create a news site in my website. How can i store this kind of large text below in the database.

8 Questions Every Business Analyst Should Ask

It does not matter what project you are going to undertake. It is not important what industry you are going to be assessing. What is important is you know what you are going to do. You must as questions. You must find what it is the client wants. Presented is a list of obvious questions every good business analyst should know the answer to when starting a project.

1. What problem is this business having that you hope to solve by developing this project? It should be obvious as to why you would ask that question. If you do not understand what the problem is then you can not help to solve it. Also, when reading the project program it may not be clear as to what the client actually wants. The scope may only tell you what they would like to see happen. It could and often times is not focused on what the true issues are.

2. What is the business doing at present to alleviate or solve the issue? What has been tried in the past? You must understand what the client is doing in order to understand what mus

Data Binding to a Button IsPressed Property

Is it possible to create a binding on a button such that the boolean value is set to true when the button is pressed then is set to false when the button is released?
I tried binding to the IsPressed property but get "'IsPressed' property cannot be data-bound".
I am binding to an industrial OPC database and using WPF as a Human Machine Interface (HMI).

Storing configuration data



I'm developing an EventHandler that requires configuration data for each list.

I created  a CustomAction in List ViewToolbar and redirect users to a HandlerConfigurationPage.aspx. 

My question is, where can I save configuration data ?  One option is creating a hidden config.xml in the list and reading values from EventHandler. 


any ideas ? 






class contains non-dependency-property data members that are DependencyObject objects, you must also


I was reading the article Freezable Objects Overviewand came acrosee the statement

"If  your class contains non-dependency-property data members that are DependencyObject objects, you must also call the OnFreezablePropertyChanged method each time you change on of their values, even if you're setting the member to null. "

I quite do not understand the part about non-dependency-property data members that are DependencyObject objects. Can some one explain exactly what this means? If a data member is derived from the DependencyObject  class how then can the data member be a non dependency property?

I am also trying to locate some source code / project that overrides the OnFreezablePropertyChanged method, and have yet to find any on the interenet.

If anyone know whe

A field or property with the name 'FieldName' was not found on the selected data source


I'm attempting to load a GridView dynamically on a button is pressed.

The gridview has AutoGenerateColumns="True" (set in skin definition) and has a declarative column definitions as follows:

<asp:GridView runat="server"
        SkinID="GridViewDetail" ID="gvReport"
            <asp:TemplateField HeaderText="Date">
                        <asp:LinkButton  OnClick="

SSAS 2008 - The OLAP data source has no property fields available for this dimension


Last week I was able to view member properties for my Product Dimension in Excel 2010 pivot tables. Suddenly, without having made any changes to the dimension (for example, in the Attribute Relationships window of the dimension), those member properties are no longer available in Excel. I get the error "The OLAP data source has no property fields available for this dimension" when I try to select "Show Properties in Report" or "Show Properties in Tooltips" in the Pivot Table. At the same time, member properties are available for all other dimensions. I have also not made any changes to the data source connection in Excel and in any event, there is no option in the data source connection to enable or disable member property visibility. I am using BIDS 2008 and SQL Server 2008 R2 (10.50.1600.1). Does anybody have an idea why this might be happening?


storing data in web form


Hi i am beginner in web development..I have a question regarding storing of data in web pages..


I have created 2 pages one is login.aspx and Default.aspx ..Whenver user enters information in login page and creates submit button it will go to Default.aspx page...there is back button in default.aspx ..when i click this it goes to login.aspx page..


My question is when i click back button why cant i see data i entered in login.aspx page? what setting i need to use inorder to see data.




ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend