Click here to Skip to main content
15,902,884 members

Comments by apjitin (Top 6 by date)

apjitin 19-Apr-13 2:10am View    
Thanks guys for all your responses.I found the silly mistake i was doing...Thanks again... :)
apjitin 19-Apr-13 1:59am View    
Here is the rough implementaion of the code...I am using Sqldatasource to retrieve contents from a table and displaying the contenets using a Gridview.I am maintaing a session variable also.

protected void Page_Load(object sender, EventArgs e)
{
string quarter = Session["quar"].ToString();
string projectid = (string)Session["projid"];
string User = (String)Session["username"];
string role = (String)Session["role"];
Session["Portname"] = Portinfo.Getportname();
Session["Portcode"] = Portinfo.Getportcode();
string pc = (string)Session["Portcode"];
userlbl.Text = User;
rolelbl.Text = role;

}

<asp:SqlDataSource ID="capitalrpts" runat="server"
ConnectionString="<%ConnectionStrings:userdatabase %>"
SelectCommand="SELECT Month,Proj_Id FROM MDMonthlyDetails JOIN Portinfo ON Portinfo.Portcode=MDMonthlyDetails.Portcode
WHERE MDMonthlyDetails.Portcode=@pc">
<SelectParameters>
<asp:SessionParameter Name="pc" SessionField="Portcode" />
</SelectParameters>

<asp:GridView ID="GridView1" DataSourceID="capitalrpts" runat="server">
apjitin 14-Mar-13 11:19am View    
i am using sqldatasource..and different users may be like user1,user2 and so on...

here is the code..

<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
string User = (String)Session["username"];
string role = (String)Session["role"];
userlbl.Text = User;
rolelbl.Text = role;

</script>

<asp:DetailsView ID="dtlview" EmptyDataText="No projects" runat="server" DataSourceID="srcusers" Height="50px" Width="125px">


<asp:SqlDataSource ID="srcusers" ConnectionString="<%ConnectionStrings:userdatabase %>"
runat="server"
SelectCommand="Select Portname,workdone,Description,dateofissue,dateofcompletion,Cost from Cmpl_Proj JOIN Portinfo ON Portinfo.Portcode=Cmpl_Proj.Portcode where Portinfo.Portmanager=@User">
apjitin 8-Mar-13 23:48pm View    
yeah...it worked...thnx again...
apjitin 8-Mar-13 1:28am View    
This is only rough.Please help me out.
protected void Page_Load(object sender, EventArgs e)
{

string user=Userverify.GetUser(username);
SqlConnection con = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["userdatabase"].ConnectionString);
string command = "Select Portcode,Portname Userinfo.Username from Portinfo JOIN Userinfo ON Userinfo.Portcode=Portinfo.Portcode where Username=user";
SqlCommand cmd = new SqlCommand(command,con);
con.Open();
SqlDataAdapter dad = new SqlDataAdapter(cmd);
res = new DataTable();
dad.Fill(res);
while (res.Rows.Count==1)
{
tpc.Text = res.Rows[0]["Portcode"].ToString();
tpn.Text = res.Rows[0]["Portname"].ToString();
}
con.Close();
}