Data not inserting into database, it shows empty columns in table - asp.net

I have form inside panel and I am inserting data into the database by using a stored procedure from form. It doesn't throw any error, but it is not showing data in the database. Code works successfully but columns in tables are empty.
This is my stored procedure:
CREATE procedure [dbo].[spDREG]
(#pname varchar(250),
#spname varchar(250),
#age int,
#spage int,
#cat varchar(50),
#mno bigint,
#emlid varchar(250),
#years varchar(50)
)
AS
BEGIN
DECLARE #dregid INT = ##identity
INSERT INTO DREG(P_NAME, SECP_NAME, AGE, AGET, CAT, MOB_NO, EMAILD, YEARS)
VALUES(#pname, #spname, #age, #spage, #cat, #mno, #emlid, #years)
END
This is my code behind
protected void Dsbtn_click(object sender, EventArgs e)
{
string psname ="spDREG"; ;
con.Open();
SqlCommand cmd = new SqlCommand(psname,con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("#pname", TextBox1.Text.ToString());
cmd.Parameters.AddWithValue("#spname", TextBox2.Text.ToString());
cmd.Parameters.AddWithValue("#age", TextBox22.Text.ToString());
cmd.Parameters.AddWithValue("#spage", TextBox24.Text.ToString());
cmd.Parameters.AddWithValue("#cat", DropDownList1.Text.ToString());
cmd.Parameters.AddWithValue("#mno", TextBox4.Text.ToString());
cmd.Parameters.AddWithValue("#emlid", TextBox5.Text.ToString());
cmd.Parameters.AddWithValue("#years", DropDownList2.Text.ToString());
cmd.ExecuteNonQuery();
con.Close();
dreglbl.Text = "You have successfully registered";
}
This is my design part
<asp:Panel runat="server" ID="dan" class="npan" Width="900px" Height="500px">
<h3 style="text-align: center" class="panhed">Please Fill This Form TO Participate(Dance Registration)</h3>
<div id="snam" runat="server" class="nam">
<asp:Label ID="Label2" runat="server" Text="Name of participant:"></asp:Label>
<asp:TextBox ID="TextBox1" CssClass="txtcls" runat="server" TextMode="MultiLine"></asp:TextBox>
<asp:Button ID="addm" class="addbtn" runat="server" autopostback="true" Text="Add member" OnClick="addm_Click" />
</div>
<div id="Div3" runat="server" class="nams">
<asp:Label ID="Label3" runat="server" autopostback="true" Text="Name of 2nd participant:"></asp:Label>
<asp:TextBox ID="TextBox2" CssClass="txtscls" runat="server"></asp:TextBox>
</div>
<div id="Div29" runat="server" class="nams">
<asp:Label ID="Label27" runat="server" Text="Age:"></asp:Label>
<asp:TextBox ID="TextBox22" CssClass="agtxt" placeholder="1st" runat="server"></asp:TextBox>
<asp:TextBox ID="TextBox24" CssClass="agstxt" placeholder="2nd" AutoPostBack="true" runat="server"></asp:TextBox>
</div>
<div id="Div2" runat="server" class="cate">
<asp:Label ID="Label4" runat="server" Text="Select Category:"></asp:Label>
<asp:DropDownList runat="server" ID="DropDownList1" Class="drpd" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged">
<asp:ListItem Value="22">select</asp:ListItem>
<asp:ListItem Value="Ss">Solo</asp:ListItem>
<asp:ListItem Value="Dd">Duet</asp:ListItem>
<asp:ListItem Value="Gg">Group</asp:ListItem>
</asp:DropDownList>
</div>
<div id="divv" class="mobn" runat="server">
<asp:Label ID="Label5" runat="server" Text="Mobile No:"></asp:Label>
<asp:TextBox ID="TextBox4" CssClass="mobtxt" runat="server"></asp:TextBox>
</div>
<div id="Div6" runat="server" class="eml">
<asp:Label ID="Label6" runat="server" Text="E-Mail:"></asp:Label>
<asp:TextBox ID="TextBox5" CssClass="emtxt" runat="server"></asp:TextBox>
</div>
<div id="Div7" runat="server" class="yer">
<asp:Label ID="Label7" runat="server" Text="Select Year:"></asp:Label>
<asp:DropDownList runat="server" ID="DropDownList2" Class="drpds">
<asp:ListItem>select</asp:ListItem>
<asp:ListItem>First</asp:ListItem>
<asp:ListItem>Second</asp:ListItem>
<asp:ListItem>Third</asp:ListItem>
<asp:ListItem>other</asp:ListItem>
</asp:DropDownList>
</div>
<div id="Div8" runat="server" class="btndiv">
<asp:Button ID="Dsbtn" runat="server" Class="Btncss" Text="Submit" OnClick="Dsbtn_click" />
<asp:Label ID="dreglbl" runat="server" Text="label"></asp:Label>
</div>
</asp:Panel>
Please solve it guys. Thank you

Related

ASP WebForms AutoCompleteExtender in GridView not firing

I have this webform with 3 AutoCompleteExtenders using the AjaxControlToolkit. The first one deals with customers from a database and that works very well. I have place 2 others in a gridview, AutoCompleteExtenders 2 and 3 to fetch items. For some reason, these do not work and a breakpoint in Items.asmx does not reach when running the code. I have setup these 2 extenders same as the customer one.
What am I doing wrong? I have searched articles online on use in gridviews but am unable to find the issue.
I have
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true">
in the masterpage.
Code in webform:
<%# Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="PipemanWebPortal.Views.PurchaseOrders.Default" %>
<%# Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
<h2>Add Purchase Order</h2>
<script type="text/javascript">
$(document).ready(function () {
window.setTimeout(function () {
$(".alert").fadeTo(1500, 0).slideUp(500, function () {
$(this).remove();
});
}, 3000);
});
// On Page Load
$(function () {
SetDatePicker();
});
// On UpdatePanel Refresh
var prm = Sys.WebForms.PageRequestManager.getInstance();
if (prm != null) {
prm.add_endRequest(function (sender, e) {
if (sender._postBackSettings.panelsToUpdate != null) {
SetDatePicker();
$(".datepicker-orient-bottom").hide();
}
});
};
function SetDatePicker() {
$('#datetimepicker').datepicker
({
format: 'dd.MM.yyyy',
inline: true,
todayHighlight: true,
autoclose: true
});
}
</script>
<div runat="server" visible="false" id="AlertDanger" class="alert alert-danger">
×
<strong>You must choose a date</strong>
</div>
<div runat="server" visible="false" id="AlertSuccess" class="alert alert-success">
×
<strong>Purchase requisition saved successfully</strong>
</div>
<asp:Panel ID="PODetails" runat="server">
<div>
<asp:UpdatePanel ID="UpdatePanelPO" runat="server">
<ContentTemplate>
<asp:Panel ID="Panel1" runat="server" BackColor="#E6E6E6">
<fieldset class="form-horizontal">
<div class="row">
<div class="form-group col-sm-6">
<asp:Label runat="server" CssClass="col-sm-6 control-label">Required Date</asp:Label>
<div class="col-sm-6">
<div class="input-group date" id="datetimepicker">
<span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
<asp:TextBox ID="txtRequiredDate" runat="server" CssClass="form-control"></asp:TextBox>
<asp:RequiredFieldValidator runat="server" ControlToValidate="txtRequiredDate" Display="Dynamic"
CssClass="text-danger" ErrorMessage="The Required Date field is required." />
</div>
</div>
</div>
<div class="form-group col-sm-6">
<asp:Label runat="server" CssClass="col-sm-6 control-label">No.</asp:Label>
<div class="col-sm-6">
<asp:Label ID="lblDocNum" runat="server" CssClass="form-control"></asp:Label>
</div>
</div>
</div>
</fieldset>
<fieldset class="form-horizontal">
<div class="row">
<div class="form-group col-sm-6">
<asp:Label runat="server" CssClass="col-sm-6 control-label" class="">Cust. PO No.</asp:Label>
<div class="col-sm-6">
<div class="input-group">
<asp:TextBox ID="txtPurchaseOrderNo" runat="server" CssClass="form-control"></asp:TextBox>
<asp:RequiredFieldValidator runat="server" ControlToValidate="txtPurchaseOrderNo" Display="Dynamic"
CssClass="text-danger" ErrorMessage="The Cust. Purchase Order No field is required." />
</div>
</div>
</div>
<div class="form-group col-sm-6">
<asp:Label runat="server" CssClass="col-sm-6 control-label">Contact</asp:Label>
<div class="col-sm-6">
<div class="input-group">
<asp:TextBox ID="txtContact" runat="server" CssClass="form-control"></asp:TextBox>
<asp:RequiredFieldValidator runat="server" ControlToValidate="txtContact" Display="Dynamic"
CssClass="text-danger" ErrorMessage="The Contact field is required." />
</div>
</div>
</div>
</div>
</fieldset>
<fieldset class="form-horizontal">
<div class="row">
<div class="form-group col-sm-3">
<asp:Label runat="server" CssClass="col-sm-12 control-label" class="">Customer Name</asp:Label>
</div>
<div class="form-group col-sm-9">
<asp:TextBox ID="txtCustomer" runat="server" CssClass="form-control"></asp:TextBox>
<ajaxToolkit:AutoCompleteExtender
ID="AutoCompleteExtender1"
runat="server"
TargetControlID="txtCustomer"
ServicePath="../../Web_Service/Customers.asmx"
ServiceMethod="GetCustomers"
MinimumPrefixLength="2"
EnableCaching="true"
CompletionSetCount="10"
CompletionInterval="10"
DelimiterCharacters=";, :"
ShowOnlyCurrentWordInCompletionListItem="true">
</ajaxToolkit:AutoCompleteExtender>
<asp:RequiredFieldValidator runat="server" ControlToValidate="txtCustomer" Display="Dynamic"
CssClass="text-danger" ErrorMessage="The Customer field is required." />
</div>
</div>
</div>
</fieldset>
</asp:Panel>
<asp:GridView ID="pOGridView"
runat="server"
AutoGenerateColumns="False"
AllowPaging="True"
AllowSorting="True"
ShowFooter="True"
OnRowEditing="pOGridView_RowEditing"
OnRowUpdating="pOGridView_RowUpdating"
OnPageIndexChanging="pOGridView_PageIndexChanging"
OnRowCancelingEdit="pOGridView_RowCancelingEdit"
PagerStyle-CssClass="bs-pagination"
ShowHeaderWhenEmpty="True"
EmptyDataText="No Records Found"
CssClass="table table-striped table-bordered table-hover table-condensed">
<Columns>
<asp:TemplateField ItemStyle-Width="30px" HeaderText="#">
<ItemTemplate>
<asp:Label ID="lblLineNum" Text='<%# Container.DataItemIndex + 1 %>' runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField ItemStyle-Width="120px" HeaderText="Item">
<ItemTemplate>
<asp:Label ID="lblItem" runat="server"
Text='<%# Bind("Item")%>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtItem" runat="server" Width="300px" Text='<%# Bind("Item")%>'></asp:TextBox>
<ajaxToolkit:AutoCompleteExtender
ID="AutoCompleteExtender2"
runat="server"
TargetControlID="txtItem"
ServicePath="../../Web_Service/Items.asmx"
ServiceMethod="GetItems"
MinimumPrefixLength="2"
EnableCaching="true"
CompletionSetCount="10"
CompletionInterval="10"
DelimiterCharacters=";, :"
ShowOnlyCurrentWordInCompletionListItem="true">
</ajaxToolkit:AutoCompleteExtender>
<asp:RequiredFieldValidator runat="server" ControlToValidate="txtItem" Display="Dynamic" ValidationGroup="Edit"
CssClass="text-danger" ErrorMessage="The Item field is required." />
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtItem" runat="server" Width="300px"></asp:TextBox>
<ajaxToolkit:AutoCompleteExtender
ID="AutoCompleteExtender3"
runat="server"
TargetControlID="txtItem"
ServicePath="../../Web_Service/Items.asmx"
ServiceMethod="GetItems"
MinimumPrefixLength="2"
EnableCaching="true"
CompletionSetCount="10"
CompletionInterval="10"
DelimiterCharacters=";, :"
ShowOnlyCurrentWordInCompletionListItem="true">
</ajaxToolkit:AutoCompleteExtender>
<asp:RequiredFieldValidator runat="server" ControlToValidate="txtItem" Display="Dynamic" ValidationGroup="Insert"
CssClass="text-danger" InitialValue="-1" ErrorMessage="The Item field is required." />
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField ItemStyle-Width="60px" HeaderText="Qty.">
<ItemTemplate>
<asp:Label ID="lblQuantity" runat="server"
Text='<%# Bind("Quantity")%>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtQuantity" runat="server" Width="100px"
Text='<%# Bind("Quantity")%>'></asp:TextBox>
<asp:RequiredFieldValidator runat="server" ControlToValidate="txtQuantity" Display="Dynamic" ValidationGroup="Edit"
CssClass="text-danger" ErrorMessage="The Quantity field is required." />
<asp:RegularExpressionValidator ControlToValidate="txtQuantity" runat="server" CssClass="text-danger" Display="Dynamic"
ErrorMessage="Only integers allowed." ValidationExpression="^(0|[1-9]\d*)$"
ValidationGroup="Edit"></asp:RegularExpressionValidator>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtQuantity" runat="server" Width="100px"></asp:TextBox>
<asp:RequiredFieldValidator runat="server" ControlToValidate="txtQuantity" Display="Dynamic" ValidationGroup="Insert"
CssClass="text-danger" ErrorMessage="The Quantity field is required." />
<asp:RegularExpressionValidator ControlToValidate="txtQuantity" runat="server" CssClass="text-danger" Display="Dynamic"
ErrorMessage="Only integers allowed." ValidationExpression="^(0|[1-9]\d*)$"
ValidationGroup="Insert"></asp:RegularExpressionValidator>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField ItemStyle-Width="80px" HeaderText="Unit Price">
<ItemTemplate>
<asp:Label ID="lblUnitPrice" runat="server"
Text='<%# Bind("UnitPrice")%>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtUnitPrice" runat="server" Width="100px"
Text='<%# Bind("UnitPrice")%>'></asp:TextBox>
<asp:RequiredFieldValidator runat="server" ControlToValidate="txtUnitPrice" Display="Dynamic" ValidationGroup="Edit"
CssClass="text-danger" ErrorMessage="The Unit Price is required." />
<asp:RegularExpressionValidator ControlToValidate="txtUnitPrice" runat="server" CssClass="text-danger" Display="Dynamic"
ErrorMessage="Only numbers allowed." ValidationExpression="^[0-9]{0,6}(\.[0-9]{1,2})?$"
ValidationGroup="Edit"></asp:RegularExpressionValidator>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtUnitPrice" runat="server" Width="100px"></asp:TextBox>
<asp:RequiredFieldValidator runat="server" ControlToValidate="txtUnitPrice" Display="Dynamic" ValidationGroup="Insert"
CssClass="text-danger" ErrorMessage="The Unit Price is required." />
<asp:RegularExpressionValidator ControlToValidate="txtUnitPrice" runat="server" CssClass="text-danger" Display="Dynamic"
ErrorMessage="Only numbers allowed." ValidationExpression="^[0-9]{0,6}(\.[0-9]{1,2})?$"
ValidationGroup="Insert"></asp:RegularExpressionValidator>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField ItemStyle-Width="80px" HeaderText="Order Price">
<ItemTemplate>
<asp:Label ID="lblOrderPrice" runat="server"
Text='<%# Bind("OrderPrice")%>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtOrderPrice" runat="server" Width="100px"
Text='<%# Bind("OrderPrice")%>'></asp:TextBox>
<asp:RequiredFieldValidator runat="server" ControlToValidate="txtOrderPrice" Display="Dynamic" ValidationGroup="Edit"
CssClass="text-danger" ErrorMessage="The Order Price is required." />
<asp:RegularExpressionValidator ControlToValidate="txtOrderPrice" runat="server" CssClass="text-danger" Display="Dynamic"
ErrorMessage="Only numbers allowed." ValidationExpression="^[0-9]{0,6}(\.[0-9]{1,2})?$"
ValidationGroup="Edit"></asp:RegularExpressionValidator>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtOrderPrice" runat="server" Width="100px"></asp:TextBox>
<asp:RequiredFieldValidator runat="server" ControlToValidate="txtUnitPrice" Display="Dynamic" ValidationGroup="Insert"
CssClass="text-danger" ErrorMessage="The Order Price is required." />
<asp:RegularExpressionValidator ControlToValidate="txtOrderPrice" runat="server" CssClass="text-danger" Display="Dynamic"
ErrorMessage="Only numbers allowed." ValidationExpression="^[0-9]{0,6}(\.[0-9]{1,2})?$"
ValidationGroup="Insert"></asp:RegularExpressionValidator>
</FooterTemplate>
</asp:TemplateField>
<asp:CommandField ShowEditButton="True" ValidationGroup="Edit" />
<asp:TemplateField>
<ItemTemplate>
<asp:LinkButton ID="lnkRemove" runat="server"
CommandArgument='<%# Bind("LineNum")%>'
OnClientClick="return confirm('Are you sure you want to delete this row?')"
Text="Delete" OnClick="DeleteRowPurchaseOrder"></asp:LinkButton>
</ItemTemplate>
<FooterTemplate>
<asp:Button ID="btnAdd" runat="server" Text="Add" ValidationGroup="Insert" CssClass="btn btn-primary btn-sm"
OnClick="AddRowPurchaseOrder" />
</FooterTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<div class="form-group">
<div class="row">
<div class="col-sm-3">
<asp:Button runat="server" ID="InsertButton" OnClick="Insert" Text="Insert" CssClass="btn btn-block btn-primary" />
</div>
<div class="col-sm-3">
<asp:Button runat="server" ID="CancelButton" OnClick="Cancel" Text="Cancel" CausesValidation="false" CssClass="btn btn-block btn-default" />
</div>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</asp:Panel>
</asp:Content>
Looks like the other two AutoCompleteExtender are on two different <asp:Panel>, try put on same Panel,
<asp:Panel ID="Panel1" runat="server" BackColor="#E6E6E6">. that's probably the reason why the first one is working, and other two are not.

How to merge all footer cells in a responsive, bootstrapped DataGrid?

I have a multi-column DataGrid in an ASP.NET user control with a footer whose columns I'd like to merge as one cell. How do I do that? I'm using C# for the code-behind, Bootstrap 4 beta classes to automatically hide columns as the viewport width changes, Font-Awesome for some symbols/icons, and below is the DataGrid inside my ASCX markup. Currently it all works, except that I want the footer row to be all merged as one cell. In the end, the items in my first column's FooterTemplate should spread out across the successfully merged footer cell because I've already prepared the styling for that (I'm presuming that all of the other empty footer cells will get merged into the first footer cell, and that the content of the first footer cell will be kept).
<div class="col-lg-12 ">
<div class="table-responsive">
<asp:datagrid id="dgEggGradeDetails" UseAccessibleHeader="True" AutoGenerateColumns="False" CssClass="table table-striped table-bordered table-hover" ShowHeader="True" ShowFooter="True" runat="server" DataKeyField="EggID" CellPadding="0" GridLines="None" AllowSorting="True" OnSortCommand="dgEggGradeDetails_SortCommand" OnItemCreated="dgEggGradeDetails_ItemCreated">
<FooterStyle CssClass="">
</FooterStyle>
<Columns>
<asp:TemplateColumn HeaderText="Egg ID" SortExpression="EggID" HeaderStyle-CssClass="visible-xs visible-sm visible-md visible-lg" ItemStyle-CssClass="visible-xs visible-sm visible-md visible-lg">
<ItemTemplate>
<asp:Label ID="lblEggID" Runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "EggID") %>'></asp:Label>
</ItemTemplate>
<FooterTemplate>
<div id="dvHidePickledOrDeviled" runat="server">
<div style="text-align: left; float: left; width: 80%; height: 100%;">
<asp:Label ID="lblHideFooter" runat="server" CssClass="" Visible="True">Hide All Eggs (Deviled, Pickled)</asp:Label>
</div>
<div style="text-align: right;">
<asp:LinkButton ID="btnHidePickledOrDeviled" runat="server" OnClick="ShowOrHidePickledOrDeviled" CssClass="" Visible="True" CommandName="HidePickledOrDeviled">
<i id="iHidePickledOrDeviled" class="fa fa-minus-square-o" style="font-size: 40px;" title="Hide Eggs with 'Deviled' and 'Pickled' grades"></i>
</asp:LinkButton>
</div>
</div>
<div id="dvShowPickledOrDeviled" runat="server">
<div style="text-align: left; float: left; width: 80%; height: 100%;">
<asp:Label ID="lblShowFooter" runat="server" CssClass="" Visible="True">See All Eggs (Deviled, Pickled)</asp:Label>
</div>
<div style="text-align: right;">
<asp:LinkButton ID="btnShowPickledOrDeviled" runat="server" OnClick="ShowOrHidePickledOrDeviled" CssClass="" Visible="True" CommandName="ShowPickledOrDeviled">
<i id="iShowPickledOrDeviled" class="fa fa-plus-square-o" style="font-size: 40px;" title="Show Eggs with 'Deviled' and 'Pickled' grades"></i>
</asp:LinkButton>
</div>
</div>
</FooterTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Egg Name" SortExpression="EggName" HeaderStyle-CssClass="visible-md visible-lg" ItemStyle-CssClass="visible-md visible-lg">
<ItemTemplate>
<asp:Label ID="lblEggName" Runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "EggName") %>'></asp:Label>
</ItemTemplate>
<FooterTemplate>
</FooterTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Egg Grade" SortExpression="EggGrade" HeaderStyle-CssClass="visible-sm visible-md visible-lg" ItemStyle-CssClass="visible-sm visible-md visible-lg">
<ItemTemplate>
<asp:Label ID="lblGrade" Runat="server" />
<asp:Label ID="lblGradeErrorMsg" Runat="server" />
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Confirm Grade" SortExpression="Grade" HeaderStyle-CssClass="visible-xs visible-sm visible-md visible-lg" ItemStyle-CssClass="visible-xs visible-sm visible-md visible-lg">
<ItemTemplate>
<asp:dropdownlist id="ddlConfirmGrade" Runat="server"></asp:dropdownlist>
<asp:Label ID="lblConfirmGrade" Runat="server" />
</ItemTemplate>
<FooterTemplate>
</FooterTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Edible End Date" Visible="False" HeaderStyle-CssClass="visible-lg" ItemStyle-CssClass="visible-lg">
<ItemTemplate>
<asp:Label id="lblEdibleEndDate" Runat="server" text='<%# String.Format("{0:MM/dd/yyyy}", DataBinder.Eval(Container.DataItem, "EdibleEndDate2"))%>'></asp:Label>
</ItemTemplate>
<FooterTemplate>
</FooterTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Egg Grade Sync Date" Visible="False" HeaderStyle-CssClass="visible-lg" ItemStyle-CssClass="visible-lg">
<ItemTemplate>
<asp:Label id="lblEggGradeUpdatedDate" Runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "EggGradeUpdatedDate") %>'></asp:Label>
</ItemTemplate>
<FooterTemplate>
</FooterTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Expiration" SortExpression="ExpirationStopDate" HeaderStyle-CssClass="visible-lg" ItemStyle-CssClass="visible-lg">
<ItemTemplate>
<asp:Label id="lblExpirationStopDate" Runat="server" text='<%# String.Format("{0:MM/dd/yyyy}", DataBinder.Eval(Container.DataItem, "ExpirationStopDate"))%>'></asp:Label>
</ItemTemplate>
<FooterTemplate>
</FooterTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Reason for Grade Change" SortExpression="GradeChangeDescription" HeaderStyle-CssClass="visible-xs visible-sm visible-md visible-lg" ItemStyle-CssClass="visible-xs visible-sm visible-md visible-lg">
<ItemTemplate>
<asp:dropdownlist id="ddlGradeChangeReason" Runat="server"></asp:dropdownlist>
<asp:Label id="lblReasonErrorMsg" Font-Size="10px" Runat="server"></asp:Label><INPUT id=hiRegistrationID type=hidden value='<%# DataBinder.Eval(Container.DataItem, "RegistrationID") %>' name=hiRegistrationID Runat="server"></input>
<input id="hiCurrLetGrade" type="hidden" value='<%# DataBinder.Eval(Container.DataItem, "Grade") %>' name=hiCurrLetGrade Runat="server">
<input id="hiCurrLetGradeID" type="hidden" value='<%# DataBinder.Eval(Container.DataItem, "GradeID") %>' name=hiCurrLetGradeID Runat="server">
<input id="hiGradeEnteredDate" type="hidden" value='<%# DataBinder.Eval(Container.DataItem, "GradeEnteredDate") %>' name="hiGradeEnteredDate" Runat="server" />
<input id="hiEggEmail" type="hidden" value='<%# DataBinder.Eval(Container.DataItem, "Email") %>' name="hiEggEmail" Runat="server" />
<input id="hiQualityStatusID" type="hidden" value='<%# DataBinder.Eval(Container.DataItem, "CurrentQualityStatusID") %>' name="hiQualityStatusID" Runat="server" />
<input id="hiEggLaidDate" type="hidden" value='<%# DataBinder.Eval(Container.DataItem, "EggLaidDate") %>' name="hiEggLaidDate" Runat="server" />
<input id="hiStoreName" type="hidden" value='<%# DataBinder.Eval(Container.DataItem, "StoreName") %>' name="hiStoreName" Runat="server" />
<input id="hiTypeAEgg" type="hidden" value='<%# DataBinder.Eval(Container.DataItem, "TypeAEgg") %>' name="hiTypeAEgg" Runat="server" />
<input id="hiTypeBEgg" type="hidden" value='<%# DataBinder.Eval(Container.DataItem, "IsTypeBEgg") %>' name="hiTypeBEgg" Runat="server" />
<input id="hiEdibleTypeID" type="hidden" value='<%# DataBinder.Eval(Container.DataItem, "EdibleTypeID") %>' name="hiEdibleTypeID" Runat="server" />
<input id="hiGradeChangeReasonID" type="hidden" value='<%# DataBinder.Eval(Container.DataItem, "GradeChangeReasonID") %>' name=hiGradeChangeReasonID Runat="server">
<input id="hiGradeChangeDescription" type="hidden" value='<%# DataBinder.Eval(Container.DataItem, "GradeChangeDescription") %>' name=hiGradeChangeDescription Runat="server">
<asp:Label ID ="lblCurrLetGrade" EnableViewState ="True" Visible = "False" Runat = "server" Text = '<%# DataBinder.Eval(Container.DataItem, "Grade") %>'></asp:Label>
<asp:Label ID ="lblEggGrade" EnableViewState ="True" Visible = "False" Runat = "server" Text = '<%# DataBinder.Eval(Container.DataItem, "EggGrade") %>'></asp:Label>
</ItemTemplate>
<FooterTemplate>
</FooterTemplate>
</asp:TemplateColumn>
</Columns>
</asp:datagrid>
</div>
</div>
In the code-behind, inside the ItemCreated event handler, place the following code to merge the entire footer row:
protected void dgEggGradeDetails_ItemCreated(object sender, DataGridItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Footer)
{
int newcolspan = 1;
int totalColumns = e.Item.Cells.Count - 1;
for (int i = totalColumns; i >= 1; i--)
{
if (e.Item.Cells[i].Visible)
{
e.Item.Cells.RemoveAt(i);
newcolspan++;
}
}
e.Item.Cells[0].ColumnSpan = newcolspan;
}
}

panel is not working on dropdown click

This is mydesign part. i am showing panels on dropdwon click but its not working.
i have others tab too in tab container.
<ContentTemplate>
<h3 class="headr">Please Select a Category From Following</h3>
<div class="dropdown">
<asp:Image ID="culD" runat="server" Height="200px" Width="200px" class="dropbtn" ImageUrl="~/User/assets/Images/Explore/c_banner.jpg"></asp:Image>
<div class="dropdown-content">
<asp:DropDownList ID="cult" Class="cultr" runat="server" OnSelectedIndexChanged="cult_SelectedIndexChanged" Width="200px" AutoPostBack="True">
<asp:ListItem>Select</asp:ListItem>
<asp:ListItem Value="D">Dance</asp:ListItem>
<asp:ListItem Value="S">Singing</asp:ListItem>
<asp:ListItem Value="o">other</asp:ListItem>
</asp:DropDownList>
</div>
</div>
<div class="dropdown">
<asp:Image ID="sport" runat="server" Height="200px" Width="200px" class="dropbtn" ImageUrl="~/User/assets/Images/Explore/s_banner.jpg" />
<div class="dropdown-content">
<asp:DropDownList ID="sportsD" Class="cultr" runat="server" OnSelectedIndexChanged="sportsD_SelectedIndexChanged" Width="200px" AutoPostBack="True">
<asp:ListItem>Select</asp:ListItem>
<asp:ListItem Value="CR">Cricket</asp:ListItem>
<asp:ListItem Value="C">Chess</asp:ListItem>
<asp:ListItem Value="CRM">Carrom</asp:ListItem>
</asp:DropDownList>
</div>
</div>
<asp:UpdatePanel runat="server" ID="dc">
<contenttemplate>
<asp:Panel runat="server" ID="dan" class="npan" Width="900px" Height="500px">
<h3 style="text-align: center" class="panhed">Please Fill This Form TO Participate(Dance Registration)</h3>
<div id="snam" runat="server" class="nam">
<asp:Label ID="Label1" runat="server" Text="Name of participant:"></asp:Label>
<asp:TextBox ID="TextBox1" CssClass="txtcls" runat="server" TextMode="MultiLine"></asp:TextBox>
<asp:Button ID="addm" class="addbtn" runat="server" autopostback="true" Text="Add member" OnClick="addm_Click" />
</div>
<div id="Div3" runat="server" class="nams">
<asp:Label ID="Label3" runat="server" autopostback="true" Text="Name of 2nd participant:"></asp:Label>
<asp:TextBox ID="TextBox2" CssClass="txtscls" runat="server"></asp:TextBox>
</div>
<div id="Div29" runat="server" class="nams">
<asp:Label ID="Label27" runat="server" Text="Age:"></asp:Label>
<asp:TextBox ID="TextBox22" CssClass="agtxt" placeholder="1st" runat="server"></asp:TextBox><asp:TextBox ID="TextBox24" CssClass="agstxt" placeholder="2nd" AutoPostBack="true" runat="server"></asp:TextBox>
</div>
<div id="Div2" runat="server" class="cate">
<asp:Label ID="Label2" runat="server" Text="Select Category:"></asp:Label>
<asp:DropDownList runat="server" ID="DropDownList1" Class="drpd" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged">
<asp:ListItem Value="22">select</asp:ListItem>
<asp:ListItem Value="Ss">Solo</asp:ListItem>
<asp:ListItem Value="Dd">Duet</asp:ListItem>
<asp:ListItem Value="Gg">Group</asp:ListItem>
</asp:DropDownList>
</div>
<div id="divv" class="mobn" runat="server">
<asp:Label ID="Label5" runat="server" Text="Mobile No:"></asp:Label>
<asp:TextBox ID="TextBox4" CssClass="mobtxt" runat="server"></asp:TextBox>
</div>
<div id="Div6" runat="server" class="eml">
<asp:Label ID="Label6" runat="server" Text="E-Mail:"></asp:Label>
<asp:TextBox ID="TextBox5" CssClass="emtxt" runat="server"></asp:TextBox>
</div>
<div id="Div7" runat="server" class="yer">
<asp:Label ID="Label7" runat="server" Text="Select Year:"></asp:Label>
<asp:DropDownList runat="server" ID="DropDownList2" Class="drpds">
<asp:ListItem>select</asp:ListItem>
<asp:ListItem>First</asp:ListItem>
<asp:ListItem>Second</asp:ListItem>
<asp:ListItem>Third</asp:ListItem>
<asp:ListItem>other</asp:ListItem>
</asp:DropDownList>
</div>
<div id="Div8" runat="server" class="btndiv">
<asp:Button ID="Button1" runat="server" Class="Btncss" Text="Submit" />
</div>
</asp:Panel>
</contenttemplate>
</asp:UpdatePanel>
<asp:Panel ID="singinp" runat="server" class="npan" Width="800px" Height="700px">
<h3 class="panhed">Please Fill This Form TO Participate(Singing Registration)</h3>
<div id="namep" runat="server" class="nam">
<asp:Label ID="name" runat="server" Text="Name of participant:"></asp:Label>
<asp:TextBox ID="txtname" CssClass="txtcls" TextMode="MultiLine" runat="server"></asp:TextBox>
<asp:Button ID="Button6" class="addbtn" runat="server" autopostback="true" Text="Add member" OnClick="Button6_Click" />
</div>
<div id="namesp" runat="server" class="nams" autopostback="true">
<asp:Label ID="scndname" runat="server" autopostback="true" Text="Name of 2nd participant:"></asp:Label>
<asp:TextBox ID="Txtnames" CssClass="txtscls" AutoPostBack="True" runat="server"></asp:TextBox>
</div>
<div id="Div31" runat="server" class="nams">
<asp:Label ID="Label29" runat="server" Text="Age:"></asp:Label>
<asp:TextBox ID="TextBox25" CssClass="agtxt" placeholder="1st" runat="server"></asp:TextBox><asp:TextBox ID="TextBox26" CssClass="agstxt" placeholder="2nd" AutoPostBack="True" runat="server"></asp:TextBox>
</div>
<div id="cat" runat="server" class="cate">
<asp:Label ID="type" runat="server" Text="Select Category:"></asp:Label>
<asp:DropDownList runat="server" ID="dcat" Class="drpd" Style="width: auto;" OnSelectedIndexChanged="dcat_SelectedIndexChanged">
<asp:ListItem>select</asp:ListItem>
<asp:ListItem Value="1">Solo singing</asp:ListItem>
<asp:ListItem Value="2">Duet singing</asp:ListItem>
<asp:ListItem Value="3">Group singing</asp:ListItem>
</asp:DropDownList>
</div>
<div id="clgn" runat="server" class="clgname">
<asp:Label ID="cname" runat="server" Text="Name of College:"></asp:Label>
<asp:TextBox ID="cnamet" CssClass="clgtxt" runat="server"></asp:TextBox>
</div>
<div id="mob" runat="server" class="mobn">
<asp:Label ID="mobi" runat="server" Text="Mobile No:"></asp:Label>
<asp:TextBox ID="Imob" CssClass="mobtxt" runat="server"></asp:TextBox>
</div>
<div id="Email" runat="server" class="eml">
<asp:Label ID="emal" runat="server" Text="E-Mail:"></asp:Label>
<asp:TextBox ID="emao" CssClass="emtxt" runat="server"></asp:TextBox>
</div>
<div id="ydrp" runat="server" class="yer">
<asp:Label ID="yr" runat="server" Text="Select Year:"></asp:Label>
<asp:DropDownList runat="server" ID="yers" Class="drpds">
<asp:ListItem>select</asp:ListItem>
<asp:ListItem>First</asp:ListItem>
<asp:ListItem>Second</asp:ListItem>
<asp:ListItem>Third</asp:ListItem>
<asp:ListItem>other</asp:ListItem>
</asp:DropDownList>
</div>
<div id="submit" runat="server" class="btndiv">
<asp:Button ID="btn" runat="server" Class="Btncss" Text="Submit" />
</div>
</asp:Panel>
<asp:Panel ID="other" runat="server" Class="npan" Width="800px" Height="700px">
<h3 style="text-align: center" class="panhed">Please Fill This Form TO Participate(Other Event Registration)</h3>
<div id="Div1" runat="server" class="nam">
<asp:Label ID="Label8" runat="server" Textmode="MultiLine" Text="Name of participant/s:"></asp:Label>
<asp:TextBox ID="TextBox6" CssClass="txtc" runat="server"></asp:TextBox>
</div>
<div id="Div9" runat="server" class="cate">
<asp:Label ID="Label9" runat="server" Text="Select Category:"></asp:Label>
<asp:DropDownList runat="server" ID="DropDownList3" Class="drpd">
<asp:ListItem>select</asp:ListItem>
<asp:ListItem>Solo </asp:ListItem>
<asp:ListItem>Duet </asp:ListItem>
<asp:ListItem>Group</asp:ListItem>
</asp:DropDownList>
</div>
<div id="Div10" runat="server" class="nams">
<asp:Label ID="Label10" runat="server" Text="Specify Event Name:"></asp:Label>
<asp:TextBox ID="TextBox7" CssClass="txtcs" runat="server" Placeholder="Ex-Drama/Fashion Show"></asp:TextBox>
</div>
<div id="Div11" runat="server" class="clgname">
<asp:Label ID="Label11" runat="server" Text="Name of College:"></asp:Label>
<asp:TextBox ID="TextBox8" CssClass="clgtxt" runat="server"></asp:TextBox>
</div>
<div id="Div12" runat="server" class="mobn">
<asp:Label ID="Label12" runat="server" Text="Mobile No:"></asp:Label>
<asp:TextBox ID="TextBox9" CssClass="mobtxt" runat="server"></asp:TextBox>
</div>
<div id="Div13" runat="server" class="eml">
<asp:Label ID="Label13" runat="server" Text="E-Mail:"></asp:Label>
<asp:TextBox ID="TextBox10" CssClass="emtxt" runat="server"></asp:TextBox>
</div>
<div id="Div14" runat="server" class="yer">
<asp:Label ID="Label14" runat="server" Text="Select Year:"></asp:Label>
<asp:DropDownList runat="server" ID="DropDownList4" Class="drpds">
<asp:ListItem>select</asp:ListItem>
<asp:ListItem>First</asp:ListItem>
<asp:ListItem>Second</asp:ListItem>
<asp:ListItem>Third</asp:ListItem>
<asp:ListItem>other</asp:ListItem>
</asp:DropDownList>
</div>
<div id="Div15" runat="server" class="btndiv">
<asp:Button ID="Button2" runat="server" Class="Btncss" Text="Submit" />
</div>
</asp:Panel>
<asp:Panel ID="chess" runat="server" Class="npan" Width="800px" Height="700px">
<h3 style="text-align: center" class="panhed">Please Fill This Form TO Participate(Chess Registration)</h3>
<div id="Div4" runat="server" class="nam">
<asp:Label ID="Label4" runat="server" Text="Name of participant/s:"></asp:Label>
<asp:TextBox ID="TextBox3" CssClass="txtc" runat="server"></asp:TextBox>
</div>
<div id="Div16" runat="server" class="nams">
<asp:Label ID="Label16" runat="server" Text="Age:"></asp:Label>
<asp:TextBox ID="TextBox11" CssClass="agtxt" runat="server"></asp:TextBox>
</div>
<div id="Div17" runat="server" class="clgname">
<asp:Label ID="Label17" runat="server" Text="Name of College:"></asp:Label>
<asp:TextBox ID="TextBox12" CssClass="clgtxt" runat="server"></asp:TextBox>
</div>
<div id="Div18" runat="server" class="mobn">
<asp:Label ID="Label18" runat="server" Text="Mobile No:"></asp:Label>
<asp:TextBox ID="TextBox13" CssClass="mobtxt" runat="server"></asp:TextBox>
</div>
<div id="Div19" runat="server" class="eml">
<asp:Label ID="Label19" runat="server" Text="E-Mail:"></asp:Label>
<asp:TextBox ID="TextBox14" CssClass="emtxt" runat="server"></asp:TextBox>
</div>
<div id="Div20" runat="server" class="yer">
<asp:Label ID="Label20" runat="server" Text="Select Year:"></asp:Label>
<asp:DropDownList runat="server" ID="DropDownList6" Class="drpds">
<asp:ListItem>select</asp:ListItem>
<asp:ListItem>First</asp:ListItem>
<asp:ListItem>Second</asp:ListItem>
<asp:ListItem>Third</asp:ListItem>
<asp:ListItem>other</asp:ListItem>
</asp:DropDownList>
</div>
<div id="Div21" runat="server" class="btndiv">
<asp:Button ID="Button3" runat="server" Class="Btncss" Text="Submit" />
</div>
</asp:Panel>
<asp:UpdatePanel ID="carup" runat="server">
<ContentTemplate>
<asp:Panel ID="carrom" runat="server" Class="npan" Width="800px" Height="700px">
<h3 style="text-align: center" class="panhed">Please Fill This Form TO Participate(Carrom Registration)</h3>
<div id="Div5" runat="server" class="nam">
<asp:Label ID="Label15" runat="server" Text="Name of participant:"></asp:Label>
<asp:TextBox ID="TextBox15" CssClass="txtcls" runat="server"></asp:TextBox>
<asp:Button ID="Button5" class="addbtn" runat="server" Text="Add member" Autopostback="true" OnClick="Button5_Click" />
</div>
<div id="Div28" runat="server" class="nams">
<asp:Label ID="Label26" runat="server" autopostback="true" Text="Name of 2nd participant:"></asp:Label>
<asp:TextBox ID="TextBox20" CssClass="txtscls" runat="server"></asp:TextBox>
</div>
<div id="Div22" runat="server" class="nams">
<asp:Label ID="Label21" runat="server" autopostback="true" Text="Age:"></asp:Label>
<asp:TextBox ID="TextBox16" CssClass="agtxt" placeholder="1st" runat="server"></asp:TextBox>
<asp:TextBox ID="TextBox21" CssClass="agstxt" placeholder="2nd" AutoPostBack="true" runat="server"></asp:TextBox>
</div>
<div id="Div23" runat="server" class="clgname">
<asp:Label ID="Label22" runat="server" Text="Name of College:"></asp:Label>
<asp:TextBox ID="TextBox17" CssClass="clgtxt" runat="server"></asp:TextBox>
</div>
<div id="Div24" runat="server" class="mobn">
<asp:Label ID="Label23" runat="server" Text="Mobile No:"></asp:Label>
<asp:TextBox ID="TextBox18" CssClass="mobtxt" runat="server"></asp:TextBox>
</div>
<div id="Div25" runat="server" class="eml">
<asp:Label ID="Label24" runat="server" Text="E-Mail:"></asp:Label>
<asp:TextBox ID="TextBox19" CssClass="emtxt" runat="server"></asp:TextBox>
</div>
<div id="Div26" runat="server" class="yer">
<asp:Label ID="Label25" runat="server" Text="Select Year:"></asp:Label>
<asp:DropDownList runat="server" ID="DropDownList5" Class="drpds">
<asp:ListItem>select</asp:ListItem>
<asp:ListItem>First</asp:ListItem>
<asp:ListItem>Second</asp:ListItem>
<asp:ListItem>Third</asp:ListItem>
<asp:ListItem>other</asp:ListItem>
</asp:DropDownList>
</div>
<div id="Div27" runat="server" class="btndiv">
<asp:Button ID="Button4" runat="server" Class="Btncss" Text="Submit" />
</div>
</asp:Panel>
</ContentTemplate>
</asp:UpdatePanel>
<asp:Panel ID="cricket" runat="server" Class="npan" Width="800px" Height="700px">
<h3 style="text-align: center" class="panhed">Please Fill This Form TO Participate(Cricket Registration)</h3>
<div id="Div30" runat="server" class="nam">
<asp:Label ID="Label28" runat="server" Text="Name of participant/s:"></asp:Label>
<asp:TextBox ID="TextBox23" CssClass="txtcr" TextMode="MultiLine" runat="server"></asp:TextBox>
</div>
<div id="Div37" runat="server" class="clgname">
<asp:Label ID="Label34" runat="server" Text="Name of College:"></asp:Label>
<asp:TextBox ID="TextBox28" CssClass="clgtxt" runat="server"></asp:TextBox>
</div>
<div id="Div38" runat="server" class="mobn">
<asp:Label ID="Label35" runat="server" Text="Mobile No:"></asp:Label>
<asp:TextBox ID="TextBox29" CssClass="mobtxt" runat="server"></asp:TextBox>
</div>
<div id="Div39" runat="server" class="eml">
<asp:Label ID="Label36" runat="server" Text="E-Mail:"></asp:Label>
<asp:TextBox ID="TextBox30" CssClass="emtxt" runat="server"></asp:TextBox>
</div>
<div id="Div40" runat="server" class="yer">
<asp:Label ID="Label37" runat="server" Text="Select Year:"></asp:Label>
<asp:DropDownList runat="server" ID="DropDownList8" Class="drpds">
<asp:ListItem>select</asp:ListItem>
<asp:ListItem>First</asp:ListItem>
<asp:ListItem>Second</asp:ListItem>
<asp:ListItem>Third</asp:ListItem>
<asp:ListItem>other</asp:ListItem>
</asp:DropDownList>
</div>
<div id="Div41" runat="server" class="btndiv">
<asp:Button ID="Button7" runat="server" Class="Btncss" Text="Submit" />
</div>
</asp:Panel>
</asp:UpdatePanel>
</ContentTemplate>
my codebehind
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
public partial class User_Default : System.Web.UI.Page
{
SqlConnection con = new SqlConnection(#"Data Source=ADMIN-PC\SQLEXPRESS;Initial Catalog=festopedia;Integrated Security=True");
int FID;
protected void Page_Load(object sender, EventArgs e)
{
showclg();
dan.Visible = false;
other.Visible = false;
singinp.Visible = false;
chess.Visible = false;
cricket.Visible = false;
carrom.Visible = false;
}
public void showclg()
{
if (Request.QueryString["FID"].ToString() == null)
{
Response.Redirect("Explore_Event.aspx");
}
else
{
FID = Convert.ToInt32(Request.QueryString["FID"].ToString());
con.Open();
SqlCommand cmd = con.CreateCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "Select * from FESTDETAILS where FID='" + FID + "'";
cmd.ExecuteNonQuery();
DataTable dt = new DataTable();
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(dt);
festexprepeater.DataSource = dt;
festexprepeater.DataBind();
con.Close();
}
}
public void Showevent()
{
}
protected void singb_Click1(object sender, EventArgs e)
{
singinp.Visible = true;
dan.Visible = false;
}
protected void cult_SelectedIndexChanged(object sender, EventArgs e)
{
if (cult.SelectedValue =="D")
{
dan.Visible = true;
singinp.Visible = false;
other.Visible = false;
}
else if (cult.SelectedValue == "S")
{
singinp.Visible = true;
dan.Visible = false;
other.Visible = false;
}
else
{
other.Visible = true;
singinp.Visible = false;
dan.Visible = false;
chess.Visible = false;
}
}
protected void sportsD_SelectedIndexChanged(object sender, EventArgs e)
{
if (sportsD.SelectedValue == "C")
{
dan.Visible = false;
singinp.Visible = false;
other.Visible = false;
chess.Visible = true;
}
else if (sportsD.SelectedValue == "CRM")
{
carrom.Visible = true;
dan.Visible = false;
singinp.Visible = false;
other.Visible = false;
chess.Visible = false;
}
else if (sportsD.SelectedValue == "CR")
{
cricket.Visible = true;
carrom.Visible = false;
dan.Visible = false;
singinp.Visible = false;
other.Visible = false;
chess.Visible = false;
}
}
protected void addm_Click(object sender, EventArgs e)
{
Div3.Visible = true;
dan.Visible = true;
TextBox24.Visible = true;
}
protected void Button5_Click(object sender, EventArgs e)
{
carrom.Visible = true;
TextBox21.Visible = true;
Div28.Visible = true;
}
protected void Button6_Click(object sender, EventArgs e)
{
carrom.Visible = true;
TextBox26.Visible = true;
namesp.Visible = true;
singinp.Visible = true;
}
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
if (DropDownList1.SelectedValue == "Dd")
{
addm.Visible = true;
}
if (DropDownList1.SelectedValue == "Gg")
{
TextBox1.TextMode = TextBoxMode.MultiLine;
}
}
protected void TextBox1_TextChanged(object sender, EventArgs e)
{
int charRows = 0;
string tbCOntent;
int chars = 0;
tbCOntent = TextBox1.Text;
TextBox1.Columns = 10;
chars = tbCOntent.Length;
charRows = chars / TextBox1.Columns;
int remaining = chars - charRows * TextBox1.Columns;
if (remaining == 0)
{
TextBox1.Rows = charRows;
TextBox1.TextMode = TextBoxMode.MultiLine;
}
else
{
TextBox1.Rows = charRows + 1;
TextBox1.TextMode = TextBoxMode.MultiLine;
}
}
protected void dcat_SelectedIndexChanged(object sender, EventArgs e)
{
if (dcat.SelectedValue == "2")
{
Button6.Visible = true;
}
}
}
when i am clicking on image drop down panel is not getting visible.

page style get disturbed on ModalPopupExtender on click of button in a gridview in Update panel

I have a multiple records in a Grid view inside an update panel, Grid-view has ImageButton , onclick of this button I am displaying a ModalPopupExtender to display details of selected row. Then I close the dialog using close button.
Everything works fine until I open and close the modelpopup 10 times , after that page styles gets disturbed and page start looking ugly. When I remove the update panel then everything works fine but I need update panel for smooth UI experience.
My code is below, please help me as soon as possible , I am stuck because of this. temporarily , I am handling this by dopostback on 10th time so that user doesn't experience refresh everytime.
aspx code.
<asp:UpdatePanel ID="udpDocuments" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div class="Content">
<h1 class="HomePageHeading">Standard Operating Procedures, Guidelines, and Policies</h1>
<div class="ClearFix MarginBottom30">
<div class="SeriesInformation">
<h2>Series</h2>
<ol class="ValueList">
<li>1.000 - <span>Personnel Procedures</span>
</li>
<li>2.000 - <span>Veterinary Care/Laboratory Animal Medicine</span>
</li>
<li>3.000 - <span>Animal Husbandry/Facility Operations</span>
</li>
<li>4.000 - <span>Safety</span>
</li>
<li>5.000 - <span>Technical Procedures</span>
</li>
<li>6.000 - <span>Administration</span>
</li>
</ol>
</div>
<div class="PolicyNumberAbbr">
<h2>SOP/Policy Number Abbreviations</h2>
<ol class="ValueList">
<li>P = <span>Policy</span>
</li>
<li>G = <span>Guidelines</span>
</li>
<li>B = <span>Bethesda</span>
</li>
<li>F = <span>Frederick</span>
</li>
</ol>
</div>
</div>
<asp:Panel ID="SearchCriteria" runat="server" DefaultButton="btnSearch">
<div class="FilterWrap" style="clear: both;">
<fieldset class="FnlFieldSet">
<legend class="Clip">Filter SOP Listings</legend>
<ol class="InputFields">
<li>
<asp:Label Text="Filter by:" runat="server" ID="lblSortOrder" AssociatedControlID="ddlSortCriteria" />
<ol class="HorizontalInput">
<li>
<asp:DropDownList ID="ddlSortCriteria" runat="server" SelectMethod="Load_Filter"
OnSelectedIndexChanged="ddlSortCriteria_SelectedIndexChanged" AutoPostBack="true"
AppendDataBoundItems="true" DataTextField="Value" DataValueField="Key">
</asp:DropDownList>
<asp:DropDownList ID="ddlCampus" Visible="false" runat="server" SelectMethod="Load_Campus" AppendDataBoundItems="true" DataTextField="value" DataValueField="key">
<asp:ListItem Text="[Select]" Value="0" />
</asp:DropDownList>
<asp:DropDownList ID="ddlSeries" Visible="false" runat="server" SelectMethod="Load_Series" AppendDataBoundItems="true" DataTextField="Name" DataValueField="Id">
<asp:ListItem Text="[Select]" Value="0" />
</asp:DropDownList>
<dms:WatermarkTextBox ID="wmTitle" runat="server" MaxLength="60" Columns="30" WatermarkText="Title" />
</li>
<li>
<span class="InputButtonWrapper HasIcon SearchIcon">
<asp:Button ID="btnSearch" Text="Search" OnClick="btnSearch_Click" runat="server" />
</span>
<asp:Button ID="btnReset" Text="Reset" OnClick="btnReset_Click" runat="server" />
</li>
</ol>
</li>
</ol>
</fieldset>
</div>
</asp:Panel>
<dms:GridView ID="gvSOPDetails" runat="server" AllowPaging="true" PageSize="50" AllowSorting="true" DataKeyNames="Id"
AutoGenerateColumns="False" SelectMethod="SopListingGrid_GetItem" Width="100%"
OnRowCommand="gvSOPDetails_RowCommand" OnRowDataBound="gvSOPDetails_RowDataBound"
ItemType="Dms.Css.Ncif.Lasp.SopTraining.Biz.LaspSopTraining.Sop">
<Columns>
<asp:TemplateField HeaderText="SOP/Policy#" SortExpression="Number">
<ItemTemplate>
<asp:Label ID="lblNumber" runat="server" Text='<%# Item.Number %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Title" SortExpression="Title">
<ItemTemplate>
<asp:HyperLink runat="server" ID="lnkDeleteResponderIssueImage" NavigateUrl="<%# Item.MainFileAttachment==null?string.Empty:Item.MainFileAttachment.ResourceUrl %>" CssClass="FileDownloadLink" Target="_blank" Text='<%# Item.Title %>'></asp:HyperLink>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Revision Number" SortExpression="RevisionNumber">
<ItemTemplate>
<asp:Label ID="lblRevisionNumber" runat="server" Text='<%# Item.RevisionNumber %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Revision Date" SortExpression="RevisionDate">
<ItemTemplate>
<%# string.Format("{0:d}", Item.RevisionDate)%>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Effective Date" SortExpression="EffectiveDate">
<ItemTemplate>
<%# string.Format("{0:d}", Item.EffectiveDate)%>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Campus" SortExpression="LocationId">
<ItemTemplate>
<%# Dms.Framework.Extensions.EnumExtensions.Description(Item.LocationId) %>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Attachments" ItemStyle-HorizontalAlign="center">
<ItemTemplate>
<asp:ImageButton ID="imgBtnViewAttachment" runat="server" CommandName="ViewAttachment"
Enabled="true" CommandArgument='<%# Item.Id %>'
Text="Delete" ImageUrl="~/Media/Images/modal-open-icon.png" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
<EmptyDataTemplate>
No records match your search criteria.
</EmptyDataTemplate>
</dms:GridView>
</div>
<div>
<%-- OnCancelScript="__doPostBack('Ok','')" is added to fix the issue when you open the model popup 10 times and on 11th time it mashed up the UI--%>
<asp:Button ID="btnShowModelPopup" runat="server" Text="Button" CssClass="HideModelPopupButton" />
<asp:HiddenField ID="hfSelectedSOP" runat="server" />
<cc1:ModalPopupExtender ID="mpeAttachments" runat="server"
CancelControlID="imgBtnPopupClose"
TargetControlID="btnShowModelPopup" PopupControlID="pnlAttachmentsForSelectedSOP"
PopupDragHandleControlID="PopupHeader" Drag="true"
OnCancelScript="OnCloseButtonClientClick()"
RepositionMode="RepositionOnWindowResizeAndScroll"
BackgroundCssClass="ModalPopupBG">
</cc1:ModalPopupExtender>
<asp:Panel ID="pnlAttachmentsForSelectedSOP" Style="display: none" runat="server">
<div>
<div class="PopupHeader">
<asp:ImageButton ID="imgBtnPopupClose" CssClass="ModalCloseButton" runat="server" ImageUrl="~/Media/Images/modal-close-icon.png" />
</div>
<div class="PopupBody">
<div class="PopupTitle">
<asp:Label ID="lblTitle" runat="server"></asp:Label>
<span>attachments</span>
</div>
<asp:Panel ID="pnlSupportingAttachments" runat="server">
<ul>
<asp:ListView runat="server" ID="lvSupportingAttachments" DataKeyNames="Id" ItemType="Dms.Css.Ncif.Lasp.SopTraining.Biz.LaspSopTraining.Attachment"
SelectMethod="LoadModelPopupAttachment">
<ItemTemplate>
<li>
<span>
<asp:HyperLink runat="server" ID="lnkDeleteResponderIssueImage" NavigateUrl="<%# Item.ResourceUrl %>" CssClass="FileDownloadLink" Target="_blank" Text='<%# Item.FileName %>'></asp:HyperLink>
</span>
</li>
</ItemTemplate>
</asp:ListView>
</ul>
</asp:Panel>
</div>
</div>
</asp:Panel>
</div>
</ContentTemplate>
</asp:UpdatePanel>
<asp:HiddenField ID="closeCount" ClientIDMode="Static" Value="0" runat="server" />
<script type="text/javascript">
var count = 0;
function OnCloseButtonClientClick() {
if (count == 8) {
//__doPostBack('Ok', '');
count = 0;
}
else {
count = count + 1;
}
return false;
}
</script>
protected void gvSOPDetails_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "ViewAttachment")
{
hfSelectedSOP.Value = (string)e.CommandArgument;
mpeAttachments.TargetControlID = "btnShowModelPopup";
lvSupportingAttachments.DataBind();
mpeAttachments.Show();
}
}
Got solution, It is only about moving code around update panel:
ASPX code:
<dms:GridView ID="gvSOPDetails" runat="server" AllowPaging="true" PageSize="50" AllowSorting="true" DataKeyNames="Id"
AutoGenerateColumns="False" SelectMethod="SopListingGrid_GetItem" Width="100%"
OnRowCommand="gvSOPDetails_RowCommand" OnRowDataBound="gvSOPDetails_RowDataBound"
ItemType="Dms.Css.Ncif.Lasp.SopTraining.Biz.LaspSopTraining.Sop">
<Columns>
<asp:TemplateField HeaderText="SOP/Policy#" SortExpression="Number">
<ItemTemplate>
<asp:Label ID="lblNumber" runat="server" Text='<%# Item.Number %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Attachments" ItemStyle-HorizontalAlign="center">
<ItemTemplate>
<asp:ImageButton ID="imgBtnViewAttachment" runat="server" CommandName="ViewAttachment"
Enabled="true" CommandArgument='<%# Item.Id %>'
Text="Delete" ImageUrl="~/Media/Images/modal-open-icon.png" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
<EmptyDataTemplate>
No records match your search criteria.
</EmptyDataTemplate>
</dms:GridView>
</div>
</ContentTemplate>
</asp:UpdatePanel>
<asp:Panel ID="pnlAttachmentsForSelectedSOP" Style="display: none" runat="server">
<div>
<div class="PopupHeader">
<asp:ImageButton ID="imgBtnPopupClose" CssClass="ModalCloseButton" runat="server" ImageUrl="~/Media/Images/modal-close-icon.png" />
</div>
<div class="PopupBody">
<div class="PopupTitle">
<asp:Label ID="lblTitle" runat="server"></asp:Label>
<span>attachments</span>
</div>
<asp:UpdatePanel ID="upAttachmentList" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Panel ID="pnlSupportingAttachments" runat="server">
<ul>
<asp:ListView runat="server" ID="lvSupportingAttachments" DataKeyNames="Id" ItemType="Dms.Css.Ncif.Lasp.SopTraining.Biz.LaspSopTraining.Attachment"
SelectMethod="LoadModelPopupAttachment">
<ItemTemplate>
<li>
<span>
<asp:HyperLink runat="server" ID="lnkDeleteResponderIssueImage" NavigateUrl="<%# Item.ResourceUrl %>" CssClass="FileDownloadLink" Target="_blank" Text='<%# Item.FileName %>'></asp:HyperLink>
</span>
</li>
</ItemTemplate>
</asp:ListView>
</ul>
</asp:Panel>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
</asp:Panel>
<asp:Button ID="btnShowModelPopup" runat="server" Text="Button" CssClass="HideModelPopupButton" />
<asp:HiddenField ID="hfSelectedSOP" runat="server" />
<cc1:ModalPopupExtender ID="mpeAttachments" runat="server"
CancelControlID="imgBtnPopupClose"
TargetControlID="btnShowModelPopup" PopupControlID="pnlAttachmentsForSelectedSOP"
PopupDragHandleControlID="PopupHeader" Drag="true"
RepositionMode="RepositionOnWindowResizeAndScroll"
BackgroundCssClass="ModalPopupBG">
</cc1:ModalPopupExtender>
ASPX.cs: code:
protected void gvSOPDetails_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "ViewAttachment")
{
hfSelectedSOP.Value = (string)e.CommandArgument;
mpeAttachments.TargetControlID = "btnShowModelPopup";
lvSupportingAttachments.DataBind();
upAttachmentList.Update();
mpeAttachments.Show();
}
}

how to dynamically assign id to controls - controls are inside datalist in asp .net

I am using datalist for showing datas. Datas are test questions with 4 options.I have 50 questions displaying in datalist.
By using ItemDataBound event - i am making visible only one question with 4 options to user. Remaining questions are invisible . In the Itemdatabound event - i am assigning id to the radio buttons. but also id is not assigned to the datalist ,it showing different id.
<div class="widget">
<div class="widget-header" align="center" style="background: #4a98c9; color: #FFFFFF;">
<h4>
<asp:Label ID="Label5" runat="server" Text="Question : "></asp:Label>
<asp:Label ID="lblQuestionNo" runat="server" Text="0 of 0"></asp:Label></h4>
<asp:HiddenField ID="HdCurrentQuestSlNo" runat="server" />
<asp:HiddenField ID="HdfMinTime" runat="server" />
<asp:HiddenField ID="HdfSecTime" runat="server" />
<asp:HiddenField ID="HiddenField1" runat="server" />
<asp:HiddenField ID="HdfQSlNo" runat="server" />
<asp:HiddenField ID="HdQuestCount" runat="server" Value="0"/>
</div>
<div class="widget-content">
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Panel ID="PanelQuestBlock" runat="server" ScrollBars="Vertical" Width="100%" Height="325px">
<asp:DataList runat="server" ID="DataListQuestion"
onitemdatabound="DataListQuestion_ItemDataBound"
onitemcreated="DataListQuestion_ItemCreated">
<ItemTemplate>
<div class="questdisplayId" id="divQuestBlock" runat="server">
<div>
<asp:HiddenField ID='HdSlNo' runat="server" Value='<%# Eval("SlNo") %>' ClientIDMode="Static"/>
<asp:HiddenField ID="HdUserQuestId" runat="server" Value='<%# Eval("UserQuestionId") %>' ClientIDMode="Static"/>
<asp:HiddenField ID="HdTotalOptions" runat="server" Value='<%# Eval("TotalOptions") %>' ClientIDMode="Static"/>
<asp:HiddenField ID="HdQuestAnsweredTimeSecs" runat="server" Value='<%# Eval("AnsweredTimeSecs") %>' ClientIDMode="Static"/>
<asp:HiddenField ID="HdOptionAnswered" runat="server" Value='<%# Eval("OptionAnswered") %>' ClientIDMode="Static"/>
</div>
<div>
<asp:Label ID="Question" runat="server" Text='<%# Eval("Question") %>'></asp:Label>
</div>
<div class="answer-row" id="divOption1" runat="server">
<asp:RadioButton ID="Option1" runat="server" GroupName="Answer" value="1" Text='<%# Eval("Option1") %>'
CssClass="rdbtn" Style="vertical-align: middle" ClientIDMode="Static"/>
<asp:Label ID="lblOpt1" runat="server" Text=""></asp:Label>
</div>
<div class="answer-row" id="divOption2" runat="server">
<asp:RadioButton ID="Option2" runat="server" GroupName="Answer" value="2" Text='<%# Eval("Option2") %>'
CssClass="rdbtn" Style="vertical-align: middle" ClientIDMode="Static"/>
<asp:Label ID="lblOpt2" runat="server" Text=""></asp:Label>
</div>
<div class="answer-row" id="divOption3" runat="server">
<asp:RadioButton ID="Option3" runat="server" GroupName="Answer" value="3" Text='<%# Eval("Option3") %>'
CssClass="rdbtn" Style="vertical-align: top; left: auto;" ClientIDMode="Static"/>
<asp:Label ID="lblOpt3" runat="server" Text=""></asp:Label>
</div>
<div class="answer-row" id="divOption4" runat="server">
<asp:RadioButton ID="Option4" runat="server" GroupName="Answer" value="4" Text='<%# Eval("Option4") %>'
CssClass="rdbtn" Style="vertical-align: text-top" ClientIDMode="Static"/>
<asp:Label ID="lblOpt4" runat="server" Text=""></asp:Label>
</div>
<div class="answer-row" id="divOption5" runat="server">
<asp:RadioButton ID="Option5" runat="server" GroupName="Answer" value="4" Text='<%# Eval("Option5") %>'
CssClass="rdbtn" Style="vertical-align: text-top" ClientIDMode="Static"/>
<asp:Label ID="lblOpt5" runat="server" Text=""></asp:Label>
</div>
</div>
</ItemTemplate>
</asp:DataList>
</asp:Panel>
<asp:UpdatePanel ID="UpdatePanel3" runat="server">
<ContentTemplate>
<div class="row">
<div class="span8" align="center">
<asp:Button ID="btnClear" runat="server" Text="Clear Selection"
CssClass="btn btn-warning" OnClientClick="Clearbutton();"
/>
<asp:Button ID="btnSave" runat="server" Text="Save & Next" CssClass="btn btn-success" OnClientClick="Savebutton()"/>
</div>
<div class="span4" align="center">
<asp:Button ID="btnReview" runat="server" Text="Mark Review & Next" CssClass="btn btn-info" OnClientClick="Reviewbutton()"/>
<asp:Button ID="btnFinish" runat="server" Text="Finish" CssClass="btn btn-danger" OnClientClick="Finishbutton()"/>
</div>
</div>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnReview" />
<asp:AsyncPostBackTrigger ControlID="btnClear" />
<asp:AsyncPostBackTrigger ControlID="btnSave" />
</Triggers>
</asp:UpdatePanel>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="DataListQuestion" />
</Triggers>
</asp:UpdatePanel>
</div>
</div>
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
HiddenField HdSlNo = (HiddenField)e.Item.FindControl("HdSlNo");
RadioButton Option1 = (RadioButton)e.Item.FindControl("Option1");
RadioButton Option2 = (RadioButton)e.Item.FindControl("Option2");
RadioButton Option3 = (RadioButton)e.Item.FindControl("Option3");
RadioButton Option4 = (RadioButton)e.Item.FindControl("Option4");
RadioButton Option5 = (RadioButton)e.Item.FindControl("Option5");
Option1.ID = "rdbtnoption1_" + HdSlNo.Value.ToString();
Option2.ID = "rdbtnoption2_" + HdSlNo.Value.ToString();
Option3.ID = "rdbtnoption3_" + HdSlNo.Value.ToString();
Option4.ID = "rdbtnoption4_" + HdSlNo.Value.ToString();
Option5.ID = "rdbtnoption5_" + HdSlNo.Value.ToString();
}
In my design page code , using Datalist i am binding 50 questions . while binding itself i am hiding 2 to 50 questions . Question 1 only visible. I tried to give dynamic id for every questions and options using event databound and rowcreated. First it got error , after that i changed properties as ClientIDMode="Static" for controls.it shown different id. But if i click any button event again it clear the id's.again it shows old ids only.

Resources