Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - declaration problem
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

declaration problem

 Post Reply Post Reply
Author
__n3o__ View Drop Down
Groupie
Groupie
Avatar

Joined: 08 November 2005
Location: United Kingdom
Status: Offline
Points: 135
Post Options Post Options   Thanks (0) Thanks(0)   Quote __n3o__ Quote  Post ReplyReply Direct Link To This Post Topic: declaration problem
    Posted: 29 September 2006 at 12:13pm
Wonder if someone can help me? Am V new to ASP.NET and learning very slowly

I have a detailsview control and in it I have asp:textbox fields (Via a ItemTemplate).. I have created this sub and want it to auto populate the textbox's on page load....

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
        If Not Page.IsPostBack Then
            dteCommentDate.Text = My.Computer.Clock.LocalTime.Date
            txtPostId.Text = Request.QueryString("news")
        End If
End Sub

Now the weird this is its asking me to declare dteCommentDate & txtPostId which are textbox's in my Details view..

BUT when I tried it out this code with just normal asp:textbox not in a details view control
<script runat="server">
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
        TextBox1.Text = My.Computer.Clock.LocalTime.Date
    End Sub
</script>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</asp:Content>

This works fine ... I am very confused can someone shed some light please??

Back to Top
michael View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 April 2002
Location: United States
Status: Offline
Points: 4670
Post Options Post Options   Thanks (0) Thanks(0)   Quote michael Quote  Post ReplyReply Direct Link To This Post Posted: 29 September 2006 at 2:45pm
Childcontrol of that nature are not exposed to the designer. Use:

Dim x As New TextBox
x = DetailsView1.FindControl("dteCommentDate")
x.Text = My.Computer.Clock.LocalTime.Date
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.