473,701 Members | 2,804 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Adding dummy item to DropDownList in a DataGrid

Hi folks,

I have a DropDownList in a DataGrid that is populated from records in a
database.

I want to add a value that might be a string such as "Select a Company" for
the first item since an OnSelectedIndex event is not fired if you select the
first item.

Does anyone know of an easy way to do this?

I am using the following code to get at the the dropdownlist that is inside
a cell within the datagrid which is placed inside my PageLoad function:

Dim list As DropDownList = New DropDownList ( )
Dim cell As TableCell = CType(list.Pare nt, TableCell)
Dim item As DataGridItem = CType(cell.Pare nt, DataGridItem)

Dim ddlCo As DropDownList = CType(item.Find Control("ddlCo" ), DropDownList)

ddlCo .Items.Add("Sel ect a Company")

I am getting the infamous "object reference not set to an instance of an
object" on the Dim item line...

Appreciate any replies...
glenn


Apr 25 '06 #1
15 3112
You code makes no sense for example

Dim list As DropDownList = New DropDownList ( )

declares and initiates a DropdownList control called list, then

Dim cell As TableCell = CType(list.Pare nt, TableCell)

declares a TableCell object and sets it to the value the the parent control
of the cell control cast as a TableCell object. But at this point the list
object, has no parent control.

What are you actually trying to do?
"glenn" wrote:
Hi folks,

I have a DropDownList in a DataGrid that is populated from records in a
database.

I want to add a value that might be a string such as "Select a Company" for
the first item since an OnSelectedIndex event is not fired if you select the
first item.

Does anyone know of an easy way to do this?

I am using the following code to get at the the dropdownlist that is inside
a cell within the datagrid which is placed inside my PageLoad function:

Dim list As DropDownList = New DropDownList ( )
Dim cell As TableCell = CType(list.Pare nt, TableCell)
Dim item As DataGridItem = CType(cell.Pare nt, DataGridItem)

Dim ddlCo As DropDownList = CType(item.Find Control("ddlCo" ), DropDownList)

ddlCo .Items.Add("Sel ect a Company")

I am getting the infamous "object reference not set to an instance of an
object" on the Dim item line...

Appreciate any replies...
glenn

Apr 25 '06 #2
I am looking to add a dummy value to my ddl so that when I select the first
real value in the ddl, an OnSelectedIndex event will be fired. The value
might be for example, "Select a Company".

The code I presented I believe needs to be provided in order to find a
control that is inside a DataGrid. If the ddl was not in a DataGrid I could
simply write something like:
Dim ddl as DropDownList = e.Item.Cells(2) .FindControl("d dlCompany")
but since it is inside the DataGrid, I needed the additonal code.

HTH. If you know of an easier way, please let me know.
Thanks,
glenn

"clickon" wrote:
You code makes no sense for example

Dim list As DropDownList = New DropDownList ( )

declares and initiates a DropdownList control called list, then

Dim cell As TableCell = CType(list.Pare nt, TableCell)

declares a TableCell object and sets it to the value the the parent control
of the cell control cast as a TableCell object. But at this point the list
object, has no parent control.

What are you actually trying to do?
"glenn" wrote:
Hi folks,

I have a DropDownList in a DataGrid that is populated from records in a
database.

I want to add a value that might be a string such as "Select a Company" for
the first item since an OnSelectedIndex event is not fired if you select the
first item.

Does anyone know of an easy way to do this?

I am using the following code to get at the the dropdownlist that is inside
a cell within the datagrid which is placed inside my PageLoad function:

Dim list As DropDownList = New DropDownList ( )
Dim cell As TableCell = CType(list.Pare nt, TableCell)
Dim item As DataGridItem = CType(cell.Pare nt, DataGridItem)

Dim ddlCo As DropDownList = CType(item.Find Control("ddlCo" ), DropDownList)

ddlCo .Items.Add("Sel ect a Company")

I am getting the infamous "object reference not set to an instance of an
object" on the Dim item line...

Appreciate any replies...
glenn

Apr 25 '06 #3
Just add it to your SQL

SELECT "add a company"
UNION
SELECT CompanyName from Companies

"glenn" <gl***@discussi ons.microsoft.c om> wrote in message
news:68******** *************** ***********@mic rosoft.com...
I am looking to add a dummy value to my ddl so that when I select the first
real value in the ddl, an OnSelectedIndex event will be fired. The value
might be for example, "Select a Company".

The code I presented I believe needs to be provided in order to find a
control that is inside a DataGrid. If the ddl was not in a DataGrid I
could
simply write something like:
Dim ddl as DropDownList = e.Item.Cells(2) .FindControl("d dlCompany")
but since it is inside the DataGrid, I needed the additonal code.

HTH. If you know of an easier way, please let me know.
Thanks,
glenn

"clickon" wrote:
You code makes no sense for example

Dim list As DropDownList = New DropDownList ( )

declares and initiates a DropdownList control called list, then

Dim cell As TableCell = CType(list.Pare nt, TableCell)

declares a TableCell object and sets it to the value the the parent
control
of the cell control cast as a TableCell object. But at this point the
list
object, has no parent control.

What are you actually trying to do?
"glenn" wrote:
> Hi folks,
>
> I have a DropDownList in a DataGrid that is populated from records in a
> database.
>
> I want to add a value that might be a string such as "Select a Company"
> for
> the first item since an OnSelectedIndex event is not fired if you
> select the
> first item.
>
> Does anyone know of an easy way to do this?
>
> I am using the following code to get at the the dropdownlist that is
> inside
> a cell within the datagrid which is placed inside my PageLoad function:
>
> Dim list As DropDownList = New DropDownList ( )
> Dim cell As TableCell = CType(list.Pare nt, TableCell)
> Dim item As DataGridItem = CType(cell.Pare nt, DataGridItem)
>
> Dim ddlCo As DropDownList = CType(item.Find Control("ddlCo" ),
> DropDownList)
>
> ddlCo .Items.Add("Sel ect a Company")
>
> I am getting the infamous "object reference not set to an instance of
> an
> object" on the Dim item line...
>
> Appreciate any replies...
> glenn
>
>
>
>

Apr 25 '06 #4
This line
Dim list As DropDownList = New DropDownList ( )

creates a new DdropDownList control called list, it is not in a DataGrid, it
has no parent or child control, it is not on the page at all, it is
esentially just an object. Therefore list.parent makes no sense unless there
is a line such as

somecontrol.Con trols.Add(list) ;

Which will place the ddl inside some other control.
If you wanht to add a dummy item to a DropDownList, that is declared on your
page you can do it as below.

<asp:DropDownLi st runat="server" ID="MyDDL" AppendDataBound Items="true">
<asp:ListItem Selected="True" Text="DummyItem "></asp:ListItem>
</asp:DropDownLis t>

Because AppendDataBound Items is set to true then the items from the database
will be added after the dummy item.

"glenn" wrote:
I am looking to add a dummy value to my ddl so that when I select the first
real value in the ddl, an OnSelectedIndex event will be fired. The value
might be for example, "Select a Company".

The code I presented I believe needs to be provided in order to find a
control that is inside a DataGrid. If the ddl was not in a DataGrid I could
simply write something like:
Dim ddl as DropDownList = e.Item.Cells(2) .FindControl("d dlCompany")
but since it is inside the DataGrid, I needed the additonal code.

HTH. If you know of an easier way, please let me know.
Thanks,
glenn

"clickon" wrote:
You code makes no sense for example

Dim list As DropDownList = New DropDownList ( )

declares and initiates a DropdownList control called list, then

Dim cell As TableCell = CType(list.Pare nt, TableCell)

declares a TableCell object and sets it to the value the the parent control
of the cell control cast as a TableCell object. But at this point the list
object, has no parent control.

What are you actually trying to do?
"glenn" wrote:
Hi folks,

I have a DropDownList in a DataGrid that is populated from records in a
database.

I want to add a value that might be a string such as "Select a Company" for
the first item since an OnSelectedIndex event is not fired if you select the
first item.

Does anyone know of an easy way to do this?

I am using the following code to get at the the dropdownlist that is inside
a cell within the datagrid which is placed inside my PageLoad function:

Dim list As DropDownList = New DropDownList ( )
Dim cell As TableCell = CType(list.Pare nt, TableCell)
Dim item As DataGridItem = CType(cell.Pare nt, DataGridItem)

Dim ddlCo As DropDownList = CType(item.Find Control("ddlCo" ), DropDownList)

ddlCo .Items.Add("Sel ect a Company")

I am getting the infamous "object reference not set to an instance of an
object" on the Dim item line...

Appreciate any replies...
glenn

Apr 25 '06 #5
When used without a datasource in a ddl, your example works.

However, when used with a datasource in a ddl, your example does not add the
dummy item.

My code is as follows:

<asp:DropDownLi st id="ddlTo"
AppendDataBound Items="true" runat="server" DataValueField= "cname"
AutoPostBack="T rue" DataSource='<%# GetCompanyNames ForThisProject( ) %>'
OnSelectedIndex Changed="ddlTo_ SelectedIndexCh anged">
<asp:ListItem Selected="True"
Text="DummyItem "></asp:ListItem>
</asp:DropDownLis t>

Thanks again for any tips.
Glenn

"clickon" wrote:
This line
Dim list As DropDownList = New DropDownList ( )

creates a new DdropDownList control called list, it is not in a DataGrid, it
has no parent or child control, it is not on the page at all, it is
esentially just an object. Therefore list.parent makes no sense unless there
is a line such as

somecontrol.Con trols.Add(list) ;

Which will place the ddl inside some other control.
If you wanht to add a dummy item to a DropDownList, that is declared on your
page you can do it as below.

<asp:DropDownLi st runat="server" ID="MyDDL" AppendDataBound Items="true">
<asp:ListItem Selected="True" Text="DummyItem "></asp:ListItem>
</asp:DropDownLis t>

Because AppendDataBound Items is set to true then the items from the database
will be added after the dummy item.

"glenn" wrote:
I am looking to add a dummy value to my ddl so that when I select the first
real value in the ddl, an OnSelectedIndex event will be fired. The value
might be for example, "Select a Company".

The code I presented I believe needs to be provided in order to find a
control that is inside a DataGrid. If the ddl was not in a DataGrid I could
simply write something like:
Dim ddl as DropDownList = e.Item.Cells(2) .FindControl("d dlCompany")
but since it is inside the DataGrid, I needed the additonal code.

HTH. If you know of an easier way, please let me know.
Thanks,
glenn

"clickon" wrote:
You code makes no sense for example

Dim list As DropDownList = New DropDownList ( )

declares and initiates a DropdownList control called list, then

Dim cell As TableCell = CType(list.Pare nt, TableCell)

declares a TableCell object and sets it to the value the the parent control
of the cell control cast as a TableCell object. But at this point the list
object, has no parent control.

What are you actually trying to do?
"glenn" wrote:

> Hi folks,
>
> I have a DropDownList in a DataGrid that is populated from records in a
> database.
>
> I want to add a value that might be a string such as "Select a Company" for
> the first item since an OnSelectedIndex event is not fired if you select the
> first item.
>
> Does anyone know of an easy way to do this?
>
> I am using the following code to get at the the dropdownlist that is inside
> a cell within the datagrid which is placed inside my PageLoad function:
>
> Dim list As DropDownList = New DropDownList ( )
> Dim cell As TableCell = CType(list.Pare nt, TableCell)
> Dim item As DataGridItem = CType(cell.Pare nt, DataGridItem)
>
> Dim ddlCo As DropDownList = CType(item.Find Control("ddlCo" ), DropDownList)
>
> ddlCo .Items.Add("Sel ect a Company")
>
> I am getting the infamous "object reference not set to an instance of an
> object" on the Dim item line...
>
> Appreciate any replies...
> glenn
>
>
>
>

Apr 25 '06 #6
The UNION statement only works as shown:

SELECT statement
UNION
SELECT statement

where a statement would be SELECT * FROM TABLE

"Jeff Dillon" wrote:
Just add it to your SQL

SELECT "add a company"
UNION
SELECT CompanyName from Companies

"glenn" <gl***@discussi ons.microsoft.c om> wrote in message
news:68******** *************** ***********@mic rosoft.com...
I am looking to add a dummy value to my ddl so that when I select the first
real value in the ddl, an OnSelectedIndex event will be fired. The value
might be for example, "Select a Company".

The code I presented I believe needs to be provided in order to find a
control that is inside a DataGrid. If the ddl was not in a DataGrid I
could
simply write something like:
Dim ddl as DropDownList = e.Item.Cells(2) .FindControl("d dlCompany")
but since it is inside the DataGrid, I needed the additonal code.

HTH. If you know of an easier way, please let me know.
Thanks,
glenn

"clickon" wrote:
You code makes no sense for example

Dim list As DropDownList = New DropDownList ( )

declares and initiates a DropdownList control called list, then

Dim cell As TableCell = CType(list.Pare nt, TableCell)

declares a TableCell object and sets it to the value the the parent
control
of the cell control cast as a TableCell object. But at this point the
list
object, has no parent control.

What are you actually trying to do?
"glenn" wrote:

> Hi folks,
>
> I have a DropDownList in a DataGrid that is populated from records in a
> database.
>
> I want to add a value that might be a string such as "Select a Company"
> for
> the first item since an OnSelectedIndex event is not fired if you
> select the
> first item.
>
> Does anyone know of an easy way to do this?
>
> I am using the following code to get at the the dropdownlist that is
> inside
> a cell within the datagrid which is placed inside my PageLoad function:
>
> Dim list As DropDownList = New DropDownList ( )
> Dim cell As TableCell = CType(list.Pare nt, TableCell)
> Dim item As DataGridItem = CType(cell.Pare nt, DataGridItem)
>
> Dim ddlCo As DropDownList = CType(item.Find Control("ddlCo" ),
> DropDownList)
>
> ddlCo .Items.Add("Sel ect a Company")
>
> I am getting the infamous "object reference not set to an instance of
> an
> object" on the Dim item line...
>
> Appreciate any replies...
> glenn
>
>
>
>


Apr 25 '06 #7
You're doing it the hard way. Try my suggestion

"glenn" <gl***@discussi ons.microsoft.c om> wrote in message
news:E5******** *************** ***********@mic rosoft.com...
When used without a datasource in a ddl, your example works.

However, when used with a datasource in a ddl, your example does not add
the
dummy item.

My code is as follows:

<asp:DropDownLi st id="ddlTo"
AppendDataBound Items="true" runat="server" DataValueField= "cname"
AutoPostBack="T rue" DataSource='<%# GetCompanyNames ForThisProject( ) %>'
OnSelectedIndex Changed="ddlTo_ SelectedIndexCh anged">
<asp:ListItem Selected="True"
Text="DummyItem "></asp:ListItem>
</asp:DropDownLis t>

Thanks again for any tips.
Glenn

"clickon" wrote:
This line
Dim list As DropDownList = New DropDownList ( )

creates a new DdropDownList control called list, it is not in a DataGrid,
it
has no parent or child control, it is not on the page at all, it is
esentially just an object. Therefore list.parent makes no sense unless
there
is a line such as

somecontrol.Con trols.Add(list) ;

Which will place the ddl inside some other control.
If you wanht to add a dummy item to a DropDownList, that is declared on
your
page you can do it as below.

<asp:DropDownLi st runat="server" ID="MyDDL" AppendDataBound Items="true">
<asp:ListItem Selected="True"
Text="DummyItem "></asp:ListItem>
</asp:DropDownLis t>

Because AppendDataBound Items is set to true then the items from the
database
will be added after the dummy item.

"glenn" wrote:
> I am looking to add a dummy value to my ddl so that when I select the
> first
> real value in the ddl, an OnSelectedIndex event will be fired. The
> value
> might be for example, "Select a Company".
>
> The code I presented I believe needs to be provided in order to find a
> control that is inside a DataGrid. If the ddl was not in a DataGrid I
> could
> simply write something like:
> Dim ddl as DropDownList = e.Item.Cells(2) .FindControl("d dlCompany")
> but since it is inside the DataGrid, I needed the additonal code.
>
> HTH. If you know of an easier way, please let me know.
> Thanks,
> glenn
>
> "clickon" wrote:
>
> > You code makes no sense for example
> >
> > Dim list As DropDownList = New DropDownList ( )
> >
> > declares and initiates a DropdownList control called list, then
> >
> > Dim cell As TableCell = CType(list.Pare nt, TableCell)
> >
> > declares a TableCell object and sets it to the value the the parent
> > control
> > of the cell control cast as a TableCell object. But at this point
> > the list
> > object, has no parent control.
> >
> > What are you actually trying to do?
> >
> >
> > "glenn" wrote:
> >
> > > Hi folks,
> > >
> > > I have a DropDownList in a DataGrid that is populated from records
> > > in a
> > > database.
> > >
> > > I want to add a value that might be a string such as "Select a
> > > Company" for
> > > the first item since an OnSelectedIndex event is not fired if you
> > > select the
> > > first item.
> > >
> > > Does anyone know of an easy way to do this?
> > >
> > > I am using the following code to get at the the dropdownlist that
> > > is inside
> > > a cell within the datagrid which is placed inside my PageLoad
> > > function:
> > >
> > > Dim list As DropDownList = New DropDownList ( )
> > > Dim cell As TableCell = CType(list.Pare nt, TableCell)
> > > Dim item As DataGridItem = CType(cell.Pare nt, DataGridItem)
> > >
> > > Dim ddlCo As DropDownList = CType(item.Find Control("ddlCo" ),
> > > DropDownList)
> > >
> > > ddlCo .Items.Add("Sel ect a Company")
> > >
> > > I am getting the infamous "object reference not set to an
> > > instance of an
> > > object" on the Dim item line...
> > >
> > > Appreciate any replies...
> > > glenn
> > >
> > >
> > >
> > >

Apr 25 '06 #8
WRONG

SELECT 'Select an author'
UNION ALL
SELECT au_lname FROM Authors

works fine

"glenn" <gl***@discussi ons.microsoft.c om> wrote in message
news:A6******** *************** ***********@mic rosoft.com...
The UNION statement only works as shown:

SELECT statement
UNION
SELECT statement

where a statement would be SELECT * FROM TABLE

"Jeff Dillon" wrote:
Just add it to your SQL

SELECT "add a company"
UNION
SELECT CompanyName from Companies

"glenn" <gl***@discussi ons.microsoft.c om> wrote in message
news:68******** *************** ***********@mic rosoft.com...
>I am looking to add a dummy value to my ddl so that when I select the
>first
> real value in the ddl, an OnSelectedIndex event will be fired. The
> value
> might be for example, "Select a Company".
>
> The code I presented I believe needs to be provided in order to find a
> control that is inside a DataGrid. If the ddl was not in a DataGrid I
> could
> simply write something like:
> Dim ddl as DropDownList = e.Item.Cells(2) .FindControl("d dlCompany")
> but since it is inside the DataGrid, I needed the additonal code.
>
> HTH. If you know of an easier way, please let me know.
> Thanks,
> glenn
>
> "clickon" wrote:
>
>> You code makes no sense for example
>>
>> Dim list As DropDownList = New DropDownList ( )
>>
>> declares and initiates a DropdownList control called list, then
>>
>> Dim cell As TableCell = CType(list.Pare nt, TableCell)
>>
>> declares a TableCell object and sets it to the value the the parent
>> control
>> of the cell control cast as a TableCell object. But at this point the
>> list
>> object, has no parent control.
>>
>> What are you actually trying to do?
>>
>>
>> "glenn" wrote:
>>
>> > Hi folks,
>> >
>> > I have a DropDownList in a DataGrid that is populated from records
>> > in a
>> > database.
>> >
>> > I want to add a value that might be a string such as "Select a
>> > Company"
>> > for
>> > the first item since an OnSelectedIndex event is not fired if you
>> > select the
>> > first item.
>> >
>> > Does anyone know of an easy way to do this?
>> >
>> > I am using the following code to get at the the dropdownlist that is
>> > inside
>> > a cell within the datagrid which is placed inside my PageLoad
>> > function:
>> >
>> > Dim list As DropDownList = New DropDownList ( )
>> > Dim cell As TableCell = CType(list.Pare nt, TableCell)
>> > Dim item As DataGridItem = CType(cell.Pare nt, DataGridItem)
>> >
>> > Dim ddlCo As DropDownList = CType(item.Find Control("ddlCo" ),
>> > DropDownList)
>> >
>> > ddlCo .Items.Add("Sel ect a Company")
>> >
>> > I am getting the infamous "object reference not set to an instance
>> > of
>> > an
>> > object" on the Dim item line...
>> >
>> > Appreciate any replies...
>> > glenn
>> >
>> >
>> >
>> >


Apr 25 '06 #9
SELECT 'Select an author' is not a valid SQL statement...

I want to add a selection to the top of my ddl. That is the issue.

"Jeff Dillon" wrote:
WRONG

SELECT 'Select an author'
UNION ALL
SELECT au_lname FROM Authors

works fine

"glenn" <gl***@discussi ons.microsoft.c om> wrote in message
news:A6******** *************** ***********@mic rosoft.com...
The UNION statement only works as shown:

SELECT statement
UNION
SELECT statement

where a statement would be SELECT * FROM TABLE

"Jeff Dillon" wrote:
Just add it to your SQL

SELECT "add a company"
UNION
SELECT CompanyName from Companies

"glenn" <gl***@discussi ons.microsoft.c om> wrote in message
news:68******** *************** ***********@mic rosoft.com...
>I am looking to add a dummy value to my ddl so that when I select the
>first
> real value in the ddl, an OnSelectedIndex event will be fired. The
> value
> might be for example, "Select a Company".
>
> The code I presented I believe needs to be provided in order to find a
> control that is inside a DataGrid. If the ddl was not in a DataGrid I
> could
> simply write something like:
> Dim ddl as DropDownList = e.Item.Cells(2) .FindControl("d dlCompany")
> but since it is inside the DataGrid, I needed the additonal code.
>
> HTH. If you know of an easier way, please let me know.
> Thanks,
> glenn
>
> "clickon" wrote:
>
>> You code makes no sense for example
>>
>> Dim list As DropDownList = New DropDownList ( )
>>
>> declares and initiates a DropdownList control called list, then
>>
>> Dim cell As TableCell = CType(list.Pare nt, TableCell)
>>
>> declares a TableCell object and sets it to the value the the parent
>> control
>> of the cell control cast as a TableCell object. But at this point the
>> list
>> object, has no parent control.
>>
>> What are you actually trying to do?
>>
>>
>> "glenn" wrote:
>>
>> > Hi folks,
>> >
>> > I have a DropDownList in a DataGrid that is populated from records
>> > in a
>> > database.
>> >
>> > I want to add a value that might be a string such as "Select a
>> > Company"
>> > for
>> > the first item since an OnSelectedIndex event is not fired if you
>> > select the
>> > first item.
>> >
>> > Does anyone know of an easy way to do this?
>> >
>> > I am using the following code to get at the the dropdownlist that is
>> > inside
>> > a cell within the datagrid which is placed inside my PageLoad
>> > function:
>> >
>> > Dim list As DropDownList = New DropDownList ( )
>> > Dim cell As TableCell = CType(list.Pare nt, TableCell)
>> > Dim item As DataGridItem = CType(cell.Pare nt, DataGridItem)
>> >
>> > Dim ddlCo As DropDownList = CType(item.Find Control("ddlCo" ),
>> > DropDownList)
>> >
>> > ddlCo .Items.Add("Sel ect a Company")
>> >
>> > I am getting the infamous "object reference not set to an instance
>> > of
>> > an
>> > object" on the Dim item line...
>> >
>> > Appreciate any replies...
>> > glenn
>> >
>> >
>> >
>> >


Apr 25 '06 #10

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

Similar topics

0
2679
by: Brian Greiwe | last post by:
I posted this in the datagrid forum but got no bites, so I thought I'd post it here as well for some help.... I've created a datagrid with 1 edititemtemplate column. When the user clicks edit, it spans the entire width of the datagrid (removing the other cells). This column has several controls in it (text boxes, radiobuttons, and a dropdownlist). Also, on the itemdatabound, I am adding another row to the datagrid (above the...
2
3636
by: Clayton Hamilton | last post by:
I have a DataGrid on a webform bound to a Datasource and can successfully use <ItemTemplate> to create edit/update/cancel functionality for user maintenance of data. I use separate logic to delete a row. Everything works just fine. BUT I would like to add a button to (for example) the DataGrid header, which when pressed will add a new row to the datagrid. This should then allow the user to enter information into text boxes (in some...
4
5481
by: DotNetJunky | last post by:
I have built a control that runs an on-line help system. Depending on the category you selected via dropdownlist, it goes out and gets the child subcategories, and if there are any, adds a new dropdownlist to the screen for selection. This continues until there are no children, and then it checks for a help article list based on that last selection and displays actual articles for display. Adding the controls and getting everything...
7
4216
by: localhost | last post by:
A DataGrid with shows a label in one of the columns when in view mode. When in edit mode, I want to show a dropdown, and have the default selection set to what the textbox used to be. Right now the first item in the dropdown is always displayed. Template Code: <asp:TemplateColumn HeaderText="DropDown"> <ItemTemplate> <asp:Label runat="server" Text='<%# DataBinder.Eval
2
3756
by: Dave | last post by:
Hi, I'm building a maintenance form for a table and some of the fields are textboxes (i.e name) and some should be dropdowns (i.e country of origin) When a user clicks 'Edit' in the <asp:EditCommandColumn> I want either a textbox or dropdown to appear when I check what is being edited. I thought I could create the dropdown on the fly and add it to the datagrid as below but It's not appearing. I imagined I could populate the dropdown
3
4374
by: Tim::.. | last post by:
Can someone please tell me how I go about preselecting an item in a drop drown list when I click the Edit Command in a datagrid? I have tried the following but it doesn't work for me! I would be really grateful for any assistance! Thanks
0
1412
by: Luis Esteban Valencia | last post by:
Please help me if possible Its only adding a row. When I click again it steps into the function but doesnt add it to the page. Private Sub LinkButton2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LinkButton2.Click Dim tcells As TableCellCollection
3
1265
by: Sam | last post by:
Hi All, I'm having troubles with populating data to the dropdownlist in a datagrid and I just don't know what causes it. I have been struggling for 2 days now Would some one give me a hand? Here is what I have in the ItemDataBound Dim ddlProduct As DropDownList = CType(e.Item.Cells(1).FindControl("ddlFinalOffer"),
6
5849
by: yasodhai | last post by:
Hi, I used a dropdown control which is binded to a datagrid control. I passed the values to the dropdownlist from the database using a function as follows in the aspx itself. <asp:DropDownList ID="FldType_add" Runat="server" DataSource='< %#GetFieldType()%>' DataValueField="Type" DataTextField="Type" /> Oce the page is loaded all the values are added to the dropdown list. But when I thought of getting the selected value from the...
0
8737
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
8649
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,...
1
6573
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
5905
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
4411
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
4665
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3104
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
2399
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2036
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.