473,503 Members | 2,259 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Adding Record To Datagrid Using DropDownList Fails

I'm trying to add a record to a data grid in a pretty standard
fasion. I have a dropdownlist in my footertemplate:

<FooterTemplate>
<asp:DropDownList runat="server" id="newTitle"
DataValueField="ActiveContentTypeID" DataTextField="Title"
DataSource='<%# GetTitles() %>' />
</FooterTemplate>

And as you can see it is filled via the call to GetTitles(). This is
function returns a collection of items rather than a dataset.

The DropDownList does properly fill. The ItemCommand event handler
is properly called and I do recieve the entire dropdown list in the
handler. However, the selectedIndex is always zero. Not -1 and not
the index of the item I have selected.

I can't track down the reason for this. Any ideas?

Thanks,

Gary

Mar 6 '07 #1
2 1178
Check and make sure that you're not calling DataBind on the DropDownList
before the ItemCommand fires.
HTH
I'm trying to add a record to a data grid in a pretty standard fasion.
I have a dropdownlist in my footertemplate:

<FooterTemplate>
<asp:DropDownList runat="server" id="newTitle"
DataValueField="ActiveContentTypeID" DataTextField="Title"
DataSource='<%# GetTitles() %>' />
</FooterTemplate>
And as you can see it is filled via the call to GetTitles(). This is
function returns a collection of items rather than a dataset.

The DropDownList does properly fill. The ItemCommand event handler
is properly called and I do recieve the entire dropdown list in the
handler. However, the selectedIndex is always zero. Not -1 and not
the index of the item I have selected.

I can't track down the reason for this. Any ideas?

Thanks,

Gary

Mar 6 '07 #2
Hi,
You better go thr this thread. It will guide you. I also faced the
same prob. But Mr.Eliyahu Goldin helped me by giving this thread.
http://groups.google.com/group/micro...fb18a7f436d8ba

Hope this will help you...
Regards,
Yaso

On Mar 7, 2:29 am, Konstantinos Pantos <kos...@pantos.namewrote:
Check and make sure that you're not calling DataBind on the DropDownList
before the ItemCommand fires.
HTH
I'm trying to add a record to a data grid in a pretty standard fasion.
I have a dropdownlist in my footertemplate:
<FooterTemplate>
<asp:DropDownList runat="server" id="newTitle"
DataValueField="ActiveContentTypeID" DataTextField="Title"
DataSource='<%# GetTitles() %>' />
</FooterTemplate>
And as you can see it is filled via the call to GetTitles(). This is
function returns a collection of items rather than a dataset.
The DropDownList does properly fill. The ItemCommand event handler
is properly called and I do recieve the entire dropdown list in the
handler. However, the selectedIndex is always zero. Not -1 and not
the index of the item I have selected.
I can't track down the reason for this. Any ideas?
Thanks,
Gary- Hide quoted text -

- Show quoted text -

Mar 8 '07 #3

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

Similar topics

0
2645
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...
2
3614
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...
3
4855
by: Jim Heavey | last post by:
Trying to figure out the technique which should be used to add rows to a datagrid. I am thinking that I would want an "Add" button on the footer, but I am not quite sure how to do that. Is that...
0
228
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...
0
7093
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
7291
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,...
0
7357
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
7468
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...
1
5023
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...
0
3180
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...
0
1522
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 ...
1
748
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
402
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...

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.