Interview Questions → ASP.NET → ASP.NET Questionnaire I
ASP.NET Questionnaire I
.WrapStyle TD
{
word-break:break-all;
}
RowStyle-CssClass="WrapStyle"
<asp:Label AssociatedControlID="ddlName" runat="server" Text="User Name"></asp:Label>
<asp:DropDownList ID="ddlName" runat="server">
<asp:ListItem>Test1</asp:ListItem>
<asp:ListItem>Test2</asp:ListItem>
<asp:ListItem>Test3</asp:ListItem>
<asp:ListItem>Test4</asp:ListItem>
</asp:DropDownList>
Response.Output.Write("Today is {0:dd-MMM-yyyy}", DateTime.Now);
Response.Write("Today is Sunday");
<!--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