Solved

datagridview+datatable+event in C#

Posted on 2011-03-21
5
309 Views
Last Modified: 2012-05-11
hi all,
I am using C#+window application.

my code is as follow:
datagridview1.datasource=dataTable1;

What is the names of the events that i can use  to write my code before add new row add after add a new row to the datagridview during the binding source.
0
Comment
Question by:MKItani
  • 2
  • 2
5 Comments
 
LVL 13

Expert Comment

by:Naman Goel
ID: 35182231
you can use DataGridView.RowsAdded Event for this

refer to following MSDN link for more details :

http://www.experts-exchange.com/Programming/Languages/C_Sharp/Q_26900450.html
0
 

Author Comment

by:MKItani
ID: 35182289
the link is failed. it is the link of the task and not for msdn.
Please checked
0
 
LVL 13

Accepted Solution

by:
Naman Goel earned 500 total points
ID: 35182311
0
 
LVL 6

Expert Comment

by:r3nder
ID: 35182393
Here is what I do
             
if (Whatever the condition)
        {
            
            SqlConnection con = new SqlConnection("user id=user;" +
                                           "password=pass;server=127.0.0.0;" +
                                           "Trusted_Connection=yes;" +
                                           "database=db; " +
                                           "connection timeout=30");
           // Retrieving data from Stored Proceedure and bind it to datagrid
           try
           {
               con.Open();
               SqlCommand com = new SqlCommand("spx_storedProcName", con);
               com.CommandType = CommandType.StoredProcedure;
               SqlDataAdapter adapter = new SqlDataAdapter(com);
               DataTable tbl = new DataTable();
               adapter.Fill(tbl);
               DataGrid1.DataSource = tbl;
               DataGrid1.DataBind();
               Response.Write(DataGrid1.Columns[1].ToString());
               
               

           }
           catch (Exception ex)
           {
               Response.Write(ex.Message);
               con.Close();
           }

        }

Open in new window

0
 

Author Closing Comment

by:MKItani
ID: 35431824
failed
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question