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

Editable DataGrid

In the EditCommand event I've added a drop down list to the controls
collection for the cell I want to edit.

Dim objDDLBrake As New DropDownList

objDDLBrake.CssClass = "label1"

objDDLBrake.Items.Add("A")

objDDLBrake.Items.Add("H")

objDDLBrake.SelectedIndex = -1

objDDLBrake.Items.FindByText(DirectCast(WMIGrid.It ems(e.Item.ItemIndex).Cell
s(6).Controls.Item(0), System.Web.UI.WebControls.TextBox).Text).Selected =
True

DirectCast(WMIGrid.Items(e.Item.ItemIndex).Cells(6 ).Controls.Item(0),
System.Web.UI.WebControls.TextBox).Visible = False

WMIGrid.Items(e.Item.ItemIndex).Cells(6).Controls. Add(objDDLBrake)

So in my update event I try to access the newly created drop down list and
it's gone.... I have only one control in my controls collection, I expect
two...

Dim strFuelTypeCode As String =
DirectCast(WMIGrid.Items(e.Item.ItemIndex).Cells(7 ).Controls.Item(1),
System.Web.UI.WebControls.DropDownList).SelectedVa lue

Any thoughts what am I doing wrong....?
Nov 18 '05 #1
2 1131
Why aren't using using a template column?

Greg

"alien2_51" <dan.billow"at"n.o.s.p.a.m.monacocoach.commercialv ersion> wrote
in message news:OB****************@TK2MSFTNGP15.phx.gbl...
In the EditCommand event I've added a drop down list to the controls
collection for the cell I want to edit.

Dim objDDLBrake As New DropDownList

objDDLBrake.CssClass = "label1"

objDDLBrake.Items.Add("A")

objDDLBrake.Items.Add("H")

objDDLBrake.SelectedIndex = -1

objDDLBrake.Items.FindByText(DirectCast(WMIGrid.It ems(e.Item.ItemIndex).Cell
s(6).Controls.Item(0), System.Web.UI.WebControls.TextBox).Text).Selected =
True

DirectCast(WMIGrid.Items(e.Item.ItemIndex).Cells(6 ).Controls.Item(0),
System.Web.UI.WebControls.TextBox).Visible = False

WMIGrid.Items(e.Item.ItemIndex).Cells(6).Controls. Add(objDDLBrake)

So in my update event I try to access the newly created drop down list and
it's gone.... I have only one control in my controls collection, I expect
two...

Dim strFuelTypeCode As String =
DirectCast(WMIGrid.Items(e.Item.ItemIndex).Cells(7 ).Controls.Item(1),
System.Web.UI.WebControls.DropDownList).SelectedVa lue

Any thoughts what am I doing wrong....?

Nov 18 '05 #2
I don't know, I am now... Thanks...

"Greg Burns" <greg_burns@DONT_SPAM_ME_hotmail.com> wrote in message
news:O7**************@tk2msftngp13.phx.gbl...
Why aren't using using a template column?

Greg

"alien2_51" <dan.billow"at"n.o.s.p.a.m.monacocoach.commercialv ersion> wrote in message news:OB****************@TK2MSFTNGP15.phx.gbl...
In the EditCommand event I've added a drop down list to the controls
collection for the cell I want to edit.

Dim objDDLBrake As New DropDownList

objDDLBrake.CssClass = "label1"

objDDLBrake.Items.Add("A")

objDDLBrake.Items.Add("H")

objDDLBrake.SelectedIndex = -1

objDDLBrake.Items.FindByText(DirectCast(WMIGrid.It ems(e.Item.ItemIndex).Cell s(6).Controls.Item(0), System.Web.UI.WebControls.TextBox).Text).Selected = True

DirectCast(WMIGrid.Items(e.Item.ItemIndex).Cells(6 ).Controls.Item(0),
System.Web.UI.WebControls.TextBox).Visible = False

WMIGrid.Items(e.Item.ItemIndex).Cells(6).Controls. Add(objDDLBrake)

So in my update event I try to access the newly created drop down list and it's gone.... I have only one control in my controls collection, I expect two...

Dim strFuelTypeCode As String =
DirectCast(WMIGrid.Items(e.Item.ItemIndex).Cells(7 ).Controls.Item(1),
System.Web.UI.WebControls.DropDownList).SelectedVa lue

Any thoughts what am I doing wrong....?


Nov 18 '05 #3

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

Similar topics

0
by: Andla Rand | last post by:
Hi, Could you help me to understand how datagrid works. I'm trying to make a datagrid editable. Now most of the tutorials I read says that i should turn the Enable ViewState off. Why is that? ...
1
by: mai via DotNetMonster.com | last post by:
hi, i'm sort of a newbie in .net and i'm currently doing my major project. i would like to know if it is possible to have a datagrid that would not be having a database as its datasource? and is it...
4
by: Stephan Bour | last post by:
Hi, I have a datagrid databound to a SQL query. I'd like to allow editing of some columns but not all. Is there a way to turn off the conversion of the datagrid cells to textboxes for some columns...
2
by: Stephan Bour | last post by:
Hi, Ičve tried to implement a solution to populate a dropdownlist inside an editable datagrid. The code is simple enough and an example can be found here:...
2
by: Jesper Stocholm | last post by:
I have a challenge, that I do not seem to be able to solve. I have an "overview"-page that presently displays data from 2 columns in a database table. The users should be allowed to edit data in...
0
by: DaveR | last post by:
I have a webform with a two-column datagrid based on an Arraylist. The Arraylist draws the data for the two columns from two different tables in an SQL database. The data is displayed in datagrid...
2
by: Carlo Marchesoni | last post by:
I have an editable Datagrid and memorize its datasource with a Session variable. On each Page_Load I simply Bind the Datagrid. Everything works fine. The problem comes, when I have a lot of...
2
by: zambizzi | last post by:
....I can't seem to get my hands on a control I'm loading in an editable datagrid. Here's my datagrid control: <asp:datagrid id="GLRulesGrid" runat="server" autogeneratecolumns="False"...
7
by: Diane | last post by:
Hi- I've been struggling with this problem and none of the fixes posted seem to help out at all. Yet, it seems like such a simple problem... I have a DataGrid, and load it up with data on...
6
by: Richard L Rosenheim | last post by:
I'm sure it can be done, I haven't been able to find the right article yet. I want to be able to filter the records that the datagrid displays, but still have an editable datagrid. That is, I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.