Having a column with a checkbox where when the checkbox changes, it updates a table.

ASP.NET

    Next

  • 1. Reg- Dynamic tab strip and Multipage
    Tying to create Dynamic tab strip and Multipage using webcontols . Not able to wire the event selectedindexchanged event to tabstrip any sample code or links will be very helpfull Thanks what is am trying to do inpage class is tabStrip= new TabStrip(); tabStrip.ID="Tab Strip"; tabStrip.SelectedIndex=0; tabStrip.BackColor=Color.Red; tabStrip.SelectedIndexChange +=new EventHandler(tabStrip_SelectedIndexChange); for (int i =0;i<array.Count;i++) { tab= new Tab(); tab.Text=array[i]+"||".ToString(); tab.DefaultStyle.CssText="width:100px;text-align:center;color:Red"; tabStrip.Items.Add(tab); } this.Controls.Add(tabStrip);
  • 2. How to connect Access database .mdb under windows XP
    I used the Data Form wizard of .NET to create a C# dataset form to query the data from an Access database file "MWIND.MDB", but I kept getting following message when I run the web form on XP only "The Microsoft Jet database engine cannot open the file 'C:\mydb\NWIND.MDB'. It is already opened exclusively by another user, or you need permission to view its data." I tried other similar dataase file and it ws same result. It is OK under Windows 2000. I also tried by maually creating the connection string as @"Provider=""Microsoft.Jet.OLEDB.4.0"";Data Source=""C:\mydb\NWIND.MDB"";User ID=Admin;Password=;"; But I got the similar message anyway. Is there something in Access ODBC needed to be changed? Thanks for any tip. Chi Chang
  • 3. Need help with Datagrid column button
    Hi I have a web form with a Datagrid. Within the data grid I have a Column button. If the button is of type "Linkbutton" my VB code-behind will catch the users "click" However, if it is set to "Pushbutton" I am unable to trap the users click. See code Below. I don't understand what I am missing. why won't the "Pushbutton" work? VB code Behind: Private Sub DataGrid1_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles DataGrid1.ItemCommand 'get value of row here End Sub HTML: <body MS_POSITIONING="GridLayout"> <form id="Form1" method="post" runat="server"> <asp:DataGrid id="DataGrid1" style="Z-INDEX: 101; LEFT: 80px; POSITION: absolute; TOP: 140px" runat="server" Width="484px"> <Columns> <asp:ButtonColumn Text="Select" ButtonType="PushButton" CommandName="Select"></asp:ButtonColumn> </Columns> </asp:DataGrid> </form> </body>
  • 4. How to change header captions
    How can I change header captions when working with a bound DataGrid in ASP.Net? I am looking for a way to do this without involving the SQL. Thank you.
  • 5. please DataGrid vs. GridView
    GridView is a more functional Control in Whidbey

Having a column with a checkbox where when the checkbox changes, it updates a table.

Postby Mufasa » Sat, 17 Nov 2007 04:20:24 GMT

I have a datagrid with a checkbox as a column that I read from a DB. I would 
like to have it so that when a user clicks the checkbox it will 
automatically save it to the DB so there doesn't have to be a submit/save 
button. I realize I'm going to have to use autopostback and I plan on using 
an Ajax UpdatePanel so it only updates the datagrid - not the whole page.

How can I implement this?

TIA - Jeff.



Similar Threads:

1.Problem sorting a Datagrid with Checkbox columns (checkboxes not following sort)

I am trying to sort a datagrid which contains 5 checkbox columns.  All
other columns sort properly except these 5 checkbox columns which dont
sort at all.

I am using ASP.NET 1.1 and this code is located in a user control.

The code snippet for binding the checkbox control is as follows and is
found in the ItemDataBound event for the datagrid.  It appears that
the index value never changes...it always seems to reference the
orginal dataset index.

Any help would be greatly appreciated.

try
{
System.Web.UI.WebControls.Image img1 =
(System.Web.UI.WebControls.Image)e.Item.Cells[7].Controls[1];
  int iIndx = e.Item.DataSetIndex;
  /*
0	Disabled
1	Approved
2	Waiting For Approval
3	Rejected
4	Locked
*/
int iResultSR = dsListBuilders.Tables["bb_saved_builders"].Rows[iIndx]
["sales_rep_approved"].ToString() == string.Empty?
2:int.Parse(dsListBuilders.Tables["bb_saved_builders"].Rows[iIndx]
["sales_rep_approved"].ToString());

               switch(iResultSR)
	{
	case 0:
	img1.ImageUrl="../../images/greybox.gif";
	break;
	case 1:
	img1.ImageUrl="../../images/checkboxyes.gif";
	break;
	case 2:
	img1.ImageUrl="../../images/checkboxno.gif";
	break;
	case 3:
	img1.ImageUrl="../../images/redcheckboxno.gif";
	break;
	case 4:
	img1.ImageUrl="../../images/lock.gif";
	break;
	default:
	img1.ImageUrl="../../images/checkboxno.gif";
	break;
	}
	}
	catch(Exception exBinding1)
	{
	//ignore...
	}

2.Problem sorting a Datagrid with Checkbox columns (checkboxes not f

Scott,

Instead of locating the data in the original table
  dsListBuilders.Tables["bb_saved_builders"].Rows[iIndx]
use the grid source data:
  DataRow row = (e.Item.ItemData is DataRow) ? e.Item.ItemData as DataRow : 
(e.Item.ItemData as DataRowView).Row;
  int iResultSR = (row["sales_rep_approved"].ToString() == 
string.Empty)?2:int.Parse(row["sales_rep_approved"].ToString());



"Scott" wrote:

> I am trying to sort a datagrid which contains 5 checkbox columns.  All
> other columns sort properly except these 5 checkbox columns which dont
> sort at all.
> 
> I am using ASP.NET 1.1 and this code is located in a user control.
> 
> The code snippet for binding the checkbox control is as follows and is
> found in the ItemDataBound event for the datagrid.  It appears that
> the index value never changes...it always seems to reference the
> orginal dataset index.
> 
> Any help would be greatly appreciated.
> 
> try
> {
> System.Web.UI.WebControls.Image img1 =
> (System.Web.UI.WebControls.Image)e.Item.Cells[7].Controls[1];
>   int iIndx = e.Item.DataSetIndex;
>   /*
> 0	Disabled
> 1	Approved
> 2	Waiting For Approval
> 3	Rejected
> 4	Locked
> */
> int iResultSR = dsListBuilders.Tables["bb_saved_builders"].Rows[iIndx]
> ["sales_rep_approved"].ToString() == string.Empty?
> 2:int.Parse(dsListBuilders.Tables["bb_saved_builders"].Rows[iIndx]
> ["sales_rep_approved"].ToString());
> 
>                switch(iResultSR)
> 	{
> 	case 0:
> 	img1.ImageUrl="../../images/greybox.gif";
> 	break;
> 	case 1:
> 	img1.ImageUrl="../../images/checkboxyes.gif";
> 	break;
> 	case 2:
> 	img1.ImageUrl="../../images/checkboxno.gif";
> 	break;
> 	case 3:
> 	img1.ImageUrl="../../images/redcheckboxno.gif";
> 	break;
> 	case 4:
> 	img1.ImageUrl="../../images/lock.gif";
> 	break;
> 	default:
> 	img1.ImageUrl="../../images/checkboxno.gif";
> 	break;
> 	}
> 	}
> 	catch(Exception exBinding1)
> 	{
> 	//ignore...
> 	}
> 
> 

3.A column of checkboxes (checkbox) in a list view (listview) control (.NET)

Hello!

In Visual Basic .NET (1.1)...

Is it possible to have a column of check boxes in a list view? So, for
example, a column named "Tested?" can have a boolean value assigned to
it in a nice, neat way?...

Product Name   |    Product version    |   Tested?
----------------------------------------------------
Prod1          |    1.1                |     [ ]
Prod2          |    2.0                |     [/]
Prod3          |    0.1                |     [ ]

etc...

If not, what would be a good workaround (images?)

Thanks a lot!

Al.

4.Master-Detail Datagrid -checkbox (once tick the checkbox, all the child checkbox is ticked)

Does anyone know how to do this ??
Thanks a lot


5.CheckBox: Changing Only Checkbox not Text Backcolor

Hi

I am attempting to only set the Backcolor of a checkbox portion of the Checkbox control, not the text portion.    Is it possible to separate the Backcolor text from the checkbox

Thanks
Mark

6. How to create a checkbox datatype column in a table in VB .net code

7. Update Checkbox Column in WebGrid

8. update checkbox values from gridview to database table.



Return to ASP.NET

 

Who is online

Users browsing this forum: No registered users and 65 guest