Monday, March 24, 2008

detailsview insertmode default value

damn i ve been looking for tis code a long time ago.luckily i found this code today ooo yeah...still at office at 8 pm and im finish complete this code...damn im tiredddddddd

so here i share the code sakk for future reference

Protected Sub DetailsView1_DataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles DetailsView1.DataBound
If DetailsView1.DefaultMode = DetailsViewMode.Edit Or DetailsView1.DefaultMode = DetailsViewMode.Insert Then
Dim view As DetailsView = CType(sender, DetailsView)
Dim rows As DetailsViewRowCollection = view.Rows
Dim row As DetailsViewRow = rows(1)
Dim row2 As DetailsViewRow = rows(2)
Dim row3 As DetailsViewRow = rows(3)
Dim row4 As DetailsViewRow = rows(4)
Dim row5 As DetailsViewRow = rows(5)
Dim row6 As DetailsViewRow = rows(6)
Dim row7 As DetailsViewRow = rows(7)
Dim row8 As DetailsViewRow = rows(8)
Dim row9 As DetailsViewRow = rows(9)
Dim row10 As DetailsViewRow = rows(10)
Dim row11 As DetailsViewRow = rows(11)
Dim row12 As DetailsViewRow = rows(12)
Dim row13 As DetailsViewRow = rows(13)
Dim row14 As DetailsViewRow = rows(14)
Dim row15 As DetailsViewRow = rows(15)
Dim row16 As DetailsViewRow = rows(16)
Dim row17 As DetailsViewRow = rows(17)
Dim row18 As DetailsViewRow = rows(18)
Dim row19 As DetailsViewRow = rows(19)
Dim row20 As DetailsViewRow = rows(20)
'MsgBox(CType(row.Cells(1).Controls(0), TextBox).Text) '= DateTime.Now.ToShortDateString()
If CType(row.Cells(1).Controls(0), TextBox).Text = "" Then
CType(row.Cells(1).Controls(0), TextBox).Text = "-"
End If
If CType(row2.Cells(1).Controls(0), TextBox).Text = "" Then
CType(row2.Cells(1).Controls(0), TextBox).Text = "-"
End If

If CType(row3.Cells(1).Controls(0), TextBox).Text = "" Then
CType(row3.Cells(1).Controls(0), TextBox).Text = "-"
End If

If CType(row4.Cells(1).Controls(0), TextBox).Text = "" Then
CType(row4.Cells(1).Controls(0), TextBox).Text = "-"
End If

If CType(row5.Cells(1).Controls(0), TextBox).Text = "" Then
CType(row5.Cells(1).Controls(0), TextBox).Text = "-"
End If

If CType(row6.Cells(1).Controls(0), TextBox).Text = "" Then
CType(row6.Cells(1).Controls(0), TextBox).Text = "-"
End If

If CType(row7.Cells(1).Controls(0), TextBox).Text = "" Then
CType(row7.Cells(1).Controls(0), TextBox).Text = "-"
End If

If CType(row8.Cells(1).Controls(0), TextBox).Text = "" Then
CType(row8.Cells(1).Controls(0), TextBox).Text = "-"
End If

If CType(row9.Cells(1).Controls(0), TextBox).Text = "" Then
CType(row9.Cells(1).Controls(0), TextBox).Text = "-"
End If

If CType(row10.Cells(1).Controls(0), TextBox).Text = "" Then
CType(row10.Cells(1).Controls(0), TextBox).Text = "-"
End If

If CType(row11.Cells(1).Controls(0), TextBox).Text = "" Then
CType(row11.Cells(1).Controls(0), TextBox).Text = "-"
End If

If CType(row12.Cells(1).Controls(0), TextBox).Text = "" Then
CType(row12.Cells(1).Controls(0), TextBox).Text = "-"
End If

If CType(row13.Cells(1).Controls(0), TextBox).Text = "" Then
CType(row13.Cells(1).Controls(0), TextBox).Text = "-"
End If

If CType(row14.Cells(1).Controls(0), TextBox).Text = "" Then
CType(row14.Cells(1).Controls(0), TextBox).Text = "-"
End If

If CType(row15.Cells(1).Controls(0), TextBox).Text = "" Then
CType(row15.Cells(1).Controls(0), TextBox).Text = "-"
End If

If CType(row16.Cells(1).Controls(0), TextBox).Text = "" Then
CType(row16.Cells(1).Controls(0), TextBox).Text = "-"
End If

If CType(row17.Cells(1).Controls(0), TextBox).Text = "" Then
CType(row17.Cells(1).Controls(0), TextBox).Text = "-"
End If

If CType(row18.Cells(1).Controls(0), TextBox).Text = "" Then
CType(row18.Cells(1).Controls(0), TextBox).Text = "-"
End If

If CType(row19.Cells(1).Controls(0), TextBox).Text = "" Then
CType(row19.Cells(1).Controls(0), TextBox).Text = "-"
End If

If CType(row20.Cells(1).Controls(0), TextBox).Text = "" Then
CType(row20.Cells(1).Controls(0), TextBox).Text = "-"
End If
End If
End Sub

No comments:

Locations of visitors to this page
DROP ME A MSG :D