You are here:

ASP.NET/help with asp.net

Advertisement


Question
I am new to asp.net. I am trying to convert a vb.net code into asp.net .I get no run time error. can you tell me why cannot I edit the gridview cells ?  

Imports System.Data.OleDb
Public Class WebForm1
Inherits System.Web.UI.Page

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim dt As New DataTable

' Create columns
dt.Columns.Add("column1", Type.GetType("System.String"))
dt.Columns.Add("column2", Type.GetType("System.String"))
dt.Columns.Add("column3", Type.GetType("System.String"))
dt.Columns("column3").Expression = "[column1]+[column2]"
dt.Rows.Add("", "")
dt.Rows.Add("", "")
dt.Rows.Add("", "")
dt.Rows.Add("", "")

Me.GridView1.DataSource = dt

GridView1.DataBind()
End Sub



Thanks

Answer
Hi,

Editing a gridview row in web page is not same as of the winform application.
You need to bring the row into edit mode and then make the changes.
In asp.net, by default the row is a read only.

I found a good articles, this has explained the things nicely:
http://msdn.microsoft.com/en-us/library/ms972948.aspx
http://flylib.com/books/en/2.971.1.139/1/

Go through this one, if you face any issues please let me know.

ASP.NET

All Answers


Answers by Expert:


Ask Experts

Volunteer


Aman Bhullar

Expertise

1. Asp.Net(C#, VB) 2. IIS(6.0) 3. C# 4. Classic ASP 5. JavaScript

Experience

I have nearly 7 Years of Experience in Field of IT with Asp.net Developer (Portal, Dynamic websites ,CRM's, CMS) Visual studio.net 2003,2005 (VB.net , C#.net) Database (SQL server 2005), Stored procedures IIS 5-6 JavaScript, CSS, DHTML, XML

Education/Credentials
Hold Masters in Computer Applications

Awards and Honors
Contributor Member of Asp.net Achieved Master Certification(Programming for ASP.NET) [Experts-exchange.com]

©2016 About.com. All rights reserved.