Interview Questions → ASP.NET → ASP.NET Questionnaire I
ASP.NET Questionnaire I
<!--Label control-->
<asp:Label runat="server" Text="Label Control"></asp:Label>
<!--Literal control-->
<asp:Literal runat="server" Text="Literal Control"></asp:Literal>
<!--Label control-->
<span>Label Control</span>
<!--Literal control-->
Literal Control
<asp:GridView ID="GridView1" runat="server" DataSourceID="SqlDataSource1" AutoGenerateColumns="False"
DataKeyNames="testid">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<%# Eval("testname")%>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="edtName" runat="server" Text='<%# Eval("testname") %>' />
</EditItemTemplate>
</asp:TemplateField>
<asp:CommandField ShowEditButton="True"></asp:CommandField>
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:TestingConnectionString %>"
SelectCommand="SELECT [testid], [testname] FROM [test12]" UpdateCommand="Update [test12] SET [testname]=@testname WHERE [testid]=@testid"></asp:SqlDataSource>
Page.Form.DefaultButton = <button_name>.UniqueID