|
you can add your connectionstring or userid to session at login page and use the session in another pages MHFARDAD
|
|
|
|
|
Thanx Hussain. As you said, i used Session variable to get the connectionstring.
|
|
|
|
|
If you don;t want to use Session object then declare a Static hash table and put all the Connection string when you get it and retrieve it through out the page
|
|
|
|
|
And how will this improve things? What happens when a connection string is updated in the webconfig? I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Thanx Mr.Biswas. I did fix the problem with session object. But I will keep in my mind your suggesiton and I will use it in the other module.
Thank you
Prasad
|
|
|
|
|
you can use the following code........in C#.net
either put your connection string in web.config under appsettings/connections string section
using System.Configuration;
public static string ConnectionString
{
get
{
//return ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString.ToString();
return ConfigurationManager.AppSettings["ConnectionString"].ToString();
}
}
|
|
|
|
|
Did even bother to read the original post? I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Hi
I have a user control, which consists of a gridview and link button. The problem being, the link button won't work! Can someone please have a look and show me why and how to solve it please!
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
System.Collections.Generic.List<UserControlProof.Model.Customer> model = new System.Collections.Generic.List<UserControlProof.Model.Customer>();
model.Add(new UserControlProof.Model.Customer() { Name = "Customer1", address = "Addr1" });
model.Add(new UserControlProof.Model.Customer() { Name = "Customer2", address = "Addr1" });
model.Add(new UserControlProof.Model.Customer() { Name = "Customer3", address = "Addr2" });
model.Add(new UserControlProof.Model.Customer() { Name = "Customer4", address = "Addr3" });
var Addr = (from m in model select m.address).Distinct();
foreach (string addr in Addr)
{
UserControlProof.Controls.CollapseableRecordset cr = (UserControlProof.Controls.CollapseableRecordset)LoadControl("Controls//CollapseableRecordset.ascx");
cr.ID = cr.UniqueID;
form1.Controls.Add(cr);
cr.DisplayName = Addr;
var filterredAddress = from m in model where m.address == addr select m;
cr.DataSource = filterredAddress;
cr.Count = filterredAddress.Count();
if (cr.Count == 1)
{
cr.ViewCustomers = true;
}
cr.DataBind();
form1.Controls.Add(new Literal() { Text = "<br />" });
}
}
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
}
}
public partial class CollapseableRecordset : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
GridView1.Columns.Clear();
BoundField f1 = new BoundField();
f1.DataField = "Customer";
f1.ShowHeader = false;
GridView1.Columns.Add(f1);
//private string displayName;
public string DisplayName
{
get
{
EnsureChildControls();
return LabelName.Text;
//return displayName;
}
set
{
EnsureChildControls();
LabelName.Text = value;
//displayName = value;
}
}
//private int count;
public int Count
{
get
{
EnsureChildControls();
return int.Parse(LabelCount.Text);
//return count;
}
set
{
EnsureChildControls();
LabelCount.Text = value.ToString();
//count = value;
}
}
//private bool ViewCustomers;
public bool ViewCustomers
{
get
{
EnsureChildControls();
return Link1.Visible;
}
set
{
EnsureChildControls();
Link1.Visible = value;
}
}
public object DataSource
{
get
{
EnsureChildControls();
return GridView1.DataSource;
}
set
{
EnsureChildControls();
GridView1.DataSource = value;
}
}
protected void Link1_Click(object sender, EventArgs e)
{
Label1.Visible = true;
}
}}
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="CollapseableRecordset.ascx.cs" Inherits="UserControlProof.Controls.CollapseableRecordset" %>
<%@ Register Assembly="Microsoft.Practices.Web.UI.WebControls" Namespace="Microsoft.Practices.Web.UI.WebControls"
TagPrefix="pp" %>
<asp:Label ID="LabelName" runat="server" Text="Name"></asp:Label>
<asp:Label ID="LabelCount" runat="server" Text="Count"></asp:Label>
<asp:Panel ID="Panel1" runat="server">
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
ShowHeader="False">
</asp:GridView>
<br />
<asp:Label ID="Label1" runat="server" Text="Label" Visible="false"></asp:Label>
</asp:Panel>
<asp:LinkButton ID="Link1" runat="server" Text="View All"></asp:LinkButton>
public class Customer
{
public string Name { get; set; }
public string address { get; set; }
}
|
|
|
|
|
hi,
i have developed a web site in vs 2005.
when i execute the website by pressing F5, the site opens, but in the environment [vs 2005] it does not show that it is in the debugging mode. the site opens seperately.
Sandeep Kumbhar
|
|
|
|
|
|
Other than what Abhijit suggested, you can also check whether your Terminal Service is Disabled or not.
Visual Studio Debugger uses Terminal Service internally.
Open Services.msc from Run, and Restart "Terminal Service"
I think this might be one reason.
|
|
|
|
|
Abhishek Sur wrote: Visual Studio Debugger uses Terminal Service internally.
can you please send the source of this information?
|
|
|
|
|
|
HI Guys, i just finished a webapp (RegSolution) on my system. I have another winapp that is a custom web browser. Then, i open localhost default page like this:
wbBrowser.Url = new Uri("http://localhost/");
This works on the custom browser (the default IIS7 page shows). But it doesn't work when i try to open up my custom web app like this:
wbBrowser.Url = new Uri("http://localhost/RegSolution/SignIn.aspx");
There's no error on the page. It loads well on IE7 and Mozilla. But, im my custom web browser, it just takes forever to load.
Pls what can i do?He who goes for revenge must first dig two graves.
|
|
|
|
|
hi,
i am new in asp.net,
i want to create a website for my practice.
can you tell me how can i do that?
|
|
|
|
|
|
|
|
I copied from u Only long back..!You suggested to someone
I think..!
LatestArticle :Log4Net
Why Do Some People Forget To Mark as Answer .If It Helps.
|
|
|
|
|
If same user logging in twice, Make his 1st attempt to log-out how to handle this. Any help
|
|
|
|
|
You can maintain a database for logged in user. While new user logging in check with the DB for the same user are already logged in or not, if yes show him a message that some one has already logged in using same credentials.
Thanks !
|
|
|
|
|
Yes i thought of this. but logging out previous attempt would be better. any idea on that.
|
|
|
|
|
You can. But for that each and every time you have to check with the Database or may be Cached data. You can try like that, Suppose below is your logged in table Structure
M_ID M_Name M_Status
101 Abhi 1
102 Raj 1
Now, M_Status ,1 Means these user are logged in. If some other user trying to logged in using same M_ID like 101, you just check your temp DB and and set M_Status=0 and insert a new record as below .
M_ID M_Name M_Status
101 Abhi 0
102 Raj 1
101 Jhon 1
Now, who is already logged in ("Abhi") with the same ID ( 101 ) with M_Status=0 is need to be logged off from application.
So, after that table should be like this,
M_ID M_Name M_Status
102 Raj 1
101 Jhon 1
Its means, if any point of time any M_Status=0, corresponding user need to be logged off from application.
This is just an idea. You can think on that 
|
|
|
|
|
i have used Application State and achieved. Thnks for u r suggestions
|
|
|
|
|
If possible please provide some details of implementation, so that it can help some others 
|
|
|
|