Hi All, I 'm a matter when using RadGrid and radwindow to
insert/update data from database. I used Formview to add data( controls:
textbox, combobox), but i used two related combox in formview to filter
data , i have error:
Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control.
My codes:
1. combox 1:
<telerik:RadComboBox ID="ddlMaSP" Runat="server" DataSourceID="SqlDsMaSP"
DataTextField="TenSP" DataValueField="MaSP" SelectedValue='<%# Bind("MaSP") %>'
Skin="Office2007" Width ="300px">
</telerik:RadComboBox>
<asp:SqlDataSource ID="SqlDsMaSP" runat="server"
ConnectionString="<%$ ConnectionStrings:PGKH %>" SelectCommand="PGKH_CboMaSP"
SelectCommandType="StoredProcedure">
</asp:SqlDataSource>
2. combbox thứ 2:
<telerik:RadComboBox ID="ddlCTMaSP" Runat="server" DataSourceID="SqlDsCTMaSP"
DataTextField="CTMaSP" DataValueField="IdCTMaSP"
SelectedValue='<%# Bind("IdCTMaSP") %>' Skin="Office2007" Width ="300px">
</telerik:RadComboBox>
<asp:SqlDataSource ID="SqlDsCTMaSP" runat="server"
ConnectionString="<%$ ConnectionStrings:PGKH %>"
SelectCommand="PGKH_CboChiTietMaSP" SelectCommandType="StoredProcedure">
<SelectParameters>
<asp:ControlParameter ControlID="ddlMaSP" Name="MaSP"
PropertyName="SelectedValue" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
I get error When i using Autopostback for two comboxbox, but i not
use Autopostback is not error but two comboxbox not related. Thanks all.
insert/update data from database. I used Formview to add data( controls:
textbox, combobox), but i used two related combox in formview to filter
data , i have error:
Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control.
My codes:
1. combox 1:
<telerik:RadComboBox ID="ddlMaSP" Runat="server" DataSourceID="SqlDsMaSP"
DataTextField="TenSP" DataValueField="MaSP" SelectedValue='<%# Bind("MaSP") %>'
Skin="Office2007" Width ="300px">
</telerik:RadComboBox>
<asp:SqlDataSource ID="SqlDsMaSP" runat="server"
ConnectionString="<%$ ConnectionStrings:PGKH %>" SelectCommand="PGKH_CboMaSP"
SelectCommandType="StoredProcedure">
</asp:SqlDataSource>
2. combbox thứ 2:
<telerik:RadComboBox ID="ddlCTMaSP" Runat="server" DataSourceID="SqlDsCTMaSP"
DataTextField="CTMaSP" DataValueField="IdCTMaSP"
SelectedValue='<%# Bind("IdCTMaSP") %>' Skin="Office2007" Width ="300px">
</telerik:RadComboBox>
<asp:SqlDataSource ID="SqlDsCTMaSP" runat="server"
ConnectionString="<%$ ConnectionStrings:PGKH %>"
SelectCommand="PGKH_CboChiTietMaSP" SelectCommandType="StoredProcedure">
<SelectParameters>
<asp:ControlParameter ControlID="ddlMaSP" Name="MaSP"
PropertyName="SelectedValue" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
I get error When i using Autopostback for two comboxbox, but i not
use Autopostback is not error but two comboxbox not related. Thanks all.