dream-coder.de Blog über .NET, SQL Server, PHP, Typo3 und sonstige Themen

17Jul/080

Controls innerhalb von LoginView ansprechen

Hallo,

manchmal sieht man den Wald vor lauter Bäumen nicht Icon Wink in Controls innerhalb von LoginView ansprechen // dream-coder.de . Nun suchte ich eine Methode, um auf die Controls innerhalb eines asp:LoginView Controls zuzugreifen.

Fündig geworden bin ich hier, und ich nutze die FindControl Methode so oft ..., manchmal ärgerlich.

Ich zeige es einmal anhand des Beispiels von Thomas.

asp.net

<asp:LoginView id="LVBla" runat="server">
     <AnonymousTemplate>
         <asp:Label ID="AnonymousLabel" runat="server" />
     </AnonymousTemplate>
</asp:LoginView>

c#

 
protected void Page_Load(object sender, EventArgs e)
{
    Label anonymousLabel = (Label)LVBla.FindControl("AnonymousLabel");
 
    if (anonymousLabel != null) {
        anonymousLabel.Text = DateTime.Now.ToString();
    }
}

Und das ganze nochmal in VB.NET

vb.net

Dim anonymousLabel As Label = CType(Me.LoginView1.FindControl("AnonymousLabel"), Label)
 
If Not (anonymousLabel Is Nothing) Then
    anonymousLabel.Text = DateTime.Now.ToString()
End If
These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Misterwong in Controls innerhalb von LoginView ansprechen // dream-coder.de
  • Yigg in Controls innerhalb von LoginView ansprechen // dream-coder.de
  • Webnews in Controls innerhalb von LoginView ansprechen // dream-coder.de
  • Digg in Controls innerhalb von LoginView ansprechen // dream-coder.de
  • Delicious in Controls innerhalb von LoginView ansprechen // dream-coder.de
  • Stumbleupon in Controls innerhalb von LoginView ansprechen // dream-coder.de
  • Reddit in Controls innerhalb von LoginView ansprechen // dream-coder.de
  • Ask in Controls innerhalb von LoginView ansprechen // dream-coder.de
  • Facebook in Controls innerhalb von LoginView ansprechen // dream-coder.de
  • Google in Controls innerhalb von LoginView ansprechen // dream-coder.de
  • Live in Controls innerhalb von LoginView ansprechen // dream-coder.de
  • Myspace in Controls innerhalb von LoginView ansprechen // dream-coder.de
  • Technorati in Controls innerhalb von LoginView ansprechen // dream-coder.de
  • Twitter in Controls innerhalb von LoginView ansprechen // dream-coder.de
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


No trackbacks yet.