473,325 Members | 2,805 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,325 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 2435
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: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.