问题描述
如何将DetailsView内的空间的值赋给SqlDataSource中的参数呢?及将DetailsView中的TextBox值赋给SqlDataSource的名为moban的ControlParameter具体的SqlDataSource的代码<asp:SqlDataSourceID="SqlDataSource1"runat="server"ConnectionString="<%$ConnectionStrings:proConnectionString%>"SelectCommand="SELECT*FROM[factory]WHERE([user]=@user)"InsertCommand="INSERTINTOdbo.factory([moban])VALUES(@moban)"><SelectParameters><asp:ControlParameterControlID="Lb_name"Name="user"PropertyName="Text"Type="String"/></SelectParameters><InsertParameters><asp:ControlParameterControlID="TextBox11"Name="moban"PropertyName="Text"Type="String"/></InsertParameters></asp:SqlDataSource>DetailsView的代码:<asp:DetailsViewID="DetailsView1"runat="server"AutoGenerateRows="False"DataSourceID="SqlDataSource1"Height="50px"Width="98%"AutoGenerateEditButton="True"AutoGenerateInsertButton="True"><EmptyDataTemplate></EmptyDataTemplate><FooterTemplate></table></FooterTemplate><HeaderTemplate><tablewidth="85%"border="0"cellspacing="1"cellpadding="2"></HeaderTemplate><Fields><asp:TemplateFieldHeaderText="企业名称:"SortExpression="name"><EditItemTemplate><asp:TextBoxID="TextBox11"runat="server"Text='<%#Bind("moban")%>'></asp:TextBox></EditItemTemplate><InsertItemTemplate><asp:TextBoxID="TextBox11"runat="server"Text='<%#Bind("moban")%>'></asp:TextBox></InsertItemTemplate><ItemTemplate> <asp:TextBoxID="Tb_pname"runat="server"Text='<%#Bind("moban")%>'></asp:TextBox></ItemTemplate><ItemStyleFont-Size="Small"/><HeaderStyleFont-Size="Small"/></asp:TemplateField></Fields></asp:DetailsView>
解决方案
解决方案二:
支持搂主,收藏