S
samir dsf
hi
i have a link in the datagrid which are actually the names of the
files..what i am doign is when i click to that link i display the
description of that file below it. i have implemented something simialr
before.
the problem now is that when i click the link my datagrid jsut vanishes.
ran thru the debugger...after i click the link it comes to the
dgFiles_ItemCommand then this condition "ElseIf (e.CommandName =
"ShowContent") Then" is satisfied to is goes to the bindGrid; from bind
grid it goes to ==>
dgFiles_ItemDataBound
here is just repeates the dgFiles_ItemDataBound event only 2ice. once
for header and once for footer.
why is this happening..why does the datagird only have header and
footer?
Private Sub dgFiles_ItemCommand(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataGridCommandEventArgs) Handles
dgFiles.ItemCommand
If e.CommandName = "File" Then
/////
ElseIf e.CommandName = "Delete" Then
////
ElseIf (e.CommandName = "ShowContent") Then 'this is what is causing
problem
dgFiles.EditItemIndex = e.Item.ItemIndex
bindGrid()
End If
Private Sub dgFiles_ItemDataBound(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.DataGridItemEventArgs) Handles
dgFiles.ItemDataBound
If e.Item.ItemType =
System.Web.UI.WebControls.ListItemType.AlternatingItem Or
e.Item.ItemType = System.Web.UI.WebControls.ListItemType.Item Or
e.Item.ItemType = System.Web.UI.WebControls.ListItemType.EditItem Then
Dim lbl As System.Web.UI.WebControls.Label
lbl = e.Item.FindControl("lblSize")
FilePath = e.Item.Cells(1).Text
filename = e.Item.Cells(2).Text
Dim fi As FileInfo = New FileInfo(FilePath & filename)
Dim fileBytes As Integer = (fi.Length / 1024)
lbl.Text = fileBytes.ToString
End If
If e.Item.ItemType =
System.Web.UI.WebControls.ListItemType.AlternatingItem Or
e.Item.ItemType = System.Web.UI.WebControls.ListItemType.Item Then
Dim link As System.Web.UI.WebControls.LinkButton =
CType(e.Item.FindControl("select"),
System.Web.UI.WebControls.LinkButton)
link.Text = e.Item.Cells(2).Text
End If
Dim itemType As System.Web.UI.WebControls.ListItemType =
e.Item.ItemType
If (e.Item.ItemType =
System.Web.UI.WebControls.ListItemType.EditItem) Then
Dim row As DataRowView = CType(e.Item.DataItem, DataRowView)
Dim title As System.Web.UI.WebControls.Label =
CType(e.Item.FindControl("Title"), System.Web.UI.WebControls.Label)
Dim content As System.Web.UI.WebControls.Label =
CType(e.Item.FindControl("content"), System.Web.UI.WebControls.Label)
title.Text = row("FILENAME").ToString()
Dim contentStr As String = ByteArrayToString(row("DESCRIPTION"))
content.Text = contentStr
End If
End Sub
i have a link in the datagrid which are actually the names of the
files..what i am doign is when i click to that link i display the
description of that file below it. i have implemented something simialr
before.
the problem now is that when i click the link my datagrid jsut vanishes.
ran thru the debugger...after i click the link it comes to the
dgFiles_ItemCommand then this condition "ElseIf (e.CommandName =
"ShowContent") Then" is satisfied to is goes to the bindGrid; from bind
grid it goes to ==>
dgFiles_ItemDataBound
here is just repeates the dgFiles_ItemDataBound event only 2ice. once
for header and once for footer.
why is this happening..why does the datagird only have header and
footer?
Private Sub dgFiles_ItemCommand(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataGridCommandEventArgs) Handles
dgFiles.ItemCommand
If e.CommandName = "File" Then
/////
ElseIf e.CommandName = "Delete" Then
////
ElseIf (e.CommandName = "ShowContent") Then 'this is what is causing
problem
dgFiles.EditItemIndex = e.Item.ItemIndex
bindGrid()
End If
Private Sub dgFiles_ItemDataBound(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.DataGridItemEventArgs) Handles
dgFiles.ItemDataBound
If e.Item.ItemType =
System.Web.UI.WebControls.ListItemType.AlternatingItem Or
e.Item.ItemType = System.Web.UI.WebControls.ListItemType.Item Or
e.Item.ItemType = System.Web.UI.WebControls.ListItemType.EditItem Then
Dim lbl As System.Web.UI.WebControls.Label
lbl = e.Item.FindControl("lblSize")
FilePath = e.Item.Cells(1).Text
filename = e.Item.Cells(2).Text
Dim fi As FileInfo = New FileInfo(FilePath & filename)
Dim fileBytes As Integer = (fi.Length / 1024)
lbl.Text = fileBytes.ToString
End If
If e.Item.ItemType =
System.Web.UI.WebControls.ListItemType.AlternatingItem Or
e.Item.ItemType = System.Web.UI.WebControls.ListItemType.Item Then
Dim link As System.Web.UI.WebControls.LinkButton =
CType(e.Item.FindControl("select"),
System.Web.UI.WebControls.LinkButton)
link.Text = e.Item.Cells(2).Text
End If
Dim itemType As System.Web.UI.WebControls.ListItemType =
e.Item.ItemType
If (e.Item.ItemType =
System.Web.UI.WebControls.ListItemType.EditItem) Then
Dim row As DataRowView = CType(e.Item.DataItem, DataRowView)
Dim title As System.Web.UI.WebControls.Label =
CType(e.Item.FindControl("Title"), System.Web.UI.WebControls.Label)
Dim content As System.Web.UI.WebControls.Label =
CType(e.Item.FindControl("content"), System.Web.UI.WebControls.Label)
title.Text = row("FILENAME").ToString()
Dim contentStr As String = ByteArrayToString(row("DESCRIPTION"))
content.Text = contentStr
End If
End Sub