PC Review


Reply
Thread Tools Rate Thread

CheckBox in a DataGrid and a datatable field

 
 
Just D
Guest
Posts: n/a
 
      24th May 2004
Hi All,

Does anybody know how to write the following code?

I have a database table with a few columns including: ID [int], "Task"
[varchar], ForceRun [bit]. I need to show the DataGrid on the ASPX page with
these selected fields and allow user to click one or more CheckBox controls
to activate this bit on the database table for a required ID.

I have already added a template column to the DataGrid and I can get the
CheckBox status from this CheckBox for each string. If I click a button
"Apply" on this page I can get a full list of changed items and send a SQL
command to the database to activate these bits. It works, but...

The customer wants this aspx page to be updated automatically, once per
selected time, for example one time per 10 seconds. I think that I have only
two possible ways to do that.

1. I need to read the status of these CheckBox controls from the DataGrid
and create a SQL string to send to the database immediately after changes,
just after the user clicked this control.
2. Wait for the auto refresh and work with the whole DataGrid before the
page is updated. I have this functions but I don't know how to call it
before updating of the page.

I used this tag to reload the page automatically. It works fine.

<meta http-equiv="refresh" content="10">

But it causes a full reload of the page including the datagrid and I can't
get the CheckBox status on Page_Load() because the DataGrid resets every
time on Page_Load(). I think that I need some event to check the status of
these CheckBox controls in the DataGrid before content reloading. But how?
If I go the first way, what event should I use to understand that the user
clicked the CheckBox to work with these changes after the changes have been
done before page refreshing?

Thanks,
Just D.

 
Reply With Quote
 
 
 
 
Calvin Luttrell/ProjectThunder.com
Guest
Posts: n/a
 
      24th May 2004
Just D,

I think I would look in to the ItemCreated even on the datagrid. You should be able to access the controls property from each cell. Very creative solution BTW. Did you think about just making a background process to reset these values?


-Calvin Luttrell
ProjectThunder.com

> Does anybody know how to write the following code?
>
> I have a database table with a few columns including: ID [int], "Task"
> [varchar], ForceRun [bit]. I need to show the DataGrid on the ASPX page with
> these selected fields and allow user to click one or more CheckBox controls
> to activate this bit on the database table for a required ID.
>
> I have already added a template column to the DataGrid and I can get the
> CheckBox status from this CheckBox for each string. If I click a button
> "Apply" on this page I can get a full list of changed items and send a SQL
> command to the database to activate these bits. It works, but...
>
> The customer wants this aspx page to be updated automatically, once per
> selected time, for example one time per 10 seconds. I think that I have only
> two possible ways to do that.
>
> 1. I need to read the status of these CheckBox controls from the DataGrid
> and create a SQL string to send to the database immediately after changes,
> just after the user clicked this control.
> 2. Wait for the auto refresh and work with the whole DataGrid before the
> page is updated. I have this functions but I don't know how to call it
> before updating of the page.
>
> I used this tag to reload the page automatically. It works fine.
>
> <meta http-equiv="refresh" content="10">
>
> But it causes a full reload of the page including the datagrid and I can't
> get the CheckBox status on Page_Load() because the DataGrid resets every
> time on Page_Load(). I think that I need some event to check the status of
> these CheckBox controls in the DataGrid before content reloading. But how?
> If I go the first way, what event should I use to understand that the user
> clicked the CheckBox to work with these changes after the changes have been
> done before page refreshing?


 
Reply With Quote
 
Just D
Guest
Posts: n/a
 
      24th May 2004
Hi Calvin,

Thanks for your answer. Yes, I'm able to get the CheckBox status in every
cell. You can take a look, it was very helpful to write my own code based on
this example:

http://support.microsoft.com/default...b;EN-US;320707

But the problem was - I can't get the event when this click happened to
create a SQL command and send to the database automatically, without "Apply"
button as was used in this example. That's a problem for me.

ItemCreated... It's really not like ItemCreated, I just change the status of
the CheckBox control in the cells, I can get all cells with these changes
using foreach like in the example above, but to catch this moment when I
should do that, it's a real problem.

Probably I could use Select/Edit/Cancel ot whatever, it has its own event
that I can catch, but the customer wants to get a CheckBox only.

Thanks,
Just D.
"Calvin Luttrell/ProjectThunder.com" <(E-Mail Removed)> wrote in
message news:%(E-Mail Removed)...
Just D,

I think I would look in to the ItemCreated even on the datagrid. You
should be able to access the controls property from each cell. Very creative
solution BTW. Did you think about just making a background process to reset
these values?


-Calvin Luttrell
ProjectThunder.com

> Does anybody know how to write the following code?
>
> I have a database table with a few columns including: ID [int], "Task"
> [varchar], ForceRun [bit]. I need to show the DataGrid on the ASPX page

with
> these selected fields and allow user to click one or more CheckBox

controls
> to activate this bit on the database table for a required ID.
>
> I have already added a template column to the DataGrid and I can get the
> CheckBox status from this CheckBox for each string. If I click a button
> "Apply" on this page I can get a full list of changed items and send a

SQL
> command to the database to activate these bits. It works, but...
>
> The customer wants this aspx page to be updated automatically, once per
> selected time, for example one time per 10 seconds. I think that I have

only
> two possible ways to do that.
>
> 1. I need to read the status of these CheckBox controls from the

DataGrid
> and create a SQL string to send to the database immediately after

changes,
> just after the user clicked this control.
> 2. Wait for the auto refresh and work with the whole DataGrid before the
> page is updated. I have this functions but I don't know how to call it
> before updating of the page.
>
> I used this tag to reload the page automatically. It works fine.
>
> <meta http-equiv="refresh" content="10">
>
> But it causes a full reload of the page including the datagrid and I

can't
> get the CheckBox status on Page_Load() because the DataGrid resets every
> time on Page_Load(). I think that I need some event to check the status

of
> these CheckBox controls in the DataGrid before content reloading. But

how?
> If I go the first way, what event should I use to understand that the

user
> clicked the CheckBox to work with these changes after the changes have

been
> done before page refreshing?


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
writeable checkbox in datagrid from bit field in table hazz Microsoft ASP .NET 4 27th Apr 2006 09:15 PM
Re: CheckBox in a DataGrid and a datatable field Just D Microsoft ASP .NET 0 24th May 2004 06:39 AM
Re: CheckBox in a DataGrid and a datatable field Just D Microsoft C# .NET 0 24th May 2004 06:39 AM
CheckBox in a DataGrid and a datatable field Just D Microsoft ASP .NET 0 24th May 2004 06:01 AM
CheckBox in a DataGrid and a datatable field Just D Microsoft C# .NET 0 24th May 2004 06:01 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:07 PM.