I have a sqldatasource with a very simple select statement that should always return one row. I have textboxes on a page that i want to fill with that data from the datasource. how could i do this for textboxes? If there is no data in the database then i want the textboxes to remain empty. How can I accomplish this?
<asp:Panel ID = "Panel2" runat="server" DefaultButton = "save" >
<fieldset style="width: 524px"><legend>Rouse InterChange Details</legend>
<asp:FormView runat="server" ID="MyFormView" DataSourceID="SqlDataSource3" DefaultMode="Edit">
<ItemTemplate >
<table>
<tr>
<td align="right">Interchange ID:</td>
<td align="left">
<asp:TextBox ID="txtIntID" runat="server" size="1" MaxLength = "2" Text='<%# Bind("Interchange_Id") %>'></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator8" ValidationGroup = "rouse" Display ="None" ControlToValidate = "txtIntID" runat="server" ErrorMessage="You Must Provide an Interchange ID."> </asp:RequiredFieldValidator>
<ajaxToolkit:ValidatorCalloutExtender ID="ValidatorCalloutExtender11" TargetControlID="RequiredFieldValidator8" HighlightCssClass="validatorCalloutHighlight" runat="server">
</ajaxToolkit:ValidatorCalloutExtender>
</td>
</tr>
<tr>
<td align="right">Sender ID:</td>
<td align="left">
<asp:TextBox ID="txtsender" runat="server" MaxLength = "15" ></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator9" ValidationGroup = "rouse" Display ="None" ControlToValidate = "txtsender" runat="server" ErrorMessage="You Must Provide a Sender ID."> </asp:RequiredFieldValidator>
<ajaxToolkit:ValidatorCalloutExtender ID="vce12" TargetControlID="RequiredFieldValidator9" HighlightCssClass="validatorCalloutHighlight" runat="server">
</ajaxToolkit:ValidatorCalloutExtender>
</td>
</tr>
<tr>
<td align="right">Interchange Standard ID:</td>
<td align="left">
<asp:TextBox ID="ISI" runat="server" size="1" MaxLength = "1" ></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator10" ValidationGroup = "rouse" Display ="None" ControlToValidate = "ISI" runat="server" ErrorMessage="You Must Provide an Interchange Standard ID."> </asp:RequiredFieldValidator>
<ajaxToolkit:ValidatorCalloutExtender ID="ValidatorCalloutExtender12" TargetControlID="RequiredFieldValidator10" HighlightCssClass="validatorCalloutHighlight" runat="server">
</ajaxToolkit:ValidatorCalloutExtender>
</td>
</tr>
<tr>
<td align="right">Version:</td>
<td align="left">
<asp:TextBox ID="Verstxt" runat="server" size="5" MaxLength = "5" ></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator11" ValidationGroup = "rouse" Display ="None" ControlToValidate = "Verstxt" runat="server" ErrorMessage="You Must Provide a Version."> </asp:RequiredFieldValidator>
<ajaxToolkit:ValidatorCalloutExtender ID="ValidatorCalloutExtender13" TargetControlID="RequiredFieldValidator11" HighlightCssClass="validatorCalloutHighlight" runat="server">
</ajaxToolkit:ValidatorCalloutExtender>
</td>
</tr>
<tr>
<td align="right">Functional ID:</td>
<td align="left">
<asp:TextBox ID="FuncID" runat="server" size="1" MaxLength = "2" ></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator12" ValidationGroup = "rouse" Display ="None" ControlToValidate = "FuncID" runat="server" ErrorMessage="You Must Provide a Functional ID."> </asp:RequiredFieldValidator>
<ajaxToolkit:ValidatorCalloutExtender ID="ValidatorCalloutExtender14" TargetControlID="RequiredFieldValidator12" HighlightCssClass="validatorCalloutHighlight" runat="server">
</ajaxToolkit:ValidatorCalloutExtender>
</td>
</tr>
<tr style="display:none">
<td align="right">Group Control #</td>
<td align="left">
<asp:TextBox ID="txtGroupcontrol" runat="server" size="6" MaxLength = "9" ></asp:TextBox>
</td>
</tr>
</table>
</ItemTemplate>
</asp:FormView>
<asp:SqlDataSource ID="SqlDataSource3" runat="server"
ConnectionString="connectionstring"
SelectCommand="select * from table1 "></asp:SqlDataSource>
</fieldset></asp:Panel>