Note that there are some explanatory texts on larger screens.

plurals
  1. PORetrieving the information from text boxes to a list view
    primarykey
    data
    text
    <p>I am working in asp.net and i have three text boxes(First Name, Last Name, Middle Initials). There is a list view which shows the content, based on the information entered into text boxes. I am trying to make only the Last Name text box is required for proceeding the information. I already connected the sql data source to list view with the following code: </p> <p> </p> <pre><code> &lt;asp:TabPanel runat="server" HeaderText="Information" ID="TabPanel"&gt; &lt;ContentTemplate&gt; &lt;asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="&lt;%$ Name of the database %&gt;" SelectCommand="SELECT [UserID], [UserSuffix], [UserAddressLine1], [UserAddressLine2], [UserCity], [UserState], [UserZipCode], [UserPhoneNumber], [UserEmail] FROM [AllUsers] WHERE (([UserLastName] = @UserLastName) OR ([UserFirstName] = @UserFirstName) OR ([UserMiddleInitial] = @UserMiddleInitial))"&gt; &lt;SelectParameters&gt; &lt;asp:ControlParameter ControlID="txtUILastName" Name="UserLastName" PropertyName="Text" /&gt; &lt;asp:ControlParameter ControlID="txtUIFirstName" Name="UserFirstName" PropertyName="Text" /&gt; &lt;asp:ControlParameter ControlID="txtUIMI" Name="UserMiddleInitial" PropertyName="Text" /&gt; &lt;/SelectParameters&gt; &lt;/asp:SqlDataSource&gt; &lt;table id = "USERINF"&gt; &lt;tr&gt; &lt;td width="196px" class="style8"&gt; &lt;asp:Label ID="lblFirstName" runat="server" Text="Please enter First Name:"&gt;&lt;/asp:Label&gt; &lt;/td&gt; &lt;td class="style6"&gt; &lt;asp:TextBox ID="txtUIFirstName" runat="server" MaxLength="20"&gt;&lt;/asp:TextBox&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td width="196px" class="style8"&gt; &lt;asp:Label ID="lblLastName" runat="server" Text="Please enter Last Name:"&gt;&lt;/asp:Label&gt; &lt;/td&gt; &lt;td class="style6"&gt; &lt;asp:TextBox ID="txtUILastName" runat="server" MaxLength="20"&gt;&lt;/asp:TextBox&gt; &lt;asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate = "txtUILastName" ValidationExpression = "[a-zA-Z ]{1,20}" ForeColor="Red" ValidationGroup="UserInf" ErrorMessage="First Name must be only a-z,A-Z characters!" Display="Dynamic"&gt;&lt;/asp:RegularExpressionValidator&gt; &lt;asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate = "txtUILastName" ErrorMessage="Please enter Last Name!" ForeColor="Red" ValidationGroup="UserInf" Display="Dynamic"&gt;&lt;/asp:RequiredFieldValidator&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td width="196px" class="style8"&gt; &lt;asp:Label ID="lblMI" runat="server" Text="Please enter Middle Initials:"&gt;&lt;/asp:Label&gt; &lt;/td&gt; &lt;td class="style6"&gt; &lt;asp:TextBox ID="txtUIMI" runat="server" MaxLength="1" Width="30px" style="text-align: center; margin-left:2px"&gt;&lt;/asp:TextBox&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td width="196px" class="style8"&gt; &lt;/td&gt; &lt;td class="style6"&gt; &lt;asp:Button ID="btnIFind" runat="server" Text="Find" ValidationGroup = "UserInf"/&gt; </code></pre> <p>When i enter only Last Name, it does not retrieve any data from the data source, but it works only if i fill into all text boxes. How can i make only one text box is required for retrieving the information ? </p> <p>Find button and text boxes don't have any code behind </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload