Click here to Skip to main content
15,895,011 members

Multiuser problem in Asp.net

Revision 2
Dear friends,

Here, i've used public static string A; variable in my application.
Suppose, user1 hav A="1" and now user2 come to this form and he has A=2.
So, in this case original value of A for user1(which is A=1) replaced with user2(which is now A=2), But i want to keep both of the value saprately for both the users..

Note :
1) i used public string A; but during postback it lost its value.

i dont want to use session variable for this.

sample coding part for reference-->

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Data.SqlTypes;
using System.Data.SqlClient;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using CrystalDecisions.Web;
using CrystalDecisions.Shared;
using CrystalDecisions.CrystalReports.Engine;
using Jagriti.Common;
using Jagriti.Interface;
using Jagriti.Business;
using Jagriti.DataAccess;

public partial class PO_REG : System.Web.UI.Page{
   
    public static string A; 
    public static string _print; 
    public void Page_Init(object sender, EventArgs e)
    {
        if (_print == "P")
        {
            ViewReport();
        }
    }
       #endregion

    protected void btnPrint_Click(object sender, ImageClickEventArgs e)
    {
        _print = "P";
        A = Convert.ToInt32(Rdbtn.SelectedValue.ToString());        
        ViewReport()
    }

    private void ViewReport()
    {
        ReportDocument crystalReport = new ReportDocument();
        if (A == 1)
        {
            crystalReport.Load(Server.MapPath("Purchase Reports/PO_IW_Register.rpt"));
        }
        else if (A == 2)
        {
            crystalReport.Load(Server.MapPath("Purchase Reports/PO_NoW_Register.rpt"));
        }
    }



any help would be highly appriciated....
thank you.
Posted 4-Nov-12 22:18pm by Vikas_Shukla_89.
Tags: , ,