Hi guys,

Am new in this field,
How can I program a text-box in a details-view template to perform a certain function??

Protected Sub LinkButton1_Click1(ByVal sender As Object, ByVal e As System.EventArgs)
        Dim tdate, fdate As Date
        tdate = Textbox2
        fdate = Textbox3
        Dim ts As TimeSpan = tdate.Subtract(fdate)
        Dim days As Integer = ts.Days
        MsgBox(days)
        If days <= 1 Then
            'display label
            Label3.Visible = True
        ElseIf days = 30 Then
            'display label
            Label4.Visible = True
        Else
            Response.Redirect("Leave_details.aspx")
        End If
    End Sub

This is the code behind the details view.
I will highly appreciate your help.

Larsh.

I wanna say to grab the control array, and then you can manipulate the text box from there. This has a tendency to get hairy though.

May I ask why you have a server side message box in your code? When you push to a production environment, those message boxes will still show up, but there may or may not be someone at the server to close them.

I wanna say to grab the control array, and then you can manipulate the text box from there. This has a tendency to get hairy though.

May I ask why you have a server side message box in your code? When you push to a production environment, those message boxes will still show up, but there may or may not be someone at the server to close them.

First I'd to thank you for replying, please on how I can grab the control array.
About the text box, am trying to refer to that in the details-view which should be in client side. Am I missing something?

For a client side message box, you'd have to use a client side javascript alert.

As for the control array, there are many ways to do so, if you put code into the preinit event on the page, during a post back you can add or subtract, and manipulate different control before viewstate is applied to them. Otherwise in the form load, you can get the array after viewstate is applied.

When you grab the array depends on what you wanna do with it.

here is a good source of reference and sample code to help.

http://www.4guysfromrolla.com/

Otherwise without more specific information about what you intend to do, it's hard to suggest help.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.