473,756 Members | 8,174 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Overall editing DataGrids

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!!

Anybody got an Idea?

Thanks

Also see my old Post:
Mike,

Thanks.

This is exactly what I do!!
I do it in C#, but exactly the same, and I can only see
the Initial Values. I've also seen another sample which
works, but mine doesn't!!?!

Anybody got a hint??

- P L E A S E ! -
-----Original Message-----
Hi Sebi,

I created a sample grid with checkboxes. I can check & uncheck the boxesand submit the form. It will list back to me (correctly) which boxes arechecked or not. I think this sample may help you.

Add a grid & a button. Set the grid to have one template column with acheck box in it.

Here's my HTML

<form id="Form1" method="post" runat="server">
<asp:DataGrid id="DataGrid1" style="Z-INDEX: 101; LEFT: 16px; POSITION:absolute; TOP: 57px" runat="server"
AutoGenerateCol umns="False">
<Columns>
<asp:TemplateCo lumn>
<ItemTemplate >
<asp:CheckBox id="CheckBox1" runat="server"> </asp:CheckBox> </ItemTemplate>
</asp:TemplateCol umn>
</Columns>
</asp:DataGrid>
<asp:Button id="Button1" style="Z-INDEX: 102; LEFT: 8px; POSITION:absolute; TOP: 8px" runat="server"
Text="Button"></asp:Button>
</form>

Next, my code-behind is very simple. It's all in the page_load.
Private Sub Page_Load(ByVal sender As System.Object, ByVal e AsSystem.EventAr gs) Handles MyBase.Load
'Force "flow" layout
DataGrid1.Attri butes.Remove("s tyle")
Button1.Attribu tes.Remove("sty le")

If Not Page.IsPostBack Then
Dim MyList As New ArrayList
Dim i As Int32
For i = 0 To 3
MyList.Add(i)
Next
DataGrid1.DataS ource = MyList
DataGrid1.DataB ind()
Else
Dim i As Int32
For i = 0 To DataGrid1.Items .Count - 1
Dim ck As CheckBox
ck = DataGrid1.Items (i).Cells(0).Fi ndControl ("CheckBox1" ) Response.Write( ck.Checked & "<br>")
'add code here to select or deselect all
'update the database here
Next
End If
End Sub
Thank you, Mike
Microsoft, ASP.NET Support Professional

Microsoft highly recommends to all of our customers that they visit thehttp://www.microsoft.com/protect site and perform the three straightforwardsteps listed to improve your computer's security.

This posting is provided "AS IS", with no warranties, and confers no rights.

--------------------
Content-Class: urn:content-classes:message
From: "Sebi" <an*******@disc ussions.microso ft.com>
Sender: "Sebi" <an*******@disc ussions.microso ft.com>
Subject: 'Overall' Editing DataGrids
Date: Tue, 11 Nov 2003 08:38:05 -0800
Lines: 22
Message-ID: <12************ *************** *@phx.gbl>
MIME-Version: 1.0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
Thread-Index: AcOoci5FF7BRb9O BSVa+nWc4+8DI0g ==
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300 Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
Path: cpmsftngxa06.ph x.gbl
Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.framew ork.aspnet:1900 88 NNTP-Posting-Host: TK2MSFTNGXA13 10.40.1.165
X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet

Hello All,

I'm using DataGrids mainly to display Data.
Now it should be possible for some Flags to be edited.
For this reason I've added CheckBoxes to the DataGrid.

I don't want to add edit & update button.
I want to do a Global update including a
SelectAll/DeselectAll.

The Problem is, that the Values don't seem to be updated. When I read the Checked Flag of the Checkbox, it still
contains the Initial Value.

Is there some Command like UpdateData(fals e)?
Or is there a Property that I might have set wrong?
Any Other Ideas how I can read the WebPage Values?

Thanks a lot for any help

Sebi


Nov 17 '05 #1
0 1029

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.
1
2041
by: Simon Harris | last post by:
Hi All, I wish to populate more than one datagrid from the same OleDBCommand. The code I have is: Dim objCmd As New OleDbCommand(strSql, objConn) Then... Me.dgTariffHolidayHomesBand1.DataSource = objCmd.ExecuteReader()
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...
2
1067
by: geodev | last post by:
I’m building a small application and I have to build it using asp.net, vb.net and my database is MSDE. I have a datagrid with a list of customers and that is working great. I now need to be able to edit and delete these entries. Having done some reading I realised that there are some built in features with datagrid that allows you to do this easily directly onto the datagrid. Unfortunately I have a lot of customer data so this is not...
0
1260
by: Scott Meddows | last post by:
I'm having trouble scrolling some datagrids so they sync up... I have two identical datagrids on a form, filled with eh same dataset. I want a user to be able to scroll on the datasets and the other dataset then scrolls to the same place on the other dataset (bare with me). This is the code that I have so far... Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load...
12
1782
by: Art | last post by:
Hi, I need help -- again -- I have a DataGrid with a DataTable as its source. It displays wonderfully when I put in some test data (withinin the code). Now, I'd like to change one of the values in the Grid, and have the DataTable change. I've tried using a Validating (and Validated) event to display the changed data. It doesn't change. I've tried adding
7
1852
by: Ausclad | last post by:
Ok, ill try again..... It seems fairly simple. I have two combo boxes in a datagrid. The datagrid is bound to a a table in a dataset. The two combo boxes are bound to a single data table in a different dataset. One combo box is displaying the Employees payroll ID. The other is
2
1939
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...
6
8645
by: =?Utf-8?B?R2VudGlhbiBIaWxh?= | last post by:
I have a datagrid that I want to be able to allow me to edit only the first two rows and all the other rows to be read-only. How can I do that? Any insight is highly appreciated. I have spent couple of days on research but no luck so far. Thank you
0
9384
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
9212
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
9645
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...
1
7186
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5069
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...
0
5247
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3742
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
2
3276
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2612
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.