//Write below code inside tag of the page
<script language="javascript" type="text/javascript">
//Show Hide Div
function showHide()
{
var chkBox = document.getElementById("chkShowHideDiv");
var divShowHide = document.getElementById("divShowHide");
if(chkBox.checked==true)
{
divShowHide.style.display="block";
}
else
{
divShowHide.style.display="none";
}
}
//Check TextBox control
function validateForm()
{
var chkDate = document.getElementById("txtDate");
var divErrMsg = document.getElementById("divError1");
if(chkDate.value=="" || chkDate.value==null )
{
divErrMsg.style.display="block";
return false;
}
else
{
return true;
}
}
//Drop Down Selection Changes
function ddlSelectionChange()
{
var ddlChange = document.getElementById("ddlChange").value;
document.getElementById("txtDate").value=ddlChange;
}
script>
//inside
tag <div id="divError1" runat="server" style="display:none; background-color:Red;color:#FFFFFF;">Please Enter Datediv>
<div>
<asp:GridView ID="gvCalander" runat="server" AutoGenerateColumns="false">asp:GridView>
div>
<div>
<asp:TextBox ID="txtDate" AutoCompleteType="LastName" runat="server">asp:TextBox> <asp:TextBox ID="txtMonth" runat="server">asp:TextBox> <asp:TextBox ID="txtYear" runat="server">asp:TextBox>
div>
<div>
<asp:Button ID="btnSubmit" runat="server" Text="SUBMIT" OnClientClick="return validateForm();" />
div>
<div><asp:CheckBox ID="chkShowHideDiv" onClick="javascript:showHide();" runat="server" />div>
<div id="divShowHide" runat="server" style="display:none;">
Hello this is test Div block which will show and hide after checkbox Checked--
div>
<div>
<asp:DropDownList ID="ddlChange" OnChange="ddlSelectionChange();" runat="server">
<asp:ListItem Value="INDIA" Text="INDIA">asp:ListItem>
<asp:ListItem Value="U.S.A" Text="U.S.A">asp:ListItem>
<asp:ListItem Value="Singapore" Text="Singapore">asp:ListItem>
<asp:ListItem Value="Malaysia" Text="Malaysia">asp:ListItem>
asp:DropDownList>
div>
Comments