CurrentEmail.Text = "...";

Whenever I try to include the ID for a form field in the code behind page I get 
errors. It's as though it's disconnected from the template and I can't use 
Design view because I'm developing remotely.

e.g. 1 - 'string' does not contain a definition for 'Text'...

public partial class EmailChangeUserControl : UserControl
{
MembershipUser currentUser;
string currentEmail;

public void Page_Load()
{
            currentUser = Membership.GetUser();
            currentEmail.Text = currentUser.Email;
}
}


e.g. 2 - currentEmail does not exist in the current context.

public partial class EmailChangeUserControl : UserControl
{
MembershipUser currentUser;

public void Page_Load()
      {
            currentUser = Membership.GetUser();
            currentEmail.Text = currentUser.Email;
      }
}


Also you can disable validation by setting "CausesValidation" to false.

CausesValidation false seems to prevent validation in all cases. I just want to 
disable it while editing the page and adding the web part.


From: ozmoss-boun...@ozmoss.com [mailto:ozmoss-boun...@ozmoss.com] On Behalf Of 
Paul Turner
Sent: Friday, 24 June 2011 12:26 PM
To: ozMOSS
Subject: RE: Disable Validation in Edit Mode + Bind membership Email to field

CurrentEmail.Text = "...";

Also you can disable validation by setting "CausesValidation" to false.

Regards

Paul Turner
Practice Lead - SharePoint
SMS Management & Technology

M 0412 748 168
paul.tur...@smsmt.com<mailto:paul.tur...@smsmt.com>
www.smsmt.com<http://www.smsmt.com/>
About SMS: Innovation House, Technology Park, Mawson Lakes Boulevard, Mawson 
Lakes SA 5095
SMS Management & Technology (SMS) [ASX:SMX] is Australia's largest publicly 
listed Management Services company. We solve complex problems and transform 
business through Consulting, Technology and Systems Integration
P please consider the environment before printing this email

________________________________
From: ozmoss-boun...@ozmoss.com [ozmoss-boun...@ozmoss.com] On Behalf Of Paul 
Noone [paul.no...@ceosyd.catholic.edu.au]
Sent: Friday, 24 June 2011 11:53 AM
To: ozMOSS (ozmoss@ozmoss.com)
Subject: Disable Validation in Edit Mode + Bind membership Email to field
Hi all,

I have a web part which includes a control template form with some required 
fields. What's the best way to prevent validation triggering in Page Edit mode? 
Is there a simple wrapper I can use? DisplayMode or ViewStateMode properties?

Also, I would like to display the current FBA user's email in the form but am 
unsure how to bind it.

I'm trying to do something like the following and would really appreciate any 
advice. :)

Control Template

<asp:Label ID="CurrentEmail" runat="server" 
Text='<%=currentEmail%>'></asp:Label>

Code Behind

public partial class EmailChangeUserControl : UserControl
{
MembershipUser currentUser;
string CurentEmail;

public void Page_Load()
{
    currentUser = Membership.GetUser();
    CurentEmail = currentUser.Email;
}
}

Kind regards,

Paul Noone

---------------------------------------------------
Online Developer/SharePoint Administrator
Infrastructure Team, ICT
Catholic Education Office, Sydney
p: (02) 9568 8461
f: (02) 9568 8483
e: paul.no...@ceosyd.catholic.edu.au<mailto:paul.no...@ceosyd.catholic.edu.au>
w: http://www.ceosyd.catholic.edu.au/


________________________________
NOTICE - This communication is intended only for the person or entity to which 
it is addressed and may contain confidential and/or privileged material. Any 
review, retransmission, dissemination or other use of, or taking any action in 
reliance on, this communication by persons or entities other than the intended 
recipient is prohibited. If you are not the intended recipient of this 
communication please delete and destroy all copies and telephone SMS Management 
& Technology on 1300 842 767 immediately. Any views expressed in this 
Communication are those of the individual sender, except where the sender 
specifically states them to be the views of SMS Management & Technology. Except 
as required by law, SMS Management & Technology does not represent, warrant 
and/or guarantee that the integrity of this communication has been maintained 
nor that the communication is free from errors, virus, interception or 
interference.
_______________________________________________
ozmoss mailing list
ozmoss@ozmoss.com
http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss

Reply via email to