Hi,
I have a datagrid that contains a checkbox template column. I have followed
the sample in Q306227, but I have a problem evaluating the content of the
datagrid columns to decide a value for the checkboxes check property.
According to the sample I should use this statement in the BindCheckbox
event to evaluate a column:
Public Sub BindCheckBox(ByVal sender As Object, ByVal e As EventArgs)
'Create a new instance of a CheckBox.
Dim oCheckBox As CheckBox = CType(sender, CheckBox)
Dim container As DataGridItem = CType(oCheckBox.NamingContainer,
DataGridItem)
'Evaluate the data from the Grid item and set the Checked property
' appropriatly
If container.DataItem("contract").GetType.ToString = "System.DBNull"
Then
oCheckBox.Checked = False
Else
oCheckBox.Checked = CBool(container.DataItem("contract"))
End If
End Sub
The problem here is that my project is configured to use "Option Strict" and
does therefore not allow the statement
If container.DataItem("contract").GetType.ToString = "System.DBNull" Then
I tried to use Container.cells(2).text instead, but this only returns a
empty string in all rows.
Any suggestions on how to to do this ?
Regards
Niclas 2 2186
Hi, Niclas
Why not try
If IsDBNull(container.DataItem("contract")) The
oCheckBox.Checked = Fals
Els
oCheckBox.Checked = CBool(container.DataItem("contract")
End I
Bin Song, MC
----- Niclas Lindblom wrote: ----
Hi
I have a datagrid that contains a checkbox template column. I have followed
the sample in Q306227, but I have a problem evaluating the content of the
datagrid columns to decide a value for the checkboxes check property
According to the sample I should use this statement in the BindCheckbox
event to evaluate a column
Public Sub BindCheckBox(ByVal sender As Object, ByVal e As EventArgs
'Create a new instance of a CheckBox
Dim oCheckBox As CheckBox = CType(sender, CheckBox
Dim container As DataGridItem = CType(oCheckBox.NamingContainer,
DataGridItem
'Evaluate the data from the Grid item and set the Checked propert
' appropriatl
If container.DataItem("contract").GetType.ToString = "System.DBNull"
The
oCheckBox.Checked = Fals
Els
oCheckBox.Checked = CBool(container.DataItem("contract")
End I
End Su
The problem here is that my project is configured to use "Option Strict" and
does therefore not allow the statemen
If container.DataItem("contract").GetType.ToString = "System.DBNull" The
I tried to use Container.cells(2).text instead, but this only returns a
empty string in all rows
Any suggestions on how to to do this
Regard
Niclas
Hi, Niclas
Why not try
If IsDBNull(container.DataItem("contract")) The
oCheckBox.Checked = Fals
Els
oCheckBox.Checked = CBool(container.DataItem("contract")
End I
Bin Song, MC
----- Niclas Lindblom wrote: ----
Hi
I have a datagrid that contains a checkbox template column. I have followed
the sample in Q306227, but I have a problem evaluating the content of the
datagrid columns to decide a value for the checkboxes check property
According to the sample I should use this statement in the BindCheckbox
event to evaluate a column
Public Sub BindCheckBox(ByVal sender As Object, ByVal e As EventArgs
'Create a new instance of a CheckBox
Dim oCheckBox As CheckBox = CType(sender, CheckBox
Dim container As DataGridItem = CType(oCheckBox.NamingContainer,
DataGridItem
'Evaluate the data from the Grid item and set the Checked propert
' appropriatl
If container.DataItem("contract").GetType.ToString = "System.DBNull"
The
oCheckBox.Checked = Fals
Els
oCheckBox.Checked = CBool(container.DataItem("contract")
End I
End Su
The problem here is that my project is configured to use "Option Strict" and
does therefore not allow the statemen
If container.DataItem("contract").GetType.ToString = "System.DBNull" The
I tried to use Container.cells(2).text instead, but this only returns a
empty string in all rows
Any suggestions on how to to do this
Regard
Niclas This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Ann Morris |
last post by:
INTRODUCTION
One of the most powerful aspects of .NET and Windows Forms is data
binding. Data binding is the process of associating user interface
(UI) elements with a data source to generate a...
|
by: ad |
last post by:
I use the code to create a DataGrid and filled with data,
But the DataGrid1 didn't display in WebForm.
How can I display the DataGrid after creating it?
DataGrid DataGrid1 = new DataGrid();
|
by: Niclas Lindblom |
last post by:
Hi,
I have a datagrid that contains a checkbox template column. I have followed
the sample in Q306227, but I have a problem evaluating the content of the
datagrid columns to decide a value for...
|
by: Julia Hu |
last post by:
Hi,
I have a datagrid, and in different rows I need to
programmatically bind different type of controls and load
data into these controls. For example,in the first row I
need to bind data into a...
|
by: Craig |
last post by:
How do I programmatically change the text property of a label in an
ItemTemplate in a datagrid?
Specifically the Text property. I want to change the databinding to another
column at runtime.
...
|
by: Andre Ranieri |
last post by:
Hi folks,
I have a datagrid which contains a template item checkbox column. I've
included a checkbox as a HeaderTemplate item which fires a server-side
function to check or uncheck all the...
|
by: Richard L Rosenheim |
last post by:
I have a dataset containing a parent table related to a child table. The
child table contains an ID field (which is configured as autonumber in the
datatable), the ID of the parent, plus some...
|
by: Brad Shook |
last post by:
I am trying to bind one column of a datagrid to a seperate textbox and
the rest of the fields to a datagrid. the comments are too large to
fit in a datagrid so I created a textbox below the...
|
by: David C |
last post by:
I followed the torial using this from MSDN
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vste
chart/html/vbtchCreatingWebServerControlTemplatesProgrammatically.asp
to...
|
by: Andrew Jocelyn |
last post by:
Hi
How do I programmatically change (read/write) the values in this app.config
file at runtime? Specifically I want to change the client endpoint address
but it would be nice to change other...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |