473,507 Members | 4,494 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help with GridView

Hello,
I am new to ASP.net 2.0. I have successfully bound a in-memory DataTable
(not connected with a database) with GridView. I have set
AutoGenerateEditButton property to true. Now whenever i click on Edit
link, the page does postback, but the row does not become editable. I
have also tried
GridView1.Rows[e.NewEditIndex].RowState = DataControlRowState.Edit;
in RowEditing event handler. Is it something which I am missing.
Thanks in advance.

Maqsood Ahmed - MCAD.net
Kolachi Advanced Technologies
http://www.kolachi.net

*** Sent via Developersdex http://www.developersdex.com ***
Apr 15 '06 #1
4 2443
Hi,

if you do binding in code make sure that

a) You bind it in Page_Load inside "If Not Page.IsPostBack Then" check

b) you indeed change the index in RowEditing, and then bind the grid again

--
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU
http://blogs.aspadvice.com/joteke

"Maqsood Ahmed" <ma***********@gmail.com> wrote in message
news:OS**************@TK2MSFTNGP04.phx.gbl...
Hello,
I am new to ASP.net 2.0. I have successfully bound a in-memory DataTable
(not connected with a database) with GridView. I have set
AutoGenerateEditButton property to true. Now whenever i click on Edit
link, the page does postback, but the row does not become editable. I
have also tried
GridView1.Rows[e.NewEditIndex].RowState = DataControlRowState.Edit;
in RowEditing event handler. Is it something which I am missing.
Thanks in advance.

Maqsood Ahmed - MCAD.net
Kolachi Advanced Technologies
http://www.kolachi.net

*** Sent via Developersdex http://www.developersdex.com ***

Apr 15 '06 #2
Hell Teemu,
Thanks for your reply.
I am already checked IsPostBack property in Page_Load event handler.
Also I have not changed the index in the RowEditing event. The row
editing event handler looks like this::
protected void GridView1_RowEditing(object sender, GridViewEditEventArgs
e)
{
GridView1.Rows[e.NewEditIndex].RowState =
DataControlRowState.Edit;
}

Maqsood Ahmed - MCAD.net
Kolachi Advanced Technologies
http://www.kolachi.net

*** Sent via Developersdex http://www.developersdex.com ***
Apr 15 '06 #3
What if you do:

GridView1.EditIndex = e.NewEditIndex;

and then *do the binding of the grid again* as you do initially in
Page_Load.

--
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU
http://blogs.aspadvice.com/joteke

"Maqsood Ahmed" <ma***********@gmail.com> wrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
Hell Teemu,
Thanks for your reply.
I am already checked IsPostBack property in Page_Load event handler.
Also I have not changed the index in the RowEditing event. The row
editing event handler looks like this::
protected void GridView1_RowEditing(object sender, GridViewEditEventArgs
e)
{
GridView1.Rows[e.NewEditIndex].RowState =
DataControlRowState.Edit;
}

Maqsood Ahmed - MCAD.net
Kolachi Advanced Technologies
http://www.kolachi.net

*** Sent via Developersdex http://www.developersdex.com ***

Apr 16 '06 #4
Because the web is still a "stateless" medium, the problem might be
that the DataTable object is being destructed and re-created on each
round trip (postback) and so the DataBinding call is reseting
everything in your GridView. I beleive that for this to work the
DataTable object must be persisted (perhaps in the Session State or the
ViewState). The GridView is already persisted by the View State and
Control State.

Hope this helps.

Apr 17 '06 #5

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

Similar topics

28
10221
by: Tim_Mac | last post by:
hi, i'm new to .net 2.0, and am just starting to get to grips with the gridview. my page has autoEventWireUp set to true, which i gather is supposed to figure out which handlers to invoke when...
1
9331
by: Miguel Dias Moura | last post by:
Hello, I have a GridView in my page which is created in runtime. It works fine. My page has 2 Asp Buttons: - The HIDE button makes GridView.Visible = False; - The SHOW button makes...
0
2270
by: Aws | last post by:
My crazy GridView !! I am using Visual Studio 2005, I have a problem with my GridView. I have one access .mdb table and when I update a record on the table EVERYTHING is perfect. I made a Web...
0
1229
by: Wannabe | last post by:
I have been trying to figure this out for days now...can someone please help? I am using ASP.Net 2.0 and have a gridview on my page. I have everything working except the delete command. The page...
8
18068
by: Greg Lyles | last post by:
Hi all, I'm trying to develop an ASP.NET 2.0 website and am running into some real problems with what I thought would be a relatively simple thing to do. In a nutshell, I'm stuck on trying to...
4
3047
by: Bill | last post by:
Say I want to pull a bunch of records from a contacts database into a gridview and one of the fields contains an email address. Now suppose I want to make that email address clickable by putting it...
0
1507
by: trint | last post by:
I hope I can explain this clearly enough to get help. I have three gridviews that need to work from each other to display like a java verticle menu (just in the way it appears). GridView1 is...
0
2125
by: LiamLiamLiam | last post by:
G'day all. I having a problem with my formview. I'll ty to explain my situation as best as i can. I have a page with a search field at the top which is just a simple asp:textbox. Below that i...
0
4638
by: sharonrao123 | last post by:
hello all, I have a parent gridview company and in this one a nested gridview people, Is it possible to allow the user to select one row or multiple rows from the people gridview using a check box...
0
1524
by: joelgarcia007 | last post by:
I really hope someone can help me with this because it's really driving me crazy. I need to dynamically display multiple data tables on a page so I am using a Repeater to do so and in the...
0
7220
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7308
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,...
1
7023
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...
0
4702
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...
0
3188
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3178
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1534
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
757
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
410
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...

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.