collapsiblepanel collapse in code not collapsing - asp.net

I have a panel that i have extended with collapsible extender. It is working perfectly until i try to collapse it by code.
The collapsible panel is shown inside a modal popup where user searches for some data, that is
shown in a grid , In every row of grid there is a select button that fires the row command event of the grid on which i am trying to close the panel.
Markup:
<asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server" TargetControlID="btnAdd"
PopupControlID="pnlpopup" CancelControlID="Cancel" BackgroundCssClass="modalBackground">
</asp:ModalPopupExtender>
<asp:Panel ID="pnlpopup" runat="server" BackColor="White" Height="320px" Width="530px"
Style="display: none">
<table width="100%" style="border: Solid 3px #D55500; height: 100%" cellpadding="0"
cellspacing="0">
<tr>
<td>
Bridge ID :
<asp:TextBox ID="txtID" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="rfvID" runat="server" ControlToValidate="txtID" ValidationGroup="vldAddBridge"
ErrorMessage="Please enter ID" ForeColor="Red"></asp:RequiredFieldValidator>
</td>
<td>
Bridge Name :
<asp:TextBox ID="txtBridgeName" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="rfvBridgeName" runat="server" ControlToValidate="txtBridgeName"
ValidationGroup="vldAddBridge" ErrorMessage="Please enter bridge name." ForeColor="Red"></asp:RequiredFieldValidator>
</td>
</tr>
<td colspan="2" style="text-align: right; margin-left: 40px;">
<asp:Button ID="btnSearchUser" runat="server" OnClick="btnSearchUser_Click" TabIndex="5"
Text="Search" ValidationGroup="vgSearchMember" />
</td>
</tr>
<tr>
<td colspan="5" style="background-color: White" class="style6">
<asp:Label ID="lblSearchResults" runat="server"></asp:Label>
<asp:GridView ID="gvSearchResults" runat="server" AllowPaging="True" AutoGenerateColumns="False"
BackColor="White" BorderWidth="1px" CellPadding="4" CssClass="gridviewBorder"
DataKeyNames="EmpId" ForeColor="Black" GridLines="Horizontal" PageSize="5" RowStyle-CssClass="style5"
TabIndex="7" Width="100%" OnPageIndexChanging="gvSearchResults_PageIndexChanging"
OnRowCommand="gvSearchResults_RowCommand">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:LinkButton ID="lnkSelect" runat="server" Text="Select" CommandName="Select"
CommandArgument='<%# Eval("EmpId") %>'></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="EmpId" HeaderText="Employee ID" />
<asp:BoundField DataField="Alias" HeaderText="Username" />
<asp:BoundField DataField="FirstName" HeaderText="First Name" />
<asp:BoundField DataField="LastName" HeaderText="Last Name" />
</Columns>
</asp:GridView>
<br />
</td>
</tr>
</table>
</asp:Panel>
<asp:CollapsiblePanelExtender ID="CollapsiblePanelExtender1" runat="server" CollapseControlID="btnOwner"
ExpandControlID="btnOwner" TargetControlID="PnlRegister" Collapsed="true">
</asp:CollapsiblePanelExtender>
</td>
</tr>
<tr>
<td align="center" colspan="2">
<br />
<asp:Button ID="btnSaveBridge" runat="server" Text="Save" OnClick="btnSaveBridge_Click"
ValidationGroup="vldAddBridge" />
<asp:Button ID="btnCancel" runat="server" Text="Cancel" OnClick="btnCancel_Click" />
<span style="display: none">
<input type="button" id="Cancel" /></span>
</td>
</tr>
</table>
</asp:Panel>
Code:
protected void gvSearchResults_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "Select")
{
//some business logic
CollapsiblePanelExtender1.Collapsed = true;
ModalPopupExtender1.Show();
}
}
It is not working the panel is always open ?? Any suggestions.....

You are missing
tr in your design. Please check it
Markup:
<asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server" TargetControlID="btnAdd"
PopupControlID="pnlpopup" CancelControlID="Cancel" BackgroundCssClass="modalBackground">
</asp:ModalPopupExtender>
<asp:Panel ID="pnlpopup" runat="server" BackColor="White" Height="320px" Width="530px"
Style="display: none">
<table width="100%" style="border: Solid 3px #D55500; height: 100%" cellpadding="0"
cellspacing="0">
<tr>
<td>
Bridge ID :
<asp:TextBox ID="txtID" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="rfvID" runat="server" ControlToValidate="txtID" ValidationGroup="vldAddBridge"
ErrorMessage="Please enter ID" ForeColor="Red"></asp:RequiredFieldValidator>
</td>
<td>
Bridge Name :
<asp:TextBox ID="txtBridgeName" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="rfvBridgeName" runat="server" ControlToValidate="txtBridgeName"
ValidationGroup="vldAddBridge" ErrorMessage="Please enter bridge name." ForeColor="Red"></asp:RequiredFieldValidator>
</td>
</tr>
**<tr> //This is missing**
<td colspan="2" style="text-align: right; margin-left: 40px;">
<asp:Button ID="btnSearchUser" runat="server" OnClick="btnSearchUser_Click" TabIndex="5"
Text="Search" ValidationGroup="vgSearchMember" />
</td>
</tr>
<tr>
<td colspan="5" style="background-color: White" class="style6">
<asp:Label ID="lblSearchResults" runat="server"></asp:Label>
<asp:GridView ID="gvSearchResults" runat="server" AllowPaging="True" AutoGenerateColumns="False"
BackColor="White" BorderWidth="1px" CellPadding="4" CssClass="gridviewBorder"
DataKeyNames="EmpId" ForeColor="Black" GridLines="Horizontal" PageSize="5" RowStyle-CssClass="style5"
TabIndex="7" Width="100%" OnPageIndexChanging="gvSearchResults_PageIndexChanging"
OnRowCommand="gvSearchResults_RowCommand">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:LinkButton ID="lnkSelect" runat="server" Text="Select" CommandName="Select"
CommandArgument='<%# Eval("EmpId") %>'></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="EmpId" HeaderText="Employee ID" />
<asp:BoundField DataField="Alias" HeaderText="Username" />
<asp:BoundField DataField="FirstName" HeaderText="First Name" />
<asp:BoundField DataField="LastName" HeaderText="Last Name" />
</Columns>
</asp:GridView>
<br />
</td>
</tr>
</table>
</asp:Panel>
<asp:CollapsiblePanelExtender ID="CollapsiblePanelExtender1" runat="server" CollapseControlID="btnOwner"
ExpandControlID="btnOwner" TargetControlID="PnlRegister" Collapsed="true">
</asp:CollapsiblePanelExtender>
</td>
</tr>
<tr>
<td align="center" colspan="2">
<br />
<asp:Button ID="btnSaveBridge" runat="server" Text="Save" OnClick="btnSaveBridge_Click"
ValidationGroup="vldAddBridge" />
<asp:Button ID="btnCancel" runat="server" Text="Cancel" OnClick="btnCancel_Click" />
<span style="display: none">
<input type="button" id="Cancel" /></span>
</td>
</tr>
</table>
</asp:Panel>
Hope it solve your problem

Related

Update Panel, Update Progress and DropDown List

<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true">
<Services>
<asp:ServiceReference Path="Machine.asmx" />
</asp:ScriptManager>
<div align="center" style="width:auto" >
<asp:UpdatePanel ID="up1" runat="server" Visible="true" UpdateMode="Conditional">
<ContentTemplate>
<table class="nav-justified" border="1" id="table1">
<tr>
<td>
<asp:Label ID="Label2" runat="server" Text="Select Search Criteria"></asp:Label>
</td>
<td>
<asp:DropDownList ID="ddlSearchCriteria" runat="server" AutoPostBack="true" EnableViewState="true" OnSelectedIndexChanged="ddlSearchCriteria_SelectedIndexChanged" Height="30px" Width="200px">
<asp:ListItem Value="0">Select</asp:ListItem>
<asp:ListItem Value="1">All</asp:ListItem>
<asp:ListItem Value="2">Data Center</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<tr id="trDC" runat="server" visible="false"> <td>
<asp:Label ID="lblRegion" runat="server" Text="Select DataCenter"></asp:Label>
</td>
<td>
<asp:DropDownList ID="ddlDC" runat="server" AutoPostBack="false" EnableViewState="true" OnSelectedIndexChanged="ddlDC_SelectedIndexChanged" Height="30px" Width="200px">
<asp:ListItem Value="0">Select</asp:ListItem>
<asp:ListItem Value="1">a </asp:ListItem>
</asp:DropDownList></td>
</tr>
<tr id="tr1" runat="server" visible="false" >
<td>
<asp:Label ID="lblOrder" runat="server" Text="Order For SOEID"></asp:Label>
</td>
<td >
<asp:TextBox ID="txtOrderFor" runat="server" Height="20px" Width="200px"></asp:TextBox>
</td>
</tr>
<tr>
<td>
</td>
<td>
<asp:Button ID="btnSearch" runat="server" Text="Search" OnClick="btnSearch_Click" />
<asp:Button ID="btnCancel" runat="server" Text="Cancel" OnClick="btnCancel_Click" />
</td>
</tr>
</table>
</div>
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="up1" DisplayAfter="0" DynamicLayout="false">
<ProgressTemplate>
<div style="position:absolute; left:45%;">
<div style="position:relative; left:45%;">
<table border="0" align="center">
<tr>
<td>
<img alt=""src="img/loading.gif" height="50px" width="50px" />
</td>
</tr>
</table>
<center>
Please wait...
</center>
</div>
</ProgressTemplate>
</asp:UpdateProgress>
</div>
<asp:UpdatePanel ID="up2" runat="server">
<ContentTemplate>
<asp:Label ID="lblRows" runat="server" Font-Size="Large" Visible="false" ></asp:Label>
<asp:GridView ID="gvDetails" runat="server" AllowPaging="True" AutoGenerateColumns="False" CellPadding="3" CssClass="bootstrap dataTables_wrapper" DataKeyNames="Order_Item_Id” EnableViewState="false" HeaderStyle-HorizontalAlign="Left" OnPageIndexChanging="gvDetails_PageIndexChanging" OnRowCommand="gvDetails_RowCommand" OnRowDataBound="gvDetails_RowDataBound" PageSize="15" ShowHeaderWhenEmpty="true" Visible="true" Width="100%">
<Columns>
<asp:TemplateField HeaderStyle-HorizontalAlign="Left" HeaderText="Select">
<ItemTemplate>
<asp:CheckBox ID="chkBox1" runat="server" AutoPostBack="true" OnCheckedChanged="Check_Clicked"/>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="Order_Item_Id" HeaderStyle-HorizontalAlign="Left" HeaderText="Order Id" />
</Columns>
</asp:GridView>
</div>
<asp:Button ID="Button4" runat="server" Font-Bold="True" Font-Size="XX-Large" OnClick="Button4_Click" Text="Export To Excel" visible="false" />
<asp:Button ID="Button3" runat="server" Font-Bold="True" Font-Size="XX-Large" OnClick="Button3_Click" Text="Submit" Visible="false" />
<asp:Button ID="Button1" runat="server" Font-Bold="True" Font-Size="XX-Large" OnClick="Button1_Click" Text="Cancel" Visible="false" />
</div>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="Button4" />
<asp:PostBackTrigger ControlID="Button3" />
<asp:PostBackTrigger ControlID="Button1" />
</Triggers>
</asp:UpdatePanel>
I have two update panel and 1 update progress on my aspx page. My first update panel contains two dropdown, on change of first dropdown, second populates and also there is a submit button in the update panel.
When I use selectedindexchange of dropdown, Autopostback occurs, update progress works but I don't want it to work on that event. It should work only on the submit click.
Second update panel contains the data to be shown on click of submit button.
Also,My update progress is not in any of the update panel, it is in a div between both the update panel.

trigger async callback from a radio button inside gridview

I have a gridview in which one of the column contains radio button. which i have placed inside item template. I want to trigger async callback to a panel in which i have a grid. this complete page is a user control.
When i am unable to add the trigger
<asp:GridView ID="grdBalStatus" runat="server" AutoGenerateColumns="false" Width="100%">
<HeaderStyle CssClass="dlresultheader" />
<RowStyle CssClass="griditems" />
<Columns>
<asp:BoundField DataField="TerminalId" HeaderStyle-Width="35%" />
<asp:BoundField DataField="Description"></asp:BoundField>
<asp:TemplateField HeaderStyle-Width="65%" HeaderText="Auto/Full Balancing Status">
<HeaderTemplate>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="right" style="width: 32%">
<%--<asp:Label ID="lblSelAll" runat="server" CssClass="autoresultheader" Text="All:"></asp:Label>--%>
</td>
<td align="left" style="width: 60%">
<asp:RadioButton ID="rdAllAuto" runat="server" CssClass="autoresultheader" GroupName="AutoorFull1"
Text="Auto" ToolTip="Select auto balancing for all Self-Checkouts" />
<asp:RadioButton ID="rdAllFull" runat="server" CssClass="autoresultheader" GroupName="AutoorFull1"
Text="Full" ToolTip="Select full balancing for all Self-Checkouts" />
</td>
<td style="width: 8%">
</td>
</tr>
</table>
</HeaderTemplate>
<ItemTemplate>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="right" style="width: 32%">
<asp:Label runat="server" ID="TermId" Text='<%# Eval("TerminalId") %>' CssClass="hide"></asp:Label>
</td>
<td align="left" style="width: 60%">
<asp:RadioButton ID="rdAuto" runat="server" CssClass="fullgriditems" GroupName="AutoorFull"
Text="Auto" />
<asp:RadioButton ID="rdFull" runat="server" CssClass="fullgriditems" GroupName="AutoorFull"
AutoPostBack="true" OnCheckedChanged="rdFull_CheckedChanged" Text="Full" />
</td>
<td style="width: 8%">
<%--<asp:Label runat="server" ID="Version" Text='<%# Eval("TerminalVersion") %>' CssClass="hide"></asp:Label> --%>
</td>
</tr>
</table>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="TerminalVersion"></asp:BoundField>
</Columns>
</asp:GridView>
Code in the update panel
<asp:UpdatePanel ID="upFullBalTerm" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="false">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="rdFull" EventName="CheckedChanged" />
</Triggers>
<ContentTemplate>
<table width="100%">
<tr id="trFullBalTl" class="hide" runat="server">
<td style="padding-top: 5px;" id="tdFullBalTerminal">
<asp:GridView runat="server" ID="grdFullBalTerminal" AutoGenerateColumns="false" Width="80%" BorderStyle="None" ShowHeader="true">
<HeaderStyle CssClass="dlresultheader" Width="15%" Height="30" />
<RowStyle CssClass="griditems" VerticalAlign="Bottom" />
<EmptyDataTemplate></EmptyDataTemplate>
<Columns>
<asp:TemplateField HeaderText="Terminal Id">
<HeaderStyle Width="12%" BorderStyle="None" />
<ItemStyle BorderStyle="none" CssClass="dlresultheader" />
<ItemTemplate>
<asp:Label runat="server" ID="lblFullBalTlId" Text='<%# Eval("terminal") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>
Please suggest how to write the trigger.
I used a hidden button which is the trigger for the update panel. On click event of the radio button i called button click event using javascript.

Dropdown List issue in ASP Panel control

I am using asp Panel control in which I have a dropdown list for different Timezones to select.
However, When I select any timezone It disappears when I open the pop up next time.
Can you please suggest or provide some pointers ?
<asp:PlaceHolder ID="DisplayMode" runat="server">
<div id="ListBranch" style="text-align: left">
<asp:Button ID="AddBranch" runat="server" Text="Add Branch" OnClick="AddBranch_Click" />
<act:ModalPopupExtender ID="ModalPopupExtenderBranch" runat="server" TargetControlID="AddBranch" PopupControlID="pnlAddBranch"
CancelControlID="btnCancel" BackgroundCssClass="modalBackground">
</act:ModalPopupExtender>
<act:ToolkitScriptManager ID="smBranch" runat="server">
</act:ToolkitScriptManager>
<div>
<br />
<asp:GridView runat="server" ID="gvBranchList" DataKeyNames="BranchID" AutoGenerateColumns="false" Font-Size="Small">
<RowStyle BackColor="#EFF3FB" />
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
<HeaderStyle BackColor="#336699" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="White" />
<Columns>
<asp:BoundField DataField="Branch Name" HeaderText="Branch Name" />
<asp:BoundField DataField="Timezone" HeaderText="Timezone" />
<asp:TemplateField HeaderText="Edit">
<ItemTemplate>
<asp:Button ID="Edit" runat="server" Text="Edit" OnClick="Edit_Click" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<br />
<asp:Label ID="lblresult" runat="server" />
<asp:Button ID="btnShowPopup" runat="server" Style="display: none" />
<asp:Button ID="UpdateBranch" CommandName="Update" runat="server" Text="Ok" OnClick="Ok_Click" Style="display: none" />
<asp:Panel ID="pnlAddBranch" runat="server" BackColor="White" Height="80%" Width="100%" Font-Size="Small" Style="top: 40px !important;">
<table style="border: solid 2px #336699; width: 100%; height: 100%; font-size: small;" cellpadding="0" cellspacing="0">
<tr style="background-color: #336699">
<td colspan="2" style="height: 5%; color: White; font-weight: bold; font-size: larger" align="center">Branch Details</td>
</tr>
<tr>
<td align="left">Branch Name: </td>
<td>
<asp:TextBox ID="BranchName" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td align="left">Timezone: </td>
<td>
<asp:DropDownList ID="ddlTimezones" AutoPostBack="false" OnSelectedIndexChanged="ddlTimezones_SelectedIndexChanged" runat="server" />
</td>
</tr>
<tr>
<td align="left">Assigned Holidays: </td>
<td>
<asp:CheckBoxList ID="chkAssignedHolidays" runat="server" RepeatColumns="3" Font-Size="Small" />
</td>
</tr>
<tr>
<td></td>
<td>
<asp:Button ID="Ok" CommandName="Add" runat="server" Text="Ok" OnClick="Ok_Click" />
<asp:Button ID="Cancel" Commandname="Cancel" runat="server" Text="Cancel" OnClick="Cancel_Click" />
</td>
</tr>
<tr>
<td colspan="2">
<asp:Label ID="lblBranchID" runat="server" Style="display: none"></asp:Label>
</td>
</tr>
</table>
</asp:Panel>
</div>
</div>
</asp:PlaceHolder>

Required Field Validators disappear in an update panel

I have an Update Panel which contains a GridView. 3 TextBoxes and a DropDownList control are Validated. I also have 3 different DDLs and 3 Checkbox controls in the panel that each trigger a rebind of the Gridview. When one of the un-validated DDLs or Checkboxes is changed they all fire the same changed event and I lose all of the Validation on the TextBoxes and the 1 DDL.
I'm a bit confused as to whether I should be setting Initial values on the validated or un-validated controls, if I should "group" the validation, and which set of controls needs to have the CausesValidation flag set. I hate to spam with massive amounts of code, but considering how much there is in this update panel....
<asp:UpdatePanel ID="UpdatePanel_Search" runat="server" >
<ContentTemplate>
<table class="auto-style2">
<tr>
<td>
<table class="auto-style1">
<tr>
<td class="auto-style3">
<div>
<table class="auto-style1" border="1px" frame="void">
<tr>
<td bgcolor="#00198D" style="text-align: center" class="auto-style19">
<asp:Label ID="FilterLabel3" runat="server" ForeColor="White" Text="Used by OEM"></asp:Label>
</td>
<td bgcolor="#00198D" style="text-align: center" class="auto-style9">
<asp:Label ID="FilterLabel4" runat="server" ForeColor="White" Text="Item Type"></asp:Label>
</td>
<td bgcolor="#00198D" style="text-align: center" class="auto-style24">
<asp:Label ID="FilterLabel5" runat="server" ForeColor="White" Text="Group Type"></asp:Label>
</td>
<td bgcolor="#00198D" style="text-align: center" class="auto-style12">
<asp:Label ID="FilterLabel6" runat="server" ForeColor="White" Text="Part Active"></asp:Label>
</td>
<td bgcolor="#00198D" style="text-align: center" class="auto-style17">
<asp:Label ID="FilterLabel7" runat="server" ForeColor="White" Text="Non-Inventory Part"></asp:Label>
</td>
<td bgcolor="#00198D" style="text-align: center" class="auto-style7">
<asp:Label ID="FilterLabel8" runat="server" ForeColor="White" Text="Part In Stock"></asp:Label>
</td>
</tr>
<tr>
<td class="auto-style19">
<asp:DropDownList ID="DDL_OEM" runat="server" Height="27px" Width="150px" AutoPostBack="True" AppendDataBoundItems="True" OnSelectedIndexChanged="Filter_DataSet" ></asp:DropDownList>
</td>
<td class="auto-style9">
<asp:DropDownList ID="DDL_ItemTypes" runat="server" Height="27px" Width="150px" AutoPostBack="True" AppendDataBoundItems="True" OnSelectedIndexChanged="Filter_DataSet" ></asp:DropDownList>
</td>
<td class="auto-style9">
<asp:DropDownList ID="DDL_GroupTypes" runat="server" Height="27px" Width="150px" AutoPostBack="True" AppendDataBoundItems="True" OnSelectedIndexChanged="Filter_DataSet" ></asp:DropDownList>
</td>
<td class="auto-style12">
<asp:CheckBox ID="CheckBox1" runat="server" AutoPostBack="True" OnCheckedChanged="Filter_DataSet" Checked="True" Style="text-align: center" />
</td>
<td class="auto-style17">
<asp:CheckBox ID="CheckBox2" runat="server" AutoPostBack="True" OnCheckedChanged="Filter_DataSet" Style="text-align: center" />
</td>
<td class="auto-style7">
<asp:CheckBox ID="CheckBox3" runat="server" AutoPostBack="True" OnCheckedChanged="Filter_DataSet" Style="text-align: center" />
</td>
</tr>
</table>
<div>
<asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server"
ControlToValidate="TextBox_Ticket_Search"
ErrorMessage="Ticket Number is Required. Enter NOTICKET if the item you are requesting is for your tech stock(i.e. a tool, USB drive, etc.)"
ForeColor="Red">
</asp:RequiredFieldValidator>
</div>
<div>
<asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server"
ControlToValidate="TextBox_Part_Search"
ErrorMessage="Part Number is Required. Select a Part from the Catalog before submitting a request."
ForeColor="Red">
</asp:RequiredFieldValidator>
</div>
<div>
<asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server"
ControlToValidate="TextBox_Serial_Search"
ErrorMessage="System Serial Number is Required. Enter NOSERIAL if the item you are requesting is for your tech stock(i.e. a tool, USB drive, etc.)"
ForeColor="Red">
</asp:RequiredFieldValidator>
</div>
<div>
<asp:RequiredFieldValidator ID="RequiredFieldValidator11" runat="server"
ControlToValidate="DDL_OEM_submit0"
ErrorMessage="System Model is a required field. Please select a Model from the Drop Down below."
InitialValue="0"
ForeColor="Red">
</asp:RequiredFieldValidator>
</div>
</td>
</tr>
<table class="auto-style1">
<tr>
<td class="auto-style34">
<table class="auto-style1">
<tr>
<td>
<asp:Label ID="Label_Comments_Search" runat="server" Text="Comments:"></asp:Label>
</td>
</tr>
<tr>
<td style="text-align: left">
<asp:TextBox runat="server"
ID="TextBox_Comments_Search"
TextMode="multiline"
TextWrapping="Wrap"
AcceptsReturn="True"
VerticalScrollBarVisibility="Visible" Height="100px" Width="300px">
</asp:TextBox>
</td>
</tr>
</table>
</td>
<td class="auto-style29">
<table class="auto-style1">
<tr>
<td class="auto-style4">
<asp:Label ID="Label_Ticket_Search" runat="server" Text="Ticket #:"></asp:Label>
</td>
<td class="auto-style32">
<asp:TextBox ID="TextBox_Ticket_Search" runat="server"></asp:TextBox>
<span class="auto-style23">*</span></td>
</td>
</tr>
<tr>
<td style="text-align: right">
<asp:Label ID="Label_Part_Search" runat="server" Text="Part #:"></asp:Label>
</td>
<td class="auto-style32">
<asp:TextBox ID="TextBox_Part_Search" runat="server" ReadOnly="true" BackColor="#CCCCCC"></asp:TextBox>
<span class="auto-style23">*</span>
</td>
</tr>
<tr>
<td style="text-align: right" class="auto-style21">
<asp:Label ID="Label12" runat="server" Text="Serial #:"></asp:Label></td>
<td class="auto-style32">
<asp:TextBox ID="TextBox_Serial_Search" runat="server"></asp:TextBox>
<span class="auto-style23">*</span></td>
</tr>
<tr>
<td style="text-align: right" class="auto-style21">
<asp:Label ID="Label_Damage_Search" runat="server" Text="Part Damaged:"></asp:Label>
</td>
<td style="text-align: left" class="auto-style31">
<asp:CheckBox ID="CheckBox_Damage_Search" runat="server"></asp:CheckBox>
</td>
</tr>
</table>
</td>
<td>
<table class="auto-style25">
<tr>
<td>
<table class="auto-style25">
<tr>
<td>
<asp:Label ID="Label15" runat="server" Style="text-align: left" Text="Model:"></asp:Label>
</td>
<td align="left">
<asp:DropDownList ID="DDL_OEM_submit0" runat="server">
</asp:DropDownList>
<span class="auto-style23">*</span>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<asp:Button ID="Button2" runat="server" Text="Submit Part Request" OnClick="Button2_Click" />
</td>
</tr>
</table>
</td>
<table class="auto-style1">
<tr>
<td>
<table class="auto-style1">
<tr>
<td class="auto-style8" valign="top">
<asp:GridView ID="GridView1"
runat="server"
AutoGenerateColumns="False"
DataKeyNames="ID"
DataSourceID="SqlDataSource1"
EnableModelValidation="True"
AllowSorting="True"
OnSelectedIndexChanged="Gridview1_SelectedIndexChanged"
AutoGenerateSelectButton="True"
BackColor="White"
BorderColor="#999999"
BorderStyle="None"
BorderWidth="1px"
CellPadding="3"
GridLines="Vertical" HorizontalAlign="Justify">
<FooterStyle BackColor="#CCCCCC" ForeColor="Black" />
<HeaderStyle BackColor="#00198D" ForeColor="White" />
<PagerStyle ForeColor="Black" BackColor="#999999" HorizontalAlign="Center" />
<AlternatingRowStyle BackColor="#DCDCDC" />
<EmptyDataTemplate>
No records could be retrieved from the database. We apologize for the inconvenience.
</EmptyDataTemplate>
<Columns>
<asp:BoundField DataField="ID" HeaderText="ID" InsertVisible="False" ReadOnly="True" SortExpression="ID" />
<asp:BoundField DataField="OEMPartCode" HeaderText="OEMPartCode" SortExpression="OEMPartCode" />
<asp:BoundField DataField="OEM" HeaderText="OEM" InsertVisible="False" ReadOnly="True" SortExpression="OEM" />
<asp:BoundField DataField="Sub Categories" HeaderText="Models" InsertVisible="False" ReadOnly="True" SortExpression="Sub Categories" />
</Columns>
<RowStyle BackColor="#EEEEEE" ForeColor="Black" />
<SelectedRowStyle BackColor="Red" Font-Bold="True" ForeColor="White" />
</asp:GridView>
</td>
<td style="text-align: left" valign="top">
<asp:DetailsView
ID="DetailsView1"
runat="server"
DataSourceID="SqlDataSource2"
Height="50px"
Width="556px"
CellPadding="4"
AutoGenerateRows="False"
OnDataBound="DetailsView1_OnDataBound"
ForeColor="White"
EnableModelValidation="True"
DataKeyNames="ID"
HorizontalAlign="Left"
Style="margin-right: 0px">
<FieldHeaderStyle BackColor="#00198D" Font-Bold="True" ForeColor="White" />
<Fields>
<asp:BoundField DataField="ID" HeaderText="ID" />
<asp:BoundField DataField="OEMPartCode" HeaderText="OEMPartCode" />
<asp:BoundField DataField="PartCode2" HeaderText="PartCode2" />
<asp:TemplateField HeaderText="UsedByOEM">
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("UsedByOEM") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="ItemType">
<ItemTemplate>
<asp:Label ID="Label2" runat="server" Text='<%# Bind("JoinedItemType") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="GroupType">
<ItemTemplate>
<asp:Label ID="Label3" runat="server" Text='<%# Bind("JoinedGroupType") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="PartDesc" HeaderText="PartDescription" SortExpression="PartDesc" />
<asp:BoundField DataField="PartComment" HeaderText="PartComment" SortExpression="PartComment" />
<asp:BoundField DataField="PartCount" HeaderText="PartCount" SortExpression="PartCount" />
<asp:BoundField DataField="PartMin" HeaderText="PartMin" SortExpression="PartMin" />
<asp:CheckBoxField DataField="PartActive" HeaderText="PartActive" SortExpression="PartActive" />
<asp:BoundField DataField="MFRPartNumber" HeaderText="MFRPartNumber" SortExpression="MFRPartNumber" />
<asp:BoundField DataField="PartCapacity" HeaderText="PartCapacity" SortExpression="PartCapacity" />
<asp:CheckBoxField DataField="PreTurnRequired" HeaderText="PreTurnRequired" SortExpression="PreTurnRequired" />
<asp:TemplateField HeaderText="AssemblyPart">
<ItemTemplate>
<asp:Label ID="Label_AssemblyPart" runat="server" Text='<%# Bind("AssemblyPart") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Part Image">
<ItemTemplate>
<a href="javascript:void(window.open('<%# "ShowImage.aspx?PID="+ Eval("PartImage")%>','_blank','toolbar=no,menubar=no'))">
<asp:Image ID="FullImage" ToolTip="Click to download the full size image."
runat="server" ImageUrl='<%# "ShowThumb.aspx?size=120&PID="+ Eval("PartImage") %>' /></a>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Part Image 2">
<ItemTemplate>
<a href="javascript:void(window.open('<%# "ShowImage.aspx?PID="+ Eval("PartImage2")%>','_blank','toolbar=no,menubar=no'))">
<asp:Image ID="Image1" ToolTip="Click to download the full size image."
runat="server" ImageUrl='<%# "ShowThumb.aspx?size=120&PID="+ Eval("PartImage2") %>' /></a>
</ItemTemplate>
</asp:TemplateField>
<asp:CheckBoxField DataField="NonInventoryPart" HeaderText="NonInventoryPart" SortExpression="NonInventoryPart" />
<asp:TemplateField HeaderText="Updated By">
<ItemTemplate>
<asp:Label ID="UserNameLabel" runat="server" Text='<%# Bind("CreatedByUser") %>' ReadOnly="True"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Last Modified">
<ItemTemplate>
<asp:Label ID="ModifiedDateLabel" runat="server" Text='<%# Bind("LastModifiedDate") %>' ReadOnly="True"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Fields>
<FooterStyle BackColor="#00198D" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#00198D" Font-Bold="True" ForeColor="White" />
<RowStyle BackColor="White" ForeColor="Black" Width="300px" />
</asp:DetailsView>
</td>
</tr>
</table>
</td>
</tr>
</table>
</table>
</td>
</tr>
</table>
</table>
</td>
</tr>
</table>
</table>
</td>
</tr>
</table>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
DataSourceMode="DataSet"
SelectCommand="SELECT Stuff">
<FilterParameters>
<asp:ControlParameter Name="UsedByOEM" ControlID="DDL_OEM" PropertyName="SelectedValue" />
<asp:ControlParameter Name="ItemType" ControlID="DDL_ItemTypes" PropertyName="SelectedValue" />
<asp:ControlParameter Name="GroupType" ControlID="DDL_GroupTypes" PropertyName="SelectedValue" />
</FilterParameters>
</asp:SqlDataSource>
<a></a>
<asp:SqlDataSource ID="SqlDataSource2" runat="server"
ConflictDetection="CompareAllValues"
SelectCommand="SELECT Stuff">
<SelectParameters>
<asp:ControlParameter ControlID="GridView1" Name="ID" PropertyName="SelectedValue" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
</ContentTemplate>
</asp:UpdatePanel>
Did you try giving the controls a group name?

trouble in getting dynamic id`s for datepicker

i want to generate a dynamic id of my datepicker. below jquery function shows the datetimepicker as the id is defined as static.
$(function () {
var dates = $("#ContentPlaceHolder1_gvdLCStatus_txtInvoiceDate_0").datepicker(
{
dateFormat: 'dd/mm/yy',
defaultDate: '+1w',
changeMonth: false,
numberOfMonths: 1,
showOn: 'both',
buttonImage: 'Images/calendar_month.png',
buttonImageOnly: true,
onSelect: function (selectedDate) {
var option = this.id == "ContentPlaceHolder1_gvdLCStatus_txtInvoiceDate_0" ? "minDate" : "maxDate",
instance = $(this).data("datepicker");
date = $.datepicker.parseDate(
instance.settings.dateFormat ||
$.datepicker._defaults.dateFormat,
selectedDate, instance.settings);
dates.not(this).datepicker("option", option, date);
}
});
});
I want to generate a dynamic ID for the DatePicker. and How that ive tried various time but couldnt find the actual way of doing.Thanks.
<asp:GridView ID="gvdLCStatus" runat="server" DataKeyNames="LCID" AutoGenerateColumns="false"
AllowPaging="True" PageSize="4" EmptyDataText="No Record Found" CssClass="mGrid"
OnPageIndexChanging="gvdLCStatus_PageIndexChanging" OnRowCommand="gvdLCStatus_RowCommand"
OnSelectedIndexChanged="gvdLCStatus_SelectedIndexChanged" OnRowDataBound="gvdLCStatus_RowDataBound"
OnRowCreated="gvdLCStatus_RowCreated">
<AlternatingRowStyle CssClass="test" />
<Columns>
<asp:TemplateField HeaderText="LC Number">
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Eval("LCID") %>' Visible="false"></asp:Label>
<a href="#" onclick="linkbtnTest('<%# "#"+Eval("LCNumber") %>')">
<%# Eval("LCNumber") %></a>
<%-- <div id='<%# Eval("ShipmentID") %>' style="display: none;">
</div>--%>
<div id='<%# Eval("LCNumber") %>' style="display: none;">
<asp:GridView ID="gvShipmentStatus" runat="server" AutoGenerateColumns="false" DataKeyNames="ShipmentID"
OnRowCommand="gvShipmentStatus_RowCommand" OnRowDataBound="gvShipmentStatus_RowDataBound"
CssClass="mGrid">
<Columns>
<asp:BoundField DataField="InvoiceNumber" HeaderText="Invoice Number" />
<asp:BoundField DataField="InvoiceDate" HeaderText="Invoice Date" />
<asp:BoundField DataField="BLNumber" HeaderText="B/L Number" />
<asp:BoundField DataField="BLDate" HeaderText="B/L Date" />
<asp:BoundField DataField="VesselName" HeaderText="Vessel Name" />
<asp:BoundField DataField="VoyageNumber" HeaderText="Voyage Number" />
<asp:BoundField DataField="DueDate" HeaderText="Due Date" />
<asp:BoundField DataField="ContractedShipmentSchedule" HeaderText="Shipment Schedule" />
<asp:TemplateField HeaderText="Delete">
<ItemTemplate>
<asp:ImageButton ID="ImgShipmentDelete" runat="server" ImageUrl='<%# isDelete_img(Session["isAdmin"].ToString()) %>'
Enabled='<%# isDelete(Session["isAdmin"].ToString()) %>' CommandName="DeleteShipmentRecord"
CommandArgument='<%# Eval("ShipmentID") %>' AlternateText="DeleteShipmentRecord"
OnClientClick="return confirm_delete();" Style='<%# delete_style(Session["isAdmin"].ToString()) %>' />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Edit">
<ItemTemplate>
<%-- <asp:ImageButton ID="ImgShipmentEdit" runat="server" ImageUrl="~/Images/edit.png"
CommandName="EditShipmentRecord" ImageAlign="Middle" CommandArgument='<%# Eval("ShipmentID") %>'
AlternateText="EditShipmentRecord" OnClientClick='linkbtnTest(<%# Eval("ShipmentID) %>)' />
--%>
<asp:LinkButton ID="LinkButton1" runat="server" CommandName="EditShipmentRecord"
CommandArgument='<%# Eval("ShipmentID")+":"+Eval("LCStatusID")%>'>
<%--<asp:Label ID="Label2" runat="server" Text='<%# Eval("ShipmentID") %>' Visible="true"></asp:Label>--%> <img src="Images/edit.png" alt="Edit" />
</asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</div>
<%--</div>--%>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="ContractNumber" HeaderText="Contract Number" />
<asp:BoundField DataField="Amount" HeaderText="Amount" />
<asp:BoundField DataField="Qty" HeaderText="Quantity" />
<asp:TemplateField>
<ItemTemplate>
Add Shipment Status
<div id='<%# Eval("LCID") %>' style="display: none;">
<table>
<tr>
<td class="td_records" style="padding-top: 5px;">
Invoice Number
</td>
<td class="td_records" style="padding-top: 5px;">
Invoice Date (dd/mm/yyyy)
</td>
<td class="td_records" style="padding-top: 5px;">
B/L Number
</td>
<td class="td_records" style="padding-top: 5px;">
B/L Date (dd/mm/yyyy)
</td>
</tr>
<tr>
<td>
<asp:TextBox ID="txtInvoiceNumber" runat="server"></asp:TextBox>
</td>
<td>
<asp:TextBox ID="txtInvoiceDate" runat="server"></asp:TextBox>
</td>
<td>
<asp:TextBox ID="txtBLNumber" runat="server"></asp:TextBox>
</td>
<td>
<asp:TextBox ID="txtBLDate" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="td_records" style="padding-top: 5px;">
VesselName
</td>
<td class="td_records" style="padding-top: 5px;">
VoyageNumber
</td>
<td class="td_records" style="padding-top: 5px;">
DueDate (dd/mm/yyyy)
</td>
<td class="td_records" style="padding-top: 5px;">
ShipmntSchedule (dd/mm/yyyy)
</td>
</tr>
<tr>
<td>
<asp:TextBox ID="txtVesselName" runat="server"></asp:TextBox>
</td>
<td>
<asp:TextBox ID="txtVoyageNumber" runat="server"></asp:TextBox>
</td>
<td>
<asp:TextBox ID="txtDueDate" runat="server"></asp:TextBox>
</td>
<td>
<asp:TextBox ID="txtShipmntSchedule" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td style="padding-top: 10px;">
<asp:Button ID="btnSubmitShipment" runat="server" Text="Submit" CommandName="Select"
OnCommand="btnSubmitShipment_Command" CssClass="btnSubmitCSS" />
<asp:Button ID="btnResetShipmentRecord" runat="server" Text="Reset" CssClass="btnSubmitCSS" />
</td>
</tr>
</table>
</div>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:ImageButton ID="imgDelete" runat="server" ImageUrl='<%# isDelete_img(Session["isAdmin"].ToString()) %>'
Enabled='<%# isDelete(Session["isAdmin"].ToString()) %>' CommandName="DeleteRecord"
CommandArgument='<%# Eval("LCID") %>' AlternateText="DeleteRecord" OnClientClick="return confirm_delete();"
Style='<%# delete_style(Session["isAdmin"].ToString()) %>' />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:ImageButton ID="imgEdit" runat="server" ImageUrl="~/Images/edit.png" CommandName="EditRecord"
CommandArgument='<%# Eval("LCID") %>' AlternateText="EditRecord" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
<PagerStyle CssClass="pgr" />
</asp:GridView>
As an option you may use such selector:
var dates = $("[id*='txtInvoiceDate']", "#<%= gvdLCStatus.ClientID %>")​
But better consider to set CssClass property on textboxes and use class selector
Why do you select by id? Why don't you go with class name? $('.datebox').dateTimepicker(...
i found an alternate of validating it with asp.net required field validators. No other option was there and had to maintain the time constraint.
Thanks Guys.

Resources