Hi
I thought Eval("JobTitle")
converts returned value to type String
, but that doesn’t seem to be the case, since value (returned by Eval("JobTitle")
) passed to GetSelectedJobTitle()
was of type Object
and not String
, which caused an error saying “cannot convert from object to string”.
<EditItemTemplate>
<asp:DropDownList ID="EditJob" runat="server"
SelectedIndex='<%# GetSelectedJobTitle(Eval("JobTitle")) %>'
DataSource=’<%# Titles %>’>
</asp:DropDownList>
</EditItemTemplate>
public int GetSelectedJobTitle(string title)
{
...
}
public string[] Titles
{
...
}
a) So when does the conversion (from Object
to String
) of value returned from Eval("JobTitle")
) happen then?
b) And if Eval
doesn’t do the conversion, what method does?
thanx
EDIT:
I assume that in our example GetSelectedJobTitle() is called before Asp.Net evaluates ( and converts it to string ) the expression contained inside <%# %>?