How to get textbox value from inside html tag
I want to select data from SqlDataSource tag to gridview using TextB开发者_如何学Cox1 value. how can I modify that ASP.net code behind file.
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
SelectCommand= "select distinct [Species],[qty],[received],[Discard],[mortility],[dispatch],[dispatch],[dpt_sales] from [vw_getFishDtls] where [Tank_id]=TextBox1.Text and [ftype] =(select [ftype] from [vw_getFishType] where [Tank_id]=TextBox1.Text"
ConnectionString="Data Source=IT-ISHAN;Initial Catalog=ETF;User Id=ishanuk77; Password=ishanuk77;">
</asp:SqlDataSource>
You can add ControlParameter
as below
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
SelectCommand= "select distinct [Species],[qty],[received],[Discard],[mortility],[dispatch],[dispatch],[dpt_sales] from [vw_getFishDtls] where [Tank_id]=TextBox1.Text and [ftype] =(select [ftype] from [vw_getFishType] where [Tank_id]=@Tank_id"
ConnectionString="Data Source=IT-ISHAN;Initial Catalog=ETF;User Id=ishanuk77; Password=ishanuk77;">
<SelectParameters>
<asp:ControlParameter ControlID="TextBox1" Name="Tank_id"
PropertyName="Text" />
</SelectParameters>
</asp:SqlDataSource>
精彩评论