473,854 Members | 1,584 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How To Update Particular Row In GridView Using C#

16 New Member
Dear Sir.


Pls Give Me any One Ans how to update particular Row in GridView using C#


Regards
atul singh
Jul 14 '07 #1
12 65680
shweta123
692 Recognized Expert Contributor
Hi,

Can you please refer this

Link
Jul 14 '07 #2
singh79
16 New Member
Hi,

Can you please refer this

Link

I know how to update with HTML, But I want in C# How To Update

protected void PriceEp_RowUpda ting(object sender, GridViewUpdateE ventArgs e)
{

}
How to Update with The Help Of Csharp.Pls Any one Give Me Proper Solutions.


Regards
atul singh
Jul 16 '07 #3
thaj
3 New Member
Dear Sir.


Pls Give Me any One Ans how to update particular Row in GridView using C#


Regards
atul singh

in gridview property go to Events there doublic click of RowUpdating Event which will automaticall redirect into code behind...Inside the RowUpdating event u can code for updation

ex:
Protected Sub GridView1_RowUp dating(ByVal sender As Object, ByVal e As System.Web.UI.W ebControls.Grid ViewUpdateEvent Args) Handles GridView1.RowUp dating

int i ;
i = e.RowIndex;

so i contain rowindex now u can update appropriate row according to u r Stored Procedure
Jul 16 '07 #4
srilakshmim
22 New Member
I know how to update with HTML, But I want in C# How To Update

protected void PriceEp_RowUpda ting(object sender, GridViewUpdateE ventArgs e)
{

}
How to Update with The Help Of Csharp.Pls Any one Give Me Proper Solutions.


Regards
atul singh
Hi
In the rowupdating event
you write like this

protected void GridView1_RowUp dating(object sender, GridViewUpdateE ventArgs e)
{
TextBox txtName = (TextBox)GridVi ew1.Rows[e.RowIndex].FindControl("t xtName");



TextBox txtCity = (TextBox)GridVi ew1.Rows[e.RowIndex].FindControl("t xtCity");

//Your updation query pass the values like set city=' "+txtCity.Text+ " '

GridView1.EditI ndex = -1; //converts to normal mode from edit mode
// If having any bind method call here to see the updated rows

BindData();//(in this method write binding datasource to GridView1)


}
Thanks & Regards
Srilaskhmi.Mopi devi
Jul 16 '07 #5
singh79
16 New Member
I am written This Code Pls tell Me where Is problem...
Pls Give me Full Code...

pls help me
protected void PriceEp_RowUpda ting(object sender, GridViewUpdateE ventArgs e)
{

TextBox t1 = (TextBox)PriceE p.Rows[e.RowIndex].FindControl("t 1");
PriceEp.EditInd ex = -1;
string str = "Update EpTrans set EpCharge='"+t1. Text+"'";
EPCharge();
}

Regards
atul singh
Jul 17 '07 #6
shweta123
692 Recognized Expert Contributor
Hi,

Can you Please refer this Link
Jul 17 '07 #7
cmrhema
375 Contributor
Hi
In the rowupdating event
you write like this

protected void GridView1_RowUp dating(object sender, GridViewUpdateE ventArgs e)
{
TextBox txtName = (TextBox)GridVi ew1.Rows[e.RowIndex].FindControl("t xtName");



TextBox txtCity = (TextBox)GridVi ew1.Rows[e.RowIndex].FindControl("t xtCity");

//Your updation query pass the values like set city=' "+txtCity.Text+ " '

GridView1.EditI ndex = -1; //converts to normal mode from edit mode
// If having any bind method call here to see the updated rows

BindData();//(in this method write binding datasource to GridView1)


}
Thanks & Regards
Srilaskhmi.Mopi devi
Thank you very much SriLakshmi
Infact i had posted a query regarding the same a few backs ago.
i went through for loop and if loop and did all things which were of total failure
i came across this right now.
My problems solved.
The code which you provided roughly a fortnight has done wonders for me.
Thanks a bunch to you and the scripts.com
Regards
Hema
Aug 6 '07 #8
Brianbk
1 New Member
Dear Sir.


Pls Give Me any One Ans how to update particular Row in GridView using C#


Regards
atul singh
''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' '
reply From Brianbk
Briankorobele@w ebmail.co.za
The code it update Datagridview
believe me was running try this one

Dim constr As String = "Data Source=localhos t;Integrated Security=True"
Dim sqlstr As String = "select * from Customers"
Dim dt As New DataTable()
Private Sub btnLoad_Click(B yVal sender As System.Object, ByVal e As System.EventArg s) Handles btnLoad.Click
'Display the Table with data in the gridview
'clear the current content of the Table
dt.Clear()
'fill the datatable with data in the Database
Dim dpt As New SqlDataAdapter( sqlstr, constr)
dpt.Fill(dt)
dpt.Dispose()
'display the Table in the datagrid
datagridview1.D ataSource =dt
End Sub

End Class
Aug 18 '07 #9
britzer01
4 New Member
Hi
In the rowupdating event
you write like this

protected void GridView1_RowUp dating(object sender, GridViewUpdateE ventArgs e)
{
TextBox txtName = (TextBox)GridVi ew1.Rows[e.RowIndex].FindControl("t xtName");



TextBox txtCity = (TextBox)GridVi ew1.Rows[e.RowIndex].FindControl("t xtCity");

//Your updation query pass the values like set city=' "+txtCity.Text+ " '

GridView1.EditI ndex = -1; //converts to normal mode from edit mode
// If having any bind method call here to see the updated rows

BindData();//(in this method write binding datasource to GridView1)


}
Thanks & Regards
Srilaskhmi.Mopi devi

Good day... i have a problem with this code which i used it before and it really works. But when i used it again this code it returns the old value... but i dont know why?

In the gridview i set the column for example City column into a template and set the name to txtCity. Then i add the in edit column GridView1.EditI ndex = -1; and bind it again.

Now the code of GridView rowupdating events is:

TextBox txtCity = (TextBox)GridVi ew1.(TextBox)Gr idView1.Rows[e.RowIndex].FindControl("t xtCity");


and i assume that the txtCity.Text was the updated value but the old value returns. i dont know why it happen. i compared also my source code into the other which is working but there is no difference from it. Can you help me from this?
Aug 22 '07 #10

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

Similar topics

3
7215
by: Guru | last post by:
How do I refresh GridView using CallBack? I am populating the grid at runtime using OLEDB.
1
3282
by: =?Utf-8?B?SmF5Qw==?= | last post by:
I am trying to understand how to use an arraylist that contains data in a structure and bind the results to a gridview. Using vs2008 I have looked at the examples 315784 HOW TO: Bind a DataGrid Control to an Array of Objects or Structures by http://support.microsoft.com/?id=315784 316302 HOW TO: Bind a DataGrid Control to an ArrayList of Objects or Structures http://support.microsoft.com/?id=316302
6
4115
by: Garima12 | last post by:
There is a update panel,gridview and update progress. fetching the data from database and filling in gridview. at the time of processing update progress is working and showing processing........ My problem is : when once data is not found and i display in emptydatatext="no result" and again i search something, then updateprogreee shows processing...........as well as "no result" is displayed. I want to remove this "no result" as returned by...
1
7208
by: tina2626 | last post by:
how can i pass textbox value to gridview using C#.net at runtime not using database values. i m hving textbox1 and gridview1. can anyone suggest me to do this coding in ASP.NET(C# language).
1
5376
by: gopim | last post by:
gridview inside another gridview using Asp.net C#
0
2641
by: baburmm | last post by:
Hai, I want to get the footer textbox value in gridview using javascript any one help me Regards, Babu.K
0
912
by: bala venkata siva ram kum | last post by:
Hi friends, this is balu . I need to display values from sqldatabase to gridview.here in my database there are a lot of values.so i want to use gridview using cache.please tell me the code.
0
1223
by: panindra | last post by:
HI how can i update particular item of an itemrenderer of a list in flex dynamically?
1
2582
by: sakura | last post by:
Hi. I'm using asp.net and c# language. How can i display a GridView using select statement of two column in one table? This is my coding: if (sdr.Read()) { if(namaPembekal.Equals(sdr) && tarikhRo.Equals(sdr)) {
0
9752
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11031
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10763
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10371
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9518
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7918
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7082
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5942
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3188
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.