asp.net - -C# Label & Literal not displaying value -
i have profile allows users display, edit, save.
the save , edit works ok.
however, display not working properly.
i tried changing labels literals don't either.
protected void page_load(object sender, eventargs e) { if (!ispostback) { this.bindgenderdropdownlist(); //this.bindtimezonesdropdownlist(); //this.bindculturesdropdownlist(); if (!string.isnullorempty(membership.getuser().username)) { profile = myprofile.getprofile(membership.getuser().username); this.displayprofile(); } } } protected void btngo_click(object sender, eventargs e) { this.displayprofile(); } protected void btnedit_click(object sender, eventargs e) { this.editprofile(); } protected void btncanceldisplay_click(object sender, eventargs e) { this.resetelements(); } protected void btnsave_click(object sender, eventargs e) { this.saveprofile(); } protected void btncanceledit_click(object sender, eventargs e) { this.resetelements(); } private void displayprofile() { this.setelementsfordisplaying(); litfullname.text = this.profile.profiledetail.fullname; } private void editprofile() { this.setelementsforediting(); if (profile.profiledetail == null) { txtfname.text = this.profile.profiledetail.fullname; txtcardno.text = this.profile.profiledetail.identitycardno; ddlcardcolor.selectedvalue = this.profile.profiledetail.identitycardcolour; txtcardexp.text = this.profile.profiledetail.identitycardexpirydate.tostring("dd mmmm yyyy"); ddlrace.text = this.profile.profiledetail.race; ddlreligion.selectedvalue = this.profile.profiledetail.religion; txtaddress1.text = this.profile.profiledetail.contactinformation.address1; txtaddress2.text = this.profile.profiledetail.contactinformation.address2; txtaddress3.text = this.profile.profiledetail.contactinformation.address3; txtpostcode.text = this.profile.profiledetail.contactinformation.postcode; ddldistrict.selectedvalue = this.profile.profiledetail.contactinformation.district; txtphoneoffice.text = this.profile.profiledetail.contactinformation.officephone; txtphonehome.text = this.profile.profiledetail.contactinformation.homephone; txtphonecell.text = this.profile.profiledetail.contactinformation.mobilephone; txtemail.text = this.profile.profiledetail.contactinformation.email; } }
save profile. working properly.
private void saveprofile() { if (profile.profiledetail == null) { this.profile.profiledetail.fullname = txtfname.text; this.profile.profiledetail.identitycardno = txtcardno.text; this.profile.profiledetail.identitycardcolour = ddlcardcolor.selectedvalue; this.profile.profiledetail.identitycardexpirydate = datetime.parseexact(txtcardexp.text, "dd mmmm yyyy", null); this.profile.profiledetail.race = ddlrace.selectedvalue; this.profile.profiledetail.religion = ddlreligion.selectedvalue; this.profile.profiledetail.contactinformation.address1 = txtaddress1.text; this.profile.profiledetail.contactinformation.address2 = txtaddress2.text; this.profile.profiledetail.contactinformation.address3 = txtaddress3.text; this.profile.profiledetail.contactinformation.postcode = txtpostcode.text; this.profile.profiledetail.contactinformation.district = ddldistrict.selectedvalue; this.profile.profiledetail.contactinformation.officephone = txtphoneoffice.text; this.profile.profiledetail.contactinformation.homephone = txtphonehome.text; this.profile.profiledetail.contactinformation.mobilephone = txtphonecell.text; this.profile.profiledetail.contactinformation.email = txtemail.text; } this.profile.save(); this.resetelements(); }
to display, doesn't work
private void setelementsfordisplaying() { pnldisplayvalues.visible = true; pnlsetvalues.visible = false; litusertitle.visible = false; litusertitle.text = string.format("display profile {0}", this.profile.username); }
edit profile. working private void setelementsforediting() {
pnldisplayvalues.visible = false; pnlsetvalues.visible = true; litusertitle.visible = true; litusertitle.text = string.format("edit profile {0}", this.profile.username); } private void resetelements() { pnlsetvalues.visible = false; pnldisplayvalues.visible = true; litusertitle.visible = true; }
private void setelementsfordisplaying() { pnldisplayvalues.visible = true; pnlsetvalues.visible = false; litusertitle.visible = true; // set visible litusertitle.text = string.format("display profile {0}", this.profile.username); }
and in pnldisplayvalues
panel add literals want , set values in displayprofile()
method
Comments
Post a Comment