473,396 Members | 2,055 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,396 software developers and data experts.

Can anybody give code for GridView1_RowUpdating()

Expand|Select|Wrap|Line Numbers
  1. DataSet ds = new DataSet();
  2. DataTable dtAddUsers = new DataTable("Names");
  3.  
  4. public void CreateDataset()
  5. {
  6. dtAddUsers.Columns.Add("Name", typeof(String));
  7. dtAddUsers.Columns.Add("Place", typeof(String));
  8.  
  9. ds.Tables.Add(dtAddUsers);
  10.  
  11. ViewState["Dataset"] = ds;
  12. }
  13.  
  14. protected void Page_Load(object sender, EventArgs e)
  15. {
  16. if(!IsPostBack)
  17. {
  18. CreateDataset();
  19. }
  20. }
  21. protected void Button1_Click(object sender, EventArgs e)
  22. {
  23. DataSet ds = new DataSet();
  24. ds = (DataSet)ViewState["Dataset"];
  25.  
  26. DataRow dr = ds.Tables[0].NewRow();
  27.  
  28. dr["Name"] = TextBox1.Text;
  29. dr["Place"] = TextBox2.Text;
  30.  
  31. ds.Tables[0].Rows.Add(dr);
  32.  
  33. GridView1.DataSource = ds.Tables[0];
  34. GridView1.DataBind();
  35.  
  36. ViewState["Dataset"] = ds;
  37.  
  38. TextBox1.Text = string.Empty;
  39. TextBox2.Text = string.Empty;
  40.  
  41. }
  42.  
  43. protected void GridView1_RowDeleting(object sender,
  44. GridViewDeleteEventArgs e)
  45. {
  46. DataSet ds = new DataSet();
  47. ds = (DataSet)ViewState["Dataset"];
  48.  
  49. ds.Tables[0].Rows.RemoveAt(e.RowIndex);
  50.  
  51. GridView1.DataSource = ds.Tables[0];
  52. GridView1.DataBind();
  53. }
  54. protected void GridView1_RowEditing(object sender,
  55. GridViewEditEventArgs e)
  56. {
  57. DataSet ds = new DataSet();
  58. ds = (DataSet)ViewState["Dataset"];
  59.  
  60. GridView1.EditIndex = e.NewEditIndex;
  61.  
  62. GridView1.DataSource = ds.Tables[0];
  63. GridView1.DataBind();
  64. }
  65.  
  66. protected void GridView1_RowCancelingEdit(object sender,
  67. GridViewCancelEditEventArgs e)
  68. {
  69. DataSet ds = new DataSet();
  70. ds = (DataSet)ViewState["Dataset"];
  71.  
  72. GridView1.EditIndex = -1;
  73.  
  74. GridView1.DataSource = ds.Tables[0];
  75. GridView1.DataBind();
  76. }
Can anybody give code for GridView1_RowUpdating()
Apr 23 '07 #1
3 5889
tlhintoq
3,525 Expert 2GB
TIP: When you are writing your question, there is a button on the tool bar that wraps the [code] tags around your copy/pasted code. It helps a bunch. Its the button with a '#' on it. More on tags. They're cool. Check'em out.
Feb 4 '10 #3
tlhintoq
3,525 Expert 2GB
Database How-to parts 1 and 2
Database tutorial Part 1
Database tutorial Part 2

Can anybody send me code to [...]
The Bytes volunteers are not here to write your code for you. This is not a free homework service.
Bytes is very much a "Give me a fish I eat for a day. Teach me to fish I eat for a lifetime" kind of place. Just giving you the code doesn't help you learn near as effectively as good old-fashioned trial and error.

Do a little reading up and experimenting then if your trials aren't doing what you expect, post the code and relevant messages/errors and we'll see what we can do to point you in the right direction for making it work.
Feb 4 '10 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: news.microsoft.com | last post by:
Dear all, I have to do a source code editor to implement syntax hilighted with special colors , IntelliSense function. Could anybody give me some tips or links? Thanks,
1
by: Hartmut Dippon | last post by:
Hello, does anybody know how I can access and modify properties of my frameset within my code behind class, or is that not possible at all? I tried to find anything in the internet about this...
1
by: carl bloc | last post by:
Have this much done but need help with this bit of code: allow user to modify existing draw data. I think I need a counter to give week numbers so the user can select a week number rather than a...
0
by: shashi | last post by:
i want to learn more about data grid viewer in vb 2005 and more about Sql server 2005 sent links , doc files etc to me regarding my problem thanks in advance hoping for reply
1
by: vikas2923 | last post by:
Thanx for ur reply but could you please tell me the code for uploading one image through FSO because i am new to this filed Thanx
1
by: Ripendra007 | last post by:
hi all, i m doing one application of emailler which will send some campaign with some emailler..now i send this emailler to paricular user at that time i m storing the email id in database that i...
0
by: Hank Gong | last post by:
Hi, all I programmed by python to draw some simple images on the canvas in wxPython. I found there is a PostScriptDC in wxPython. However, I can not find an example about how to use it. Can...
5
by: sandeepm | last post by:
Can anybody give me the exact syntax to rename a column in DB2??
1
by: Manju das | last post by:
How to give code in C#.NET for deleting a row from a Datagridview tool by simply selecting it or else in the click event of a button? what is the error in this code? SqlConnection con = new...
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:
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.