Solved

Accessing a Custom Control in EditItemTemplate Datalist

Posted on 2004-09-16
4
540 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Web site error 3 44
asp day pilot 3 23
mail.To.Add 5 33
Correct and Effective way to generate pdf files online via JavaScript or ASP.Net? 6 55
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

856 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