473,387 Members | 1,517 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

grid

how to select particular row in datagrid when checkbox in datagrid is selected and also inserted into database

pls help me.it is need for my mca project.
Apr 29 '08 #1
6 977
vee10
141 100+
u can check out this link

http://www.codeproject.com/KB/webforms/datagridcheckbox.aspx





how to select particular row in datagrid when checkbox in datagrid is selected and also inserted into database

pls help me.it is need for my mca project.
Apr 29 '08 #2
Frinavale
9,735 Expert Mod 8TB
how to select particular row in datagrid when checkbox in datagrid is selected and also inserted into database

pls help me.it is need for my mca project.
Add a CheckBox column to your grid.
Then when you are ready to update your database, loop through your grid and determine which ones were selected...

eg

Expand|Select|Wrap|Line Numbers
  1. For Each row in MyGridView.Rows
  2.    Dim chkBox as CheckBox = Ctype(row.FindControl("nameOfMyCheckboxInTheGrid"),Checkbox)
  3.    If chkBox.Checked = True
  4.       'Do your update
  5.    End If
  6. Next
  7.  
-Frinny
Apr 29 '08 #3
Hi,

How to select particular row in datagrid when checkbox in datagrid is selected and also inserted into database.

sorry for the disturbance.

i need c# coding and also insert particular row coding.or multiple row insertion coding.

pls help me.
Apr 30 '08 #4
vee10
141 100+
Hi,

I think on checking the checkbox in the datagrid any of the events is going to fire so u should place a button and do the necessay thing u want to do

if u get any solution plz share that




Hi,

How to select particular row in datagrid when checkbox in datagrid is selected and also inserted into database.

sorry for the disturbance.

i need c# coding and also insert particular row coding.or multiple row insertion coding.

pls help me.
Apr 30 '08 #5
i want to know how to insert each cell in the datagrid to the database.

pls help me.
May 1 '08 #6
vee10
141 100+
hi..

Expand|Select|Wrap|Line Numbers
  1.  
  2.         SqlConnection conn = new SqlConnection("Data Source=PRAVEENAPC;Initial Catalog=testing;Integrated Security=True");
  3.         conn.Open();
  4.         SqlCommand cmd = new SqlCommand();
  5.         cmd.CommandText = "insert into emp values(";
  6.         cmd.Connection = conn;
  7.         for (int i = 0; i < GridView1.Columns.Count; i++)
  8.         {
  9.             cmd.CommandText  = cmd.CommandText + "'" + GridView1.Rows[0].Cells[i].Text + "'";
  10.             if (i + 1 != GridView1.Columns.Count)
  11.                 cmd.CommandText = cmd.CommandText + ",";
  12.                   }
  13.  
  14.         cmd.CommandText = cmd.CommandText + ")";
  15.  
  16.         int insert=cmd.ExecuteNonQuery();
  17.  
this is one way of inserting the values into database

there are other way using parameter etc.....
but this is how u can retrieve the rows in database


i want to know how to insert each cell in the datagrid to the database.

pls help me.
May 1 '08 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Piet | last post by:
Hello, I have written a small program which dynamically displays data from a data structure in a wx.grid. The grid reacts as expected when the data structure is enlarged: a new row is added and...
0
by: scottmallory | last post by:
Greetings, I am new to Python...and I am having some difficulty updating a grid (wx.grid.PyGridTableBase). Everything works just fine (adding /deleting/ resizing rows, cols) except updating...
4
by: Filippo Pandiani | last post by:
I have a grid that shows the file list from a folder. On the postback, how do I get a Dataset from this grid? Thanks, Filippo.
117
by: phil-news-nospam | last post by:
Is there really any advantage to using DIV elements with float style properies, vs. the old method of TABLE and TR and TD? I'm finding that by using DIV, it still involves the same number of...
3
by: kaczmar2 | last post by:
Hey there, I have a large image in a browser window, and I would like a way to overlay grid lines on top of the image, so a user can show the grid or hide the grid lines. The grid would cover...
0
by: BH | last post by:
Hi, I am trying to build my own IHM with two treeCtrl and 1 grid, based on the wx.aui demos. My problem is with the Grid. It dosen't have scrollbars. I tried many methods (fit) but it always...
6
by: Romulo NF | last post by:
Greetings again to everyone, Im back to show this grid componenet i´ve developed. With this grid you can show the data like a normal table, remove the rows that you need, add rows, import data,...
5
by: gaya3 | last post by:
Hi, can anyone find error in the following example <%@ include file="JspBean.jsp" %> <%@ page import="java.util.*"%> <html> <head> <%
2
by: skanemupp | last post by:
so my little calculator works perfectly now. just having some trouble with the layout. this whole tkinter-thing seems to be more tricky than it should be. how can i make the 4 column of buttons...
1
by: Francesco Bochicchio | last post by:
Il Mon, 18 Aug 2008 12:15:10 +0100, dudeja.rajat ha scritto: Uhm, I don't think you should use the grid manager to obtain a window like that. The grid manager is for equally distributing...
0
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,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
Oralloy
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.