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

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 2438
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
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
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
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
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
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
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
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
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
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
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
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
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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...
0
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,...
0
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...

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.