473,779 Members | 2,035 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Editing Datagrids

I have a datagrid on a webform that will allow the user to
edit data in a list. I have added the edit column in as a
link, but when it is clicked nothing happens. Do I need
to set something else in the Columns property or is it a
property of the dataset that needs changing?

Thanks
Helen
Nov 21 '05 #1
4 1070
Helen,

Yes there is a property what is by default false by other controls than the
different buttons which is "autopostba ck"

I hope this helps?

Cor
"Helen Trim"
I have a datagrid on a webform that will allow the user to
edit data in a list. I have added the edit column in as a
link, but when it is clicked nothing happens. Do I need
to set something else in the Columns property or is it a
property of the dataset that needs changing?

Thanks
Helen

Nov 21 '05 #2

Thanks for the suggestion, but a datagrid doesn't have an
AutoPostback property.

Anything else I can do?
-----Original Message-----
Helen,

Yes there is a property what is by default false by other controls than thedifferent buttons which is "autopostba ck"

I hope this helps?

Cor
"Helen Trim"
I have a datagrid on a webform that will allow the user to edit data in a list. I have added the edit column in as a link, but when it is clicked nothing happens. Do I need
to set something else in the Columns property or is it a
property of the dataset that needs changing?

Thanks
Helen

.

Nov 21 '05 #3
Helen,

I thought you where talking about the list and I thougth it was the
dataslist that you wanted to activate.

For the datagrid you would have to add a button column, what is the most
easy to do using the designer, which has a kind of wizard for that (look
beneath in the property box for that).
(And the buttons have autopostback standard activated)

I hope this helps?

Cor
Thanks for the suggestion, but a datagrid doesn't have an
AutoPostback property.

Anything else I can do?
-----Original Message-----
Helen,

Yes there is a property what is by default false by other

controls than the
different buttons which is "autopostba ck"

I hope this helps?

Cor
"Helen Trim"
I have a datagrid on a webform that will allow the user to edit data in a list. I have added the edit column in as a link, but when it is clicked nothing happens. Do I need
to set something else in the Columns property or is it a
property of the dataset that needs changing?

Thanks
Helen

.

Nov 21 '05 #4
Hi,

Right click on the datagrid and select property grid. Under columns
expand the button column and move edit, update, and cancel to the selected
columns. Here is some code on how to handle the edit. I left the code on
how to handle paging just in case you needed it. Please note i left the
code to edit the actual datasource up to you in the updateitem event. I can
provide code if needed.

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load

'Put user code to initialize the page here

If Not Me.IsPostBack Then

doDataBind()

End If

End Sub

Protected Sub doDataBind()

Dim bc As BoundColumn

Dim ds As DataSet

Dim cn As New SqlConnection(" server=localhos t;" & _

"Integrated Security=SSPI;I nitial Catalog=GolfArt icles")

Dim da As New SqlDataAdapter( "Select * from Customer ORDER BY CustomerID",
cn)

ds = New DataSet("Custom ers")

da.Fill(ds, "Customers" )

Me.DataGrid1.Da taSource = ds.Tables("Cust omers").Default View

DataGrid1.DataB ind()

Label1.Text = ds.GetXml

End Sub

Private Sub DataGrid1_PageI ndexChanged(ByV al source As Object, ByVal e As
System.Web.UI.W ebControls.Data GridPageChanged EventArgs) Handles
DataGrid1.PageI ndexChanged

' For the DataGrid control to navigate to the correct page when

' paging is allowed, the CurrentPageInde x property must be updated

' programmaticall y. This process is usually accomplished in the

' event-handling method for the PageIndexChange d event.

' Set CurrentPageInde x to the page the user clicked.

DataGrid1.Curre ntPageIndex = e.NewPageIndex

' Rebind the data to refresh the DataGrid control.

doDataBind()

End Sub

Private Sub DataGrid1_EditC ommand(ByVal source As Object, ByVal e As
System.Web.UI.W ebControls.Data GridCommandEven tArgs) Handles
DataGrid1.EditC ommand

DataGrid1.EditI temIndex = e.Item.ItemInde x

doDataBind()

End Sub

Private Sub DataGrid1_Updat eCommand(ByVal source As Object, ByVal e As
System.Web.UI.W ebControls.Data GridCommandEven tArgs) Handles
DataGrid1.Updat eCommand

'

' Update command goes here

'

DataGrid1.EditI temIndex = -1

doDataBind()

End Sub

Private Sub DataGrid1_Cance lCommand(ByVal source As Object, ByVal e As
System.Web.UI.W ebControls.Data GridCommandEven tArgs) Handles
DataGrid1.Cance lCommand

DataGrid1.EditI temIndex = -1

doDataBind()

End Sub

Ken

-------------------------

"Helen Trim" <he************ *********@porth osp.nhs.uk> wrote in message
news:8a******** *************** *****@phx.gbl.. .
I have a datagrid on a webform that will allow the user to
edit data in a list. I have added the edit column in as a
link, but when it is clicked nothing happens. Do I need
to set something else in the Columns property or is it a
property of the dataset that needs changing?

Thanks
Helen
Nov 21 '05 #5

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

Similar topics

1
1528
by: Ux | last post by:
ServerSide: PHP+MySql ClientSide: JS (IE5+, Moz1.7) I need to edit an HTML table that contains records from a table in MySQL. A MsAccess datagrid or similar behaviour should be the best, but it's not strictly requested by users. It is my first datagrid editing in HTML+JS so I need to plan a common implementation strategy for all datagrids in my app.
0
1030
by: Sebi | last post by:
Hello All, I'm having problems, reading the new Values from CheckBox in a DataGrid. my Code Behind is C# I do exactly what other samples do, but I allways get the Initial Values instead of the current values choosen by the user!!
4
416
by: ree32 | last post by:
I have a placeholder and depending on a user input(a drop downlist) when the user clicks a button I dynamically create a number of datagrids and fill them with data from a database. But the problem is that on a postback I lose all the datagrids and their data. I have looked at numerous pages on the net regarding this issue. Many say you have to rebuild build the controls on postback. How am I meant to do this in my situation as I don't...
1
2337
by: ree32 | last post by:
I have a placeholder and depending on a user input(a drop downlist) when the user clicks a button I dynamically create a number of datagrids and fill them with data from a database. But the problem is that on a postback I lose all the datagrids and their data. I have looked at numerous pages on the net regarding this issue. Many say you have to rebuild build the controls on postback. How am I meant to do this in my situation as I don't...
2
1940
by: rn5a | last post by:
In a shopping cart app, a ASPX page retrieves the order details & personal details of a user from a MS-Access database table depending upon the username of the user. The order details of a particular order (like ProductID, Name, Description, Quantity etc.) are displayed in one DataGrid where as the personal details of the buyer corresponding to this order (like Name, E-Mail, Shipping & Billing Address etc.) are displayed in another...
0
9632
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9471
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
10302
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...
0
9925
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
8958
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...
0
6723
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
5372
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4036
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 we have to send another system
3
2867
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.