Hi everybody,
I've added one more control to my UserControl (literal).
I'm getting this strange error now:
Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: Conversion failed when converting the varchar value 'WBHS' to data type int.
WBHS is the name of the School (School field).
I have a DropDownList on my UserControl like this:
<asp:SqlDataSource ID="SchoolsDataSource" ConnectionString="< %$ ConnectionStrings:FCCMSConnectionString % >"
SelectCommand="SELECT RTRIM([School]) + COALESCE(' - ' + [SchoolPhone],'') as SchoolInfo, [School], [SchoolPhone] FROM [Schools] WITH (NOLOCK) WHERE ([siteID] = @siteID)"
runat="server">
<SelectParameters>
<asp:ProfileParameter Name="SiteID" PropertyName="SiteID" Type ="Int32" />
</SelectParameters>
</asp:SqlDataSource>
<div class="cl">
<label class="bx">
School </label><span class="bx">
<asp:DropDownList ID="ddlSchool" runat="server"
DataSourceID="SchoolsDataSource"
DataTextField="School" DataValueField="School" Width="260px"
>
</asp:DropDownList>
</span>
<asp:Literal ID="litSchoolPhone" runat="server" Text=" " ></asp:Literal>
<br />
<br />
</div>
I only made changes in the SelectCommand and also added new literal control. I also added SchoolPhone to SP in the ASPX that calls this UserControl (and also exposed this property and Bind SchoolPhone in my page).
Do you have ideas where can I look for this error?
This is how this UserControl is set on the page
<!-- 4th -->
<div id="info4" class="cl dn">
<ScGr:SchoolGradeInfo ID="SchoolGradeVol" runat="server" EditMode ="false"
Grade='<%# Bind("Grade") %>'
School='<%# Bind("School") %>' SchoolPhone ='<%# Bind("SchoolPhone") %>' />
Thanks a lot in advance.
If it's not broken, fix it until it is.
My Blog