Ask a Question related to ASP.NET Data Grid Control, Design and Development.
-
PaulNaude #1
Checkbox value in datagrid does not reflect appearance
I have a datagrid with boolean columns and as a test I display the value of
the checkbox in a label (not bound) as the user clicks in the grid cell.
Depending on the value of the checkbox as set by the user, my code should go
different routes.
My problem is that the value of that particular cell stays the same
regardless of its visible appearance. Only when the user re-enters the cell
after selecting a different row, does the value reflect the actual visibly
set value. The value then changes again but referencing it as set out below
shows the value when the user entered the cell.
In the datagrid's click event I used:
Label1.Text +=
DataSet71.Tables("MyTable").DefaultView.Item(DataG rid1.CurrentRowIndex).Item(1).ToString
and also
Label1.Text += DataGrid1.Item(DataGrid1.CurrentRowIndex, 1).ToString()
For each click the above event is fired and add to the label's text, but the
grid cell's value do not change, eventhough the checkbox visibly changes its
value. The true value is only displayed (in the label) on re-entering the
cell.
I need my code to run on the click event of the datagrid and the value of
the checkbox should determine what should happen.
How can I get the actual value (as displayed by the checkbox)?
PaulNaude Guest
-
DataGrid Buttons Appearance
I have been trying to figure out how to change the color of the Button on my datagrid. And when I try to change the back color it changes the color... -
Howto bind CheckBox to the datagrid/ Then update the database field when the checkbox is clicked.
I am trying to update the database field when the checkbox is clicked. I am trying to modified the following solution but.. got stuck on the... -
Datagrid does not reflect update
Hi all, The problem I have is when I assign an update to a datagrid cell, the change only shows after I mouse over it. If I turn off... -
Changing the appearance of datagrid
I need to change the datagrid header color to be solid blue instead of gradient blue. I tried of using style sheet and called that style in... -
Added CheckBox to a DataGrid Doesn't work with DataGrid.Enabled=False
I have created a Template Column and Added to a Datagrid, which contains a checkBox. The column is not Binded to any column of the Dataset, but is... -
Elton Wang #2
Re: Checkbox value in datagrid does not reflect appearance
Following code shows how to get value from a checkbox:
Dim ck As CheckBox = CType(e.Item.FindControl("checkbox_ID"), CheckBox )
Dim ckValue = ck.Checked.ToString
HTH
"PaulNaude" <PaulNaude@discussions.microsoft.com> wrote in message
news:49B03209-5145-4B86-842F-5B44A84AD3F3@microsoft.com...>I have a datagrid with boolean columns and as a test I display the value of
> the checkbox in a label (not bound) as the user clicks in the grid cell.
> Depending on the value of the checkbox as set by the user, my code should
> go
> different routes.
>
> My problem is that the value of that particular cell stays the same
> regardless of its visible appearance. Only when the user re-enters the
> cell
> after selecting a different row, does the value reflect the actual visibly
> set value. The value then changes again but referencing it as set out
> below
> shows the value when the user entered the cell.
>
> In the datagrid's click event I used:
>
> Label1.Text +=
> DataSet71.Tables("MyTable").DefaultView.Item(DataG rid1.CurrentRowIndex).Item(1).ToString
>
> and also
>
> Label1.Text += DataGrid1.Item(DataGrid1.CurrentRowIndex, 1).ToString()
>
> For each click the above event is fired and add to the label's text, but
> the
> grid cell's value do not change, eventhough the checkbox visibly changes
> its
> value. The true value is only displayed (in the label) on re-entering the
> cell.
>
> I need my code to run on the click event of the datagrid and the value of
> the checkbox should determine what should happen.
>
> How can I get the actual value (as displayed by the checkbox)?
Elton Wang Guest
-
PaulNaude #3
Re: Checkbox value in datagrid does not reflect appearance
Thanks but I am not sure how to reference any particular records' checkbox in
my datagrid, other than by specifying the cell.
I tried : Dim ck As CheckBox =
CType(DataGrid1.Item(DataGrid1.CurrentRowIndex, 1), CheckBox) but obviously
is not right.
Where do you put your code? If I paste it into the datagrid click event ,
'item' is not a member of 'e'.
thanks
"Elton Wang" wrote:
> Following code shows how to get value from a checkbox:
>
> Dim ck As CheckBox = CType(e.Item.FindControl("checkbox_ID"), CheckBox )
> Dim ckValue = ck.Checked.ToString
>
> HTH
>
> "PaulNaude" <PaulNaude@discussions.microsoft.com> wrote in message
> news:49B03209-5145-4B86-842F-5B44A84AD3F3@microsoft.com...>> >I have a datagrid with boolean columns and as a test I display the value of
> > the checkbox in a label (not bound) as the user clicks in the grid cell.
> > Depending on the value of the checkbox as set by the user, my code should
> > go
> > different routes.
> >
> > My problem is that the value of that particular cell stays the same
> > regardless of its visible appearance. Only when the user re-enters the
> > cell
> > after selecting a different row, does the value reflect the actual visibly
> > set value. The value then changes again but referencing it as set out
> > below
> > shows the value when the user entered the cell.
> >
> > In the datagrid's click event I used:
> >
> > Label1.Text +=
> > DataSet71.Tables("MyTable").DefaultView.Item(DataG rid1.CurrentRowIndex).Item(1).ToString
> >
> > and also
> >
> > Label1.Text += DataGrid1.Item(DataGrid1.CurrentRowIndex, 1).ToString()
> >
> > For each click the above event is fired and add to the label's text, but
> > the
> > grid cell's value do not change, eventhough the checkbox visibly changes
> > its
> > value. The true value is only displayed (in the label) on re-entering the
> > cell.
> >
> > I need my code to run on the click event of the datagrid and the value of
> > the checkbox should determine what should happen.
> >
> > How can I get the actual value (as displayed by the checkbox)?
>
>PaulNaude Guest
-
Elton Wang #4
Re: Checkbox value in datagrid does not reflect appearance
Please show your html view code of datagrid.
BTW, where do you process checkbox, in datagrid_ItemCommand, or some other
event?
"PaulNaude" <PaulNaude@discussions.microsoft.com> wrote in message
news:15DC995A-A35D-4513-A7AB-CE746251DDB1@microsoft.com...> Thanks but I am not sure how to reference any particular records' checkbox
> in
> my datagrid, other than by specifying the cell.
>
> I tried : Dim ck As CheckBox =
> CType(DataGrid1.Item(DataGrid1.CurrentRowIndex, 1), CheckBox) but
> obviously
> is not right.
>
> Where do you put your code? If I paste it into the datagrid click event ,
> 'item' is not a member of 'e'.
>
> thanks
>
> "Elton Wang" wrote:
>>> Following code shows how to get value from a checkbox:
>>
>> Dim ck As CheckBox = CType(e.Item.FindControl("checkbox_ID"), CheckBox )
>> Dim ckValue = ck.Checked.ToString
>>
>> HTH
>>
>> "PaulNaude" <PaulNaude@discussions.microsoft.com> wrote in message
>> news:49B03209-5145-4B86-842F-5B44A84AD3F3@microsoft.com...>>>> >I have a datagrid with boolean columns and as a test I display the value
>> >of
>> > the checkbox in a label (not bound) as the user clicks in the grid
>> > cell.
>> > Depending on the value of the checkbox as set by the user, my code
>> > should
>> > go
>> > different routes.
>> >
>> > My problem is that the value of that particular cell stays the same
>> > regardless of its visible appearance. Only when the user re-enters the
>> > cell
>> > after selecting a different row, does the value reflect the actual
>> > visibly
>> > set value. The value then changes again but referencing it as set out
>> > below
>> > shows the value when the user entered the cell.
>> >
>> > In the datagrid's click event I used:
>> >
>> > Label1.Text +=
>> > DataSet71.Tables("MyTable").DefaultView.Item(DataG rid1.CurrentRowIndex).Item(1).ToString
>> >
>> > and also
>> >
>> > Label1.Text += DataGrid1.Item(DataGrid1.CurrentRowIndex, 1).ToString()
>> >
>> > For each click the above event is fired and add to the label's text,
>> > but
>> > the
>> > grid cell's value do not change, eventhough the checkbox visibly
>> > changes
>> > its
>> > value. The true value is only displayed (in the label) on re-entering
>> > the
>> > cell.
>> >
>> > I need my code to run on the click event of the datagrid and the value
>> > of
>> > the checkbox should determine what should happen.
>> >
>> > How can I get the actual value (as displayed by the checkbox)?
>>
>>
Elton Wang Guest



Reply With Quote

