By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,203 Members | 1,546 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,203 IT Pros & Developers. It's quick & easy.

Implicit Conversion with Declarative syntax

P: n/a
Hi all,

I'd like to know if it's possible to declare an implicit type
conversion for when I use declarative Synthax in html.

For example, when I have the DropDownList, I can declatively set it's
Selected value like this : SelectedValue='<%# Bind("TaxCondition")
%>'. In this case, TaxCondition is an int, and the conversion from int
to string and string to int is made automatically.

Now, I've made my own CheckBoxList control in which I made a
Properties which enable me to give it a List<stringto set the
selected Items. The object I use returns an enum list ( List<enumX).
So, I'd like to know if there's a way to tell ASP to convert my
List<enumXto List<stringand the other way around. I know I could
simply put a property in my Object so that it would do the conversion
on it's own and return a List<string>, but the implicit conversion
would be much more intuitive.

If possible also, I'd want the implicit conversion to apply only in
the case of the declarative syntax. I woulnd't want it to be available
anywhere in the code.

Thanks
Simon Picard

Sep 13 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
no. Bind always return a string, so it performs the conversion to string.

-- bruce (sqlwork.com)

drop wrote:
Hi all,

I'd like to know if it's possible to declare an implicit type
conversion for when I use declarative Synthax in html.

For example, when I have the DropDownList, I can declatively set it's
Selected value like this : SelectedValue='<%# Bind("TaxCondition")
%>'. In this case, TaxCondition is an int, and the conversion from int
to string and string to int is made automatically.

Now, I've made my own CheckBoxList control in which I made a
Properties which enable me to give it a List<stringto set the
selected Items. The object I use returns an enum list ( List<enumX).
So, I'd like to know if there's a way to tell ASP to convert my
List<enumXto List<stringand the other way around. I know I could
simply put a property in my Object so that it would do the conversion
on it's own and return a List<string>, but the implicit conversion
would be much more intuitive.

If possible also, I'd want the implicit conversion to apply only in
the case of the declarative syntax. I woulnd't want it to be available
anywhere in the code.

Thanks
Simon Picard
Sep 13 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.