locked
how to create a controls(mostly label and text box) dynamically and read their input data in asp.net RRS feed

  • Question

  • User1864553114 posted

    Hi Greetings to all,

    I have set of Questions defined in SQL Server Database table. i want the Questions to be displayed by filtering the data in SQL Server based upon the users team or Specialty.a label has to be created for displaying the question selected from the table and a text box to take the input for the Question. is there any control or add in is there for this functionality kindly help on this. How can i achieve this functionality in asp.net. thanks in advance.

    Saturday, November 18, 2017 11:25 AM

All replies

  • User475983607 posted

    Hi Greetings to all,

    I have set of Questions defined in SQL Server Database table. i want the Questions to be displayed by filtering the data in SQL Server based upon the users team or Specialty.a label has to be created for displaying the question selected from the table and a text box to take the input for the Question. is there any control or add in is there for this functionality kindly help on this. How can i achieve this functionality in asp.net. thanks in advance.

    This is a fundamentals questions...

    If this is an ASP Web Forms application, use Data Bound Server controls.

    https://www.asp.net/web-forms/overview/aspnet-data-controls

    If this is an MVC application, use HTML helpers.

    https://www.asp.net/mvc/overview/getting-started

    You can find a lot of great information by clicking the "Learn" link in the above menu.

    Saturday, November 18, 2017 1:18 PM
  • User61956409 posted

    Hi Ayub Khan M,

     

    Ayub Khan M

    I have set of Questions defined in SQL Server Database table. i want the Questions to be displayed by filtering the data in SQL Server based upon the users team or Specialty.a label has to be created for displaying the question selected from the table and a text box to take the input for the Question.

    You can use ADO.NET to access to your SQL database and retrieve data from database. You can refer to this article to know more about ADO.NET technologies.

    Besides, you are creating and building an ASP.NET WebForm application, you can choose Repeater control to display your questions in a table layout. The following sample is for your reference.

    <asp:Repeater ID="my_repeater" runat="server" OnItemCommand="my_repeater_ItemCommand">
    
        <HeaderTemplate>
    
            <table cellspacing="0" rules="all" border="1">
    
                <tr>
    
                    <th scope="col" style="width: 40px">Question Id</th>
    
                    <th scope="col" style="width: 80px">Question
    
                    </th>
    
                    <th scope="col" style="width: 120px">Your Answer
    
                    </th>
    
                    <th scope="col" style="width: 80px"></th>
    
                </tr>
    
        </HeaderTemplate>
    
        <ItemTemplate>
    
            <tr>
    
                <td>
    
                    <asp:Label ID="lblCustomerId" runat="server" Text='<%# Eval("question_id") %>' />
    
                </td>
    
                <td>
    
                    <asp:Label ID="lblContactName" runat="server" Text='<%# Eval("question") %>' />
    
                </td>
    
                <td>
    
                    <asp:TextBox ID="txtanswer" runat="server" TextMode="MultiLine"></asp:TextBox>
    
                </td>
    
                <td>
    
                    <asp:Button ID="btnok" runat="server" Text="Submit" CommandName="submit" />
    
                </td>
    
            </tr>
    
        </ItemTemplate>
    
        <FooterTemplate>
    
            </table>
    
        </FooterTemplate>
    
    </asp:Repeater> 

     

    With Regards,

    Fei Han

    <sub></sub><sup></sup>

    Monday, November 20, 2017 6:59 AM