Web datagrid update issue

B

Billy

I am creating a web application with VB.NET 2003. On one
page I have a data grid with all databound columns which
displays correctly and the editing feature does bring up
the textboxs in the grid when I click.

My problem is that for some reason, I cannot declare a
textbox. When following microsofts code:
Dim upoff As TextBox

I get this error:

C:\Inetpub\wwwroot\WebApplication1\signoff.aspx.vb
(179): 'TextBox' is ambiguous, imported from the
namespaces or types 'System.Windows.Forms,
System.Web.UI.WebControls'.


when I try to declare it such as this:
Dim up1 As String = CType(e.Item.Cells(6).Controls(0),
Web.UI.WebControls.TextBox).Text

it does compile without error, however it tells me:

Specified cast is not valid
at this line:
Dim up1 As String = CType(e.Item.Cells(6).Controls(0),
Web.UI.WebControls.TextBox).Text


I have no clue what I am doing wrong. The rest of the
site seems to be working, I just cannot upgrade this grid
no matter whos code I follow.
 
C

Cor

Hi Billy,

I do not see how you create your controls with VB.net 2003 on a aspx page.
For simple control creation the most simple thing is to drag it from the
toolbox in the designview on the aspx page.

You can also do it dynamicly (In a simple way you than have to drag one
panel minimal on the page)

This is an example I once made
Hi x
\\\\
Private Sub Page_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Dim mybutton(31) As Button
Dim i As Integer
For i = 0 To New Date().DaysInMonth _
(New Date().Year, New Date().Month) - 1
mybutton(i) = New Button
mybutton(i).BackColor = Drawing.Color.White
mybutton(i).Text = (i + 1).ToString
mybutton(i).Width = New Unit(30)
Me.Panel1.Controls.Add(mybutton(i))
AddHandler mybutton(i).Click, AddressOf mybutton_Click
If (i + 1) Mod 5 = 0 Then
Me.Panel1.Controls.Add(New LiteralControl("<BR>"))
End If
Next
End Sub
Private Sub mybutton_Click _
(ByVal sender As Object, ByVal e As System.EventArgs)
Dim mylabel As New Label
Me.Panel1.Controls.Add(New LiteralControl("<BR><BR>"))
Me.Panel1.Controls.Add(mylabel)
mylabel.Text = "The day is: " & DirectCast(sender, Button).Text
End Sub
////

When you don't whant to drag that panel either, you can look at this link

http://msdn.microsoft.com/library/d...l/vbtskcodeexampleaddingcontrolsatruntime.asp

I hope this helps a little bit?

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top