Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Dear All,

How to retrive the GridviewRows and how to use these values SQL Update Statement

Thank for advance, for ur valuable reply
Posted
Updated 29-Nov-11 18:06pm
v2
Comments
Karthik Harve 29-Nov-11 23:56pm    
tel us some information about what actually you are looking for. if possible add some of your code. then it would easy to give solutions.
2011999 30-Nov-11 0:20am    
in my grid five columns all data retrieve from database . this retrieve data only two columns edited only in grid. these process write the code in outside update button only. not inside gridupdate.

Hi
Please follow this steps

1. For next loop until the grid rows count.
2. Assign the current rows value into a data row or some other variable
3. Just update using adapter or construct query and raise an ExecuteNonquery.

That's all

Padmanaban.A
 
Share this answer
 
Comments
2011999 30-Nov-11 0:21am    
if possible send me sample code.

2. Assign the current rows value into a data row or some other variable
to fetch data from gridview use rowcommand event
C#
protected void fect_taskid(object sender, GridViewCommandEventArgs e)
   {

               int index = Convert.ToInt32(e.CommandArgument);
               GridViewRow row = GridView1.Rows[index];
               lblassinmentno.Text = row.Cells[1].Text;//assign any value of gridview cell by cell index
}

to update data see discussion
edit,update row in gridview
 
Share this answer
 
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900