Click here to Skip to main content
15,905,325 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Dear all,

I have a gridview and it is having data. The cells are not editable i tried but could not make them editable.

Then i want that when i click on the cell the value should be filled in the textbox.


Regards,
Vengaqua
Posted
Updated 2-Sep-13 23:05pm
v2

 
Share this answer
 
Hi...
See this link, textbox appeare when edit the gridview.
http://www.aspdotnet-suresh.com/2011/02/how-to-inserteditupdate-and-delete-data.html[^]
thank u.
 
Share this answer
 
hi,


this is an sample code you can use
you can use
HTML
OnRowCommand="Countrylist_RowCommand"



in c#
protected void Countrylist_RowCommand(object sender, GridViewCommandEventArgs e)//TO FETCH PARTICULAR RECORD SELECTED FROM GRID FOR EDIT
       {
           if (e.CommandName == "EditRow")
           {
               string strCode = (string)e.CommandArgument;
               txt_countryid.Text = strCode;
              con.Open;
               DataSet ds = new DataSet();
               OleDbDataReader reader = null;
               OleDbCommand cmd = new OleDbCommand();
               cmd = new OleDbCommand("select * from Country_master where CountryId=" + strCode + "", con);
               reader = cmd.ExecuteReader();
               while (reader.Read())
               {
                   txt_countrycode.Text = reader["CountryCode"].ToString();
                   txt_countryname.Text = reader["CountryName"].ToString();

               }
               con.Close();
           }
       }




Hope this Helps you
happy coding :)
 
Share this answer
 
Hi..
here are the links which may help you

How to Bind the DataTable to Gridview in asp.net using c#.net



Happy Coding.. :)
 
Share this answer
 
v3

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