c# - Show Brackets in Asp.net -
when users login account show names , designations works when show designation shows mix means username+designation example johnmanager .here manager desgination , same happend in side want designations type in brackets. here code
string desginname = convert.tostring(loginusers.spdesignname(txt_username.value, txt_pass.value)); session["userdesignationname"] = desginname; if (users == 1) { session["login2"] = txt_username.value; session["login3"] = txt_pass.value; session["userdesignationid"] = desginid; //session["departmentid"] = depid; ; session["userdesignationname"] = desginname; session["usertypeid"] = users; response.redirect("alldocuments.aspx"); } else if (users == 2) { session["login2"] = txt_username.value; session["login3"] = txt_pass.value; session["userdesignationid"] = desginid; session["userdesignationname"] = desginname; session["usertypeid"] = users; response.redirect("alldocuments.aspx"); } } catch { errrros.text = "incorrect user name or password"; }
and here in site master ...
protected void page_load(object sender, eventargs e) { if (!page.ispostback) { if (session["login2"] != null & session["userdesignationname"]!=null) { ["userdesignationid"].tostring(); welcome.text = session["login2"].tostring() +session [("userdesignationname")].tostring(); } lbtnlogout.visible = session["login2"] != null || session["login2"] != null; } }
and here image image
add them in build welcome text:
welcome.text = session["login2"].tostring() + " (" + session [("userdesignationname")].tostring() + ")";
or better, use string.format
:
welcome.text = string.format("{0} ({1})", session["login2"].tostring(), session[("userdesignationname")].tostring());
Comments
Post a Comment