B
bienwell
Hi all,
I have a datagrid control declared as below:
<asp
ataGrid id="DGrid_Carrier" runat="server"
OnItemDataBound="DGrid_ItemDataBound" Width="353px" Font-Size="Smaller"
Font-Names="Arial" CellSpacing="1" CellPadding="3" EnableViewState="False"
AutoGenerateColumns="False">
<AlternatingItemStyle backcolor="#E0E0E0"></AlternatingItemStyle>
<HeaderStyle backcolor="LightYellow"></HeaderStyle>
<Columns>
<asp:BoundColumn DataField="Account_ID"
HeaderText="Account_ID"></asp:BoundColumn>
<asp:BoundColumn DataField="Carrier_Name" HeaderText="Carrier
Name"></asp:BoundColumn>
<asp:BoundColumn DataField="Carrier_Entity" HeaderText="Carrier
Entity"></asp:BoundColumn>
<asp:BoundColumn DataField="First_Name" HeaderText="First
Name"></asp:BoundColumn>
<asp:BoundColumn DataField="Office_Address"
HeaderText="Office_Address"></asp:BoundColumn>
<asp:BoundColumn DataField="Office_City"
HeaderText="Office_City"></asp:BoundColumn>
<asp:BoundColumn DataField="Office_ZipCode"
HeaderText="Office_ZipCode"></asp:BoundColumn>
<asp:BoundColumn DataField="Work_Phone"
HeaderText="Work_Phone"></asp:BoundColumn>
<asp:BoundColumn DataField="Start_Date"
HeaderText="Start_Date"></asp:BoundColumn>
<asp:BoundColumn DataField="End_Date"
HeaderText="End_Date"></asp:BoundColumn>
<asp:BoundColumn DataField="End_Date"
HeaderText="End_Date"></asp:BoundColumn>
<asp
laceHolder id="PlaceHolder1" runat="server" />
</Columns>
</asp
ataGrid>
The requirement is to check the filed "End_Date" from the table. If this
field is empty then I need to display a check box on that cell of the
datagrid control.
When user check on the check box in the cell, I need to update Current
date to the field "End Date" of that table.
I was working with displaying the checkbox(es) on the cells and tried to
replace an empty field on the cell of datagrid control by a check box . I'd
like to declare a placeholder in the datagrid control and get the error :
"System.Web.UI.WebControls.DataGridColumnCollection must have items of type
'System.Web.UI.WebControls.DataGridColumn'. 'asp
laceHolder' is of type
'System.Web.UI.WebControls.PlaceHolder'."
Do you know where I can declare the placeholder ? ?? I worked with
DataList control . Besides, what is the event hander I should use when user
click on the check box to update the Cureent date to End_Date field ???
I'm thinking about "SelectedIndexChange". Is that correct ??
Please help me !!! Thank you.
Sub DGrid_ItemDataBound(sender As Object, e As DataGridItemEventArgs)
If e.Item.ItemType = ListItemType.Item Or _
e.Item.ItemType = ListItemType.AlternatingItem Then
Dim drv As DataRowView = CType(e.Item.DataItem, DataRowView)
Dim EDate As Object = CType(drv.row("End_Date"),Object)
If IsDbNull(EDate) Then
Dim myCheckBox As Checkbox = New CheckBox()
myCheckBox.Text = "Check this box to set today as the
end date."
PlaceHolder1.Controls.Add(myCheckBox)
End If
End If
End Sub
I have a datagrid control declared as below:
<asp
OnItemDataBound="DGrid_ItemDataBound" Width="353px" Font-Size="Smaller"
Font-Names="Arial" CellSpacing="1" CellPadding="3" EnableViewState="False"
AutoGenerateColumns="False">
<AlternatingItemStyle backcolor="#E0E0E0"></AlternatingItemStyle>
<HeaderStyle backcolor="LightYellow"></HeaderStyle>
<Columns>
<asp:BoundColumn DataField="Account_ID"
HeaderText="Account_ID"></asp:BoundColumn>
<asp:BoundColumn DataField="Carrier_Name" HeaderText="Carrier
Name"></asp:BoundColumn>
<asp:BoundColumn DataField="Carrier_Entity" HeaderText="Carrier
Entity"></asp:BoundColumn>
<asp:BoundColumn DataField="First_Name" HeaderText="First
Name"></asp:BoundColumn>
<asp:BoundColumn DataField="Office_Address"
HeaderText="Office_Address"></asp:BoundColumn>
<asp:BoundColumn DataField="Office_City"
HeaderText="Office_City"></asp:BoundColumn>
<asp:BoundColumn DataField="Office_ZipCode"
HeaderText="Office_ZipCode"></asp:BoundColumn>
<asp:BoundColumn DataField="Work_Phone"
HeaderText="Work_Phone"></asp:BoundColumn>
<asp:BoundColumn DataField="Start_Date"
HeaderText="Start_Date"></asp:BoundColumn>
<asp:BoundColumn DataField="End_Date"
HeaderText="End_Date"></asp:BoundColumn>
<asp:BoundColumn DataField="End_Date"
HeaderText="End_Date"></asp:BoundColumn>
<asp
</Columns>
</asp
The requirement is to check the filed "End_Date" from the table. If this
field is empty then I need to display a check box on that cell of the
datagrid control.
When user check on the check box in the cell, I need to update Current
date to the field "End Date" of that table.
I was working with displaying the checkbox(es) on the cells and tried to
replace an empty field on the cell of datagrid control by a check box . I'd
like to declare a placeholder in the datagrid control and get the error :
"System.Web.UI.WebControls.DataGridColumnCollection must have items of type
'System.Web.UI.WebControls.DataGridColumn'. 'asp
'System.Web.UI.WebControls.PlaceHolder'."
Do you know where I can declare the placeholder ? ?? I worked with
DataList control . Besides, what is the event hander I should use when user
click on the check box to update the Cureent date to End_Date field ???
I'm thinking about "SelectedIndexChange". Is that correct ??
Please help me !!! Thank you.
Sub DGrid_ItemDataBound(sender As Object, e As DataGridItemEventArgs)
If e.Item.ItemType = ListItemType.Item Or _
e.Item.ItemType = ListItemType.AlternatingItem Then
Dim drv As DataRowView = CType(e.Item.DataItem, DataRowView)
Dim EDate As Object = CType(drv.row("End_Date"),Object)
If IsDbNull(EDate) Then
Dim myCheckBox As Checkbox = New CheckBox()
myCheckBox.Text = "Check this box to set today as the
end date."
PlaceHolder1.Controls.Add(myCheckBox)
End If
End If
End Sub