Solved

Accessing a Custom Control in EditItemTemplate Datalist

Posted on 2004-09-16
4
530 Views
Last Modified: 2008-01-09
I have a custom control in the EditItemTemplate of a  Datalist.
The custom control is called mspwc:DatePicker, which is a datepicker with a DHTML calendar.

The control works fine in the EditItemTemplate, but the problem I have is accessing the value of the control to save it to a database.
I normally use this statement to recover EditItemTemplate values;
Dim strMemberName As String = CType(e.Item.FindControl("ddlMemberName"), DropDownList).SelectedItem.Value

When I try to replace DropDownList with the DatePicker it is not recognized.

Any suggestions on how I can recover the datepicker values, or suggestions on how I can do something similar?

Thanks
0
Comment
Question by:gspronych
  • 2
4 Comments
 
LVL 8

Expert Comment

by:boulder_bum
ID: 12079993
Try using
e.Item.Cells(0).Controls(0)  'Replace the zeros with the proper indices
 instead of e.Item.FindControl?

0
 
LVL 3

Author Comment

by:gspronych
ID: 12086087
Thanks for the suggestion, but 'Cells' is not a member of System.Web.UI.WebControls.DataListItem

Any other suggestions?
Thanks
0
 
LVL 3

Accepted Solution

by:
gspronych earned 0 total points
ID: 12088850
Thanks for you help, but I figured it out.

I had to fully qualify the control name,
ie
Dim strTargetDT As String = CType(e.Item.FindControl("dpTarget"), MSPress.WebControls.DatePicker).SelectedDate

I checked all over the net and couldn't find anything similar.
Hopefully this solution will help someone else not waste an entire day (like me).
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now