S
Sharad Nair
Hi all,
I have a datagrid with 3 columns with the last one being a
link button which does a postback. The page hides/shows a
panel control with additonal information about the row
data. But the link button is not applicable to every row
for certain values no additional info is available and i
wud like disable the link button, or change the control to
label. I tried to replace the link control with a label
control in the DataGrid's ItemDatabound value depending on
the condition. It works fine, but the problem occurs when
the link button is clicked. The page post back and all the
label controls i added disappears.
************************************
here is the sample code.
If e.Item.ItemType = ListItemType.AlternatingItem Or
e.Item.ItemType = ListItemType.Item Then
Dim lnk As LinkButton = CType(e.Item.FindControl
("lnkPOD"), LinkButton)
lnk.CommandArgument = objStock.StockEvent
If objStock.StockEvent = Stock.EventReceipt Then
Dim refCell As TableCell = e.Item.Cells(4)
Dim lbl As New Label
'- disable the link button and put a label for receipts
lnk.Visible = False
lbl.CssClass = "LabelText"
lbl.Text = objStock.StockAdvice
lbl.EnableViewState = True
refCell.Controls.Add(lbl)
refCell.Text = objStock.StockAdvice
End If
End if
*****************************************
Does anyone have any idea what could be causing this
problem.
Thanks
I have a datagrid with 3 columns with the last one being a
link button which does a postback. The page hides/shows a
panel control with additonal information about the row
data. But the link button is not applicable to every row
for certain values no additional info is available and i
wud like disable the link button, or change the control to
label. I tried to replace the link control with a label
control in the DataGrid's ItemDatabound value depending on
the condition. It works fine, but the problem occurs when
the link button is clicked. The page post back and all the
label controls i added disappears.
************************************
here is the sample code.
If e.Item.ItemType = ListItemType.AlternatingItem Or
e.Item.ItemType = ListItemType.Item Then
Dim lnk As LinkButton = CType(e.Item.FindControl
("lnkPOD"), LinkButton)
lnk.CommandArgument = objStock.StockEvent
If objStock.StockEvent = Stock.EventReceipt Then
Dim refCell As TableCell = e.Item.Cells(4)
Dim lbl As New Label
'- disable the link button and put a label for receipts
lnk.Visible = False
lbl.CssClass = "LabelText"
lbl.Text = objStock.StockAdvice
lbl.EnableViewState = True
refCell.Controls.Add(lbl)
refCell.Text = objStock.StockAdvice
End If
End if
*****************************************
Does anyone have any idea what could be causing this
problem.
Thanks