how to populate Textbox on Calendar selection changed - c#

<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<div style="text-align:center">
<asp:Calendar ID="myCal" runat="server" Height="600px" width="900px"
BorderColor="#F2F3F4" BorderWidth="3px" DayStyle-BorderWidth="1px"
TodayDayStyle-BackColor="#82CAFF" NextPrevFormat="ShortMonth"
SelectionMode="Day" DayHeaderStyle-Height="30px"
TitleStyle-BackColor="#CBE3F0" TitleStyle-ForeColor="#153E7E"
OtherMonthDayStyle-ForeColor="#B4CFEC" NextPrevStyle-ForeColor="#2554C7"
CssClass="mGrid" onselectionchanged="myCal_SelectionChanged">
<DayHeaderStyle Height="30px" /><TitleStyle Height="50px" />
<DayStyle BorderWidth="1px" HorizontalAlign="Left" VerticalAlign="Top" />
<TodayDayStyle BackColor="#CBE3F0" />
</asp:Calendar>
</div>
<asp:Panel ID="pnlSelect" runat="server" width="200px" Height="200px" >
<table border="0" cellspacing="6" cellpadding="0" style="background-color:white">
<tr>
<td align="right"></td>
<td>
<h2>New Appointment</h2>
</td>
</tr>
<tr>
<td align="right">Start Date:</td>
<td><asp:TextBox ID="TextBoxStart" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td align="right">End Date:</td>
<td><asp:TextBox ID="TextBoxEnd" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td align="right">Name:</td>
<td><asp:TextBox ID="TextBoxName" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td align="right"></td>
<td>
<asp:Button ID="ButtonOK" runat="server" OnClick="ButtonOK_Click" Text="OK" />
<asp:Button ID="ButtonCancel" runat="server" Text="Cancel" OnClick="ButtonCancel_Click" />
</td>
</tr>
</table>
</asp:Panel>
<asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server" TargetControlID="myCal" PopupControlID="pnlSelect"
OkControlID="ButtonOK" CancelControlID="ButtonCancel" Drag="True">
</asp:ModalPopupExtender>
I want to populate the current date in the Popup however the myCal_SelectionChanged event is not firing
How do i achieve this
Please help

your code is worked fine for me .create a new testpage and try again using same code
if it works then.. may be you have a problem in your page designer.cs

Related

How to control button from panel

I am new to ASP.NET. I have taken a Panel. Inside the Panel, I have taken a table. Inside the table there are TextBox, RadioButton and a Button controls.
I have written some code in button_click event.
But nothing happens. button_click event is not firing.
What to do now ?
I have also some other things in panel. But no click event is working.
Code is below:
<asp:Panel ID="Pnlproducts" runat="server" ScrollBars="Auto" Height="500px" BorderColor="Black" BorderStyle="Inset" BorderWidth="1px">
<asp:DataList ID="DLProducts" runat="server" RepeatColumns="3" Width="600px" OnSelectedIndexChanged="DLProducts_SelectedIndexChanged">
<ItemTemplate >
<table align="left" class="auto-style6" style="border-color:#9900FF;border-left:1px;border-right:1px;border-top:1px;">
<tr>
<td style="border-color: #000000; border-width: 1px; border-bottom-style: ridge" class="auto-style8">
<asp:Label ID="lblProductName" runat="server" Text="<%# Bind('ProductName') %>" Font-Bold="True"></asp:Label>
</td>
</tr>
<tr>
<td class="auto-style9">
<asp:Image ID="Image2" runat="server" Height="160px" ImageUrl="<%# Bind('ProductImage') %>" Width="173px" Style="border:ridge 1px black" />
</td>
</tr>
<tr>
<td class="auto-style9"><strong>Price:</strong><asp:Label ID="lblPrice" runat="server" Text="<%# Bind('ProductPrice') %>" Font-Bold="True" ForeColor="Red"></asp:Label>
</td>
</tr>
<tr>
<td class="auto-style9">
<asp:Button ID="Addtocartbtn" runat="server" BorderStyle="Solid" BorderWidth="1px" OnClick="Addtocartbtn_Click" Text="Add to Cart" Width="170px" BorderColor="Black" />
</td>
</tr>
</table>
</ItemTemplate>
</asp:DataList>
</asp:Panel>
<asp:Panel ID="Panel111" runat="server" ScrollBars="Auto" Height="500px" BorderColor="Black" BorderStyle="Inset" BorderWidth="1px">
<table class="auto-style16">
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
</table>
</asp:Panel>
</td>
<td>
<asp:Panel ID="pnlCatagory" runat="server" Height="500px" ScrollBars="Auto" BorderColor="Black" BorderStyle="Inset" BorderWidth="1px">
<div class="auto-style7">
<asp:DataList ID="dlCatagory" runat="server" BackColor="White" BorderColor="#CCCCCC" BorderWidth="1px" CellPadding="4" ForeColor="Black" GridLines="Horizontal">
<FooterStyle BackColor="#CCCC99" ForeColor="Black" />
<HeaderStyle BackColor="#333333" Font-Bold="True" ForeColor="White" />
<ItemTemplate>
<asp:LinkButton ID="LBTNCatagoty" runat="server" CommandArgument="<%# Bind('CatagoryID') %>" Font-Bold="True" OnClick="LBTNCatagoty_Click" Text="<%# Bind('CatagoryName') %>"></asp:LinkButton>
</ItemTemplate>
</asp:DataList>
</div>
</asp:Panel>
<asp:Panel ID="Panel222" runat="server" Height="500px" ScrollBars="Auto" BorderColor="Black" BorderStyle="Inset" BorderWidth="1px">
<table class="auto-style10">
<tr>
<td class="auto-style7" colspan="2"><strong>Please Type Your Details</strong></td>
</tr>
<tr>
<td class="auto-style12"></td>
<td class="auto-style11"></td>
</tr>
<tr>
<td class="auto-style15">Name :</td>
<td class="johnykbd8">
<asp:TextBox ID="TextBoxUserName" runat="server" Width="180px"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style15">E-mail :</td>
<td class="johnykbd8">
<asp:TextBox ID="TextBoxEmail" runat="server" Width="180px"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style15">Address:</td>
<td class="johnykbd8">
<asp:TextBox ID="TextBoxAdress" runat="server" Height="90px" TextMode="MultiLine" Width="180px"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style15">Gender :</td>
<td>
<asp:RadioButton ID="RadioButton1" runat="server" GroupName="GenderGroup" Text="Male" /><br />
<asp:RadioButton ID="RadioButton2" runat="server" GroupName="GenderGroup" Text="Female" />
</td>
</tr>
<tr>
<td class="auto-style15">Mobile:</td>
<td class="johnykbd8">
<asp:TextBox ID="TextBoxMobileNum" runat="server" Width="180px"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style15">Photo :</td>
<td class="johnykbd8">
<asp:FileUpload ID="FileUploaduserphoto" runat="server" Width="180px" />
</td>
</tr>
<tr>
<td class="auto-style15">Payment :</td>
<td>
<asp:RadioButton ID="RadioButton3" runat="server" GroupName="Paymentgroup" Text="Visa" /><br />
<asp:RadioButton ID="RadioButton4" runat="server" GroupName="Paymentgroup" Text="MasterCard" /><br />
<asp:RadioButton ID="RadioButton5" runat="server" GroupName="Paymentgroup" Text="Cash On Delivery" />
</td>
</tr>
<tr>
<td class="auto-style15">Review :</td>
<td>
<asp:TextBox ID="TextBoxreview" runat="server" Width="180px"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style15">Total : </td>
<td>BDT :<asp:Label ID="Labelshopamount" runat="server"></asp:Label></td>
</tr>
<tr>
<td colspan="2">
<asp:ImageButton ID="ImageButtonOrderNow" runat="server" ImageUrl="~/Images/Designing/order.jpg" OnClick="ImageButtonOrderNow_Click" Width="250px" />
</td>
</tr>
</table>
</asp:Panel>
If the button is in a datalist or gridview for example, set the CommandName property. The databound object (datalist, gridview) has ItemCommand-event. Put the code in this event.
Pseudo code:
if (e.CommandName.equals(your_command_name)){ label1.text = e.CommandArgument };

In grid view i cannot access the control id's from <EmptyDataTemplate> in its .ascx.cs file

wcJobShuffling.ascx
//This is an existing code in which a panel navigation contains a grid view.In its ascx.cs the intellisense is not showing the control id's from EmptyDataTemplate.
<asp:Panel ID="navigationJobs" runat="server">
<table width="98%" cellpadding="0" cellspacing="0" align="center">
<tr>
<td valign="middle" colspan="5" class="tab_not_sltd">
<table cellpadding="0" cellspacing="1" style="width: 100%;">
<tr>
<td style="width: 100%">
<table cellpadding="0" cellspacing="1" style="width: 100%;">
<tr>
<td class="print_row" style="height: 3px">
<a class="blue_nor_lnk" href="#"></a>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr width="98%" align="center">
<td align="left" valign="middle" width="9%" nowrap>
<asp:ImageButton ID="imgFirstPage" runat="server" align="absmiddle" border="0" SkinID="imgButtonFirst"
OnClick="imgFirstPage_Click" ToolTip="First" CausesValidation="false" />
<asp:ImageButton ID="imgPrevPage" runat="server" align="absmiddle" border="0" SkinID="imgButtonPrev"
OnClick="imgPrevPage_Click" ToolTip="Previous" CausesValidation="false" />
<span class="blue_normal">
<asp:Label ID="lblSPage" runat="server" CssClass=" blue_normal" align="absmiddle"
Width="12px"></asp:Label>
<asp:Label ID="lblto" runat="server" Text="of" CssClass="blue_normal" align="absmiddle"
Width="12px"></asp:Label>
<asp:Label ID="lblEPage" runat="server" CssClass="blue_normal" align="absmiddle"
Width="12px"></asp:Label>
<asp:Label ID="lblof" runat="server" Text="of" CssClass="blue_normal" align="absmiddle"
Visible="false"></asp:Label>
<asp:Label ID="lblTotalRecords" runat="server" CssClass=" blue_normal" align="absmiddle"></asp:Label>
</span>
<asp:ImageButton ID="imgNextPage" runat="server" align="absmiddle" border="0" SkinID="imgButtonNext"
OnClick="imgNextPage_Click" ToolTip="Next" CausesValidation="false" />
<asp:ImageButton ID="imgLastPage" runat="server" align="absmiddle" border="0" SkinID="imgButtonLast"
OnClick="imgLastPage_Click" ToolTip="Last" CausesValidation="false" />
</td>
<td align="left" valign="middle" width="7%" nowrap>
<asp:Label ID="spangoto" runat="server" Text="Go to Page: " CssClass="black_normal"></asp:Label>
<span class="blue_bold">
<asp:DropDownList ID="ddlgoto" runat="server" AutoPostBack="true" CssClass="black_normal"
OnSelectedIndexChanged="ddlgoto_SelectedIndexChanged" Width="40px">
</asp:DropDownList>
</span>
</td>
<td align="left" valign="middle" width="25%" nowrap>
<asp:Label ID="spanRpg" runat="server" Text=" Records Per Page: " CssClass="black_normal"></asp:Label>
<span class="blue_bold">
<asp:DropDownList ID="ddlRows" runat="server" AutoPostBack="true" CssClass="black_normal"
OnSelectedIndexChanged="ddlRows_SelectedIndexChanged" Width="40px">
<asp:ListItem Value="5">5</asp:ListItem>
<asp:ListItem Value="10" Selected="True">10</asp:ListItem>
<asp:ListItem Value="20">20</asp:ListItem>
<asp:ListItem Value="50">50</asp:ListItem>
</asp:DropDownList>
</span>
<asp:Label ID="lblRecords" runat="server" Text="Records found:" CssClass="black_normal"></asp:Label>
<asp:Label ID="lblTotalRecordsFound" runat="server" CssClass="black_bold"></asp:Label>
</td>
<td align="left" valign="middle" style="height: 17px; width: 10%" nowrap>
<asp:HiddenField ID="txtPageNum" runat="server" />
<asp:HiddenField ID="txtTotalpages" runat="server" />
<asp:Label ID="lblpg" CssClass="black_normal" runat="server"
Text="Page" Visible="false"></asp:Label><asp:Label ID="TotalPages" runat="server" Visible="false"></asp:Label><asp:Label ID="lblStatus" runat="server" CssClass="red_lnk"></asp:Label></td>
<td align="right" style="width: 18%">
</td>
</tr>
<tr height="5px" ><td></td></tr>
<tr align="left" style="padding-top: 3px" valign="middle">
<td colspan="5" style="width: 98%" align="left">
<div id="Gridview" width="100%">
<asp:HiddenField ID="hidColor" runat="server" />
<asp:GridView ID="gvJobShuffling" runat="server" AllowPaging="true" AutoGenerateColumns="false"
CellPadding="0" CellSpacing="1" CssClass="grid_bg" GridLines="None" OnRowDataBound="gvJobShuffling_RowDataBound"
OnSelectedIndexChanging="gvJobShuffling_SelectedIndexChanging" PagerStyle-Width="0px"
PageSize="10" ShowFooter="false" Width="100%" OnRowCancelingEdit="gvJobShuffling_RowCancelingEdit"
OnRowEditing="gvJobShuffling_RowEditing" OnRowUpdating="gvJobShuffling_RowUpdating">
<RowStyle CssClass="row_even" />
<PagerStyle CssClass="hide" />
<SelectedRowStyle CssClass="tble_hdr_not_sltd" />
<HeaderStyle CssClass="tble_hdr_not_sltd" />
<EmptyDataRowStyle CssClass="row_odd" HorizontalAlign="Center" />
<FooterStyle CssClass="hide" />
//From Here i am unable to access the control Id's ie...Imtellisense is not showing.
<EmptyDataTemplate>
<table class="confirmation">
<tr>
<td>
<asp:Label Text="Records not found" ID="lblEmpty" runat="server"></asp:Label>
</td>
</tr>
</table>
</EmptyDataTemplate>
<RowStyle CssClass="row_even" />
<AlternatingRowStyle CssClass="row_odd" />
<Columns>
<asp:TemplateField >
<HeaderTemplate>
Form ID
`` </HeaderTemplate>
<ItemTemplate>
<asp:Label ID="lblBranchID" runat="server" Text='<%# Bind("BranchID")%>'></asp:Label>
<asp:Label ID="lblProcessID" runat="server" Text='<%# Bind("ProcessID")%>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:Label ID="lblBranchID" runat="server" Text='<%# Bind("BranchID")%>'></asp:Label>
<asp:Label ID="lblProcessID" runat="server" Text='<%# Bind("ProcessID")%>'></asp:Label>
</EditItemTemplate>
<ItemStyle Width="0%" />
<HeaderStyle />
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td style="display: none" valign="middle">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td align="left" width="125px">
<a>Bill Number</a>
</td>
<td style="width: 6px">
</td>
</tr>
</table>
</td>
<td id="Img1dsc" align="right" valign="middle">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td align="left" width="125px">
<a>Bill Number</a>
</td>
<td style="width: 6px">
</td>
</tr>
</table>
</td>
</tr>
</table>
</HeaderTemplate>
<ItemTemplate>
<table width="100%">
<tr>
<td>
<asp:Label ID="lblJobNumber" runat="server" Text='<%# Bind("JobNumber") %>'></asp:Label>
</td>
</tr>
</table>
</ItemTemplate>
<ItemStyle Width="10%" />
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td id="Img3asc" align="right" style="display: none" valign="middle">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td align="left" width="70%">
<a>Assign To</a>
</td>
<td style="width: 6px">
</td>
</tr>
</table>
</td>
<td id="Img3dsc" align="right" valign="middle">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td align="left" width="70%">
<a>Assign To</a>
</td>
<td style="width: 6px">
</td>
</tr>
</table>
</td>
</tr>
</table>
</HeaderTemplate>
<ItemTemplate>
<table width="100%">
<tr>
<td>
<%# Eval("AssignedToUserName")%>
</td>
</tr>
</table>
</ItemTemplate>
<ItemStyle Width="10%" />
//Actually in this EditItemTemplate i need to bind the ddlAssignTo.DataSource but this control property is not visible in intellinsense in wcJobsShuffling.ascx.cs
<EditItemTemplate>
<table cellpadding="0" cellspacing="0" border="0" style="padding-left: 3px">
<tr>
<td align="left" valign="middle">
<asp:DropDownList ID="ddlAssignTo" runat="server" OnSelectedIndexChanged="ddlAssignTo_SelectionIndexChanged">
</asp:DropDownList>
</td>
<td align="left" valign="middle" visible="false">
<asp:Label ID="lblSupervisorID" runat="server" Text='<%# Bind("AssignedToUserSupervisorUserID") %>' Visible="false"></asp:Label>
<asp:Label ID="lblJobId" runat="server" Text='<%# Bind("JobID") %>' Visible="false"></asp:Label>
<asp:Label ID="lblAssignedToUserName" runat="server" Text='<%# Bind("AssignedToUserName") %>'
Visible="false"></asp:Label>
</td>
</tr>
</table>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField ItemStyle-Width="5%">
<HeaderTemplate>
<table cellpadding="0" cellspacing="0">
<tr>
<td align="right" valign="middle" width="20%">
</td>
</tr>
</table>
</HeaderTemplate>
<ItemTemplate>
<table cellpadding="0" cellspacing="0" border="0" style="padding-left: 3px">
<tr>
<td align="right" height="19px" valign="middle">
<asp:ImageButton SkinID="imgButtonEdit" runat="server" ID="imgEdit" ImageAlign="AbsMiddle"
CommandName="Edit" ToolTip="Edit" CausesValidation="false" />
</td>
</tr>
</table>
</ItemTemplate>
<EditItemTemplate>
<table cellpadding="0" cellspacing="0">
<tr>
<td align="right" valign="middle" nowrap>
<asp:ImageButton SkinID="imgButtonUpdate" runat="server" ID="imgUpdate" ImageAlign="AbsMiddle"
CommandName="Update" ValidationGroup="GSave" ToolTip="Update" CausesValidation="false" />
<asp:ImageButton SkinID="imgButtonCancel" runat="server" ID="imgGCancel" ImageAlign="AbsMiddle"
CommandName="Cancel" ToolTip="Cancel" CausesValidation="false" />
</td>
</tr>
</table>
</EditItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</div>
</td>
</tr>
<tr>
<td align="left" valign="middle" width="9%" style="padding-top: 5px">
<asp:ImageButton ID="imgFirstPage1" runat="server" align="absmiddle" border="0" SkinID="imgButtonFirst"
OnClick="imgFirstPage_Click" ToolTip="First" CausesValidation="false" />
<asp:ImageButton ID="imgPrevPage1" runat="server" align="absmiddle" border="0" SkinID="imgButtonPrev"
OnClick="imgPrevPage_Click" ToolTip="Previous" CausesValidation="false" />
<span class="blue_normal">
<asp:Label ID="lblpg1" runat="server" CssClass="blue_normal" align="absmiddle"></asp:Label>
<asp:Label ID="lblSPage1" runat="server" CssClass=" blue_normal" Width="12px" align="absmiddle"></asp:Label>
<asp:Label ID="lblto1" runat="server" Text="of" CssClass="blue_normal" Width="12px"
align="absmiddle"></asp:Label>
<asp:Label ID="lblEPage1" runat="server" CssClass="blue_normal" Width="12px" align="absmiddle"></asp:Label>
<asp:Label ID="lblOf1" runat="server" Text="of" CssClass="blue_normal" Visible="false"
align="absmiddle"></asp:Label>
<asp:Label ID="lblTotPages" runat="server" CssClass=" blue_normal" align="absmiddle"></asp:Label>
</span>
<asp:ImageButton ID="imgNextPage1" runat="server" align="absmiddle" border="0" SkinID="imgButtonNext"
OnClick="imgNextPage_Click" ToolTip="Next" CausesValidation="false" />
<asp:ImageButton ID="imgLastPage1" runat="server" align="absmiddle" border="0" SkinID="imgButtonNext"
OnClick="imgLastPage_Click" ToolTip="Last" CausesValidation="false" />
<asp:HiddenField ID="hidSort" runat="server" />
<asp:HiddenField ID="hidImageSort1" runat="server" />
<asp:HiddenField ID="hidImageSort2" runat="server" />
</td>
</tr>
</table>
</asp:Panel>

Displaying data from two database tables on one page using Dynamic Data

Hi can anyone help me with this. I am using dynamic data and have created a custom page which displays all orders within a database table. Once someone selects an order I would like it display all the individual items for that order. This data is stored in another table but within the same database. I found a very useful article on here Asp.net Dynamic data multiple relational entities on single page which I think gives me pretty much my answer but I am stuck where it comes to the part about implementing IEnumerable (I am trying to implement version 2 on the page). I have done some reading on IEnumerable but I am really lost. I'm not sure if I'm supposed to create a new class. Can anyone help?
Here is the code I have so far:
HTML code:
<h2 class="DDSubHeader">Catering Request Orders</h2>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<div class="DD">
<asp:ValidationSummary ID="ValidationSummary1" runat="server" EnableClientScript="true"
HeaderText="List of validation errors" CssClass="DDValidator" />
<asp:DynamicValidator runat="server" ID="GridViewValidator" ControlToValidate="GridView1" Display="None" CssClass="DDValidator" />
<asp:DynamicValidator runat="server" ID="FormViewValidator" ControlToValidate="FormView1" Display="None" CssClass="DDValidator" />
<asp:QueryableFilterRepeater runat="server" ID="FilterRepeater">
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Eval("DisplayName") %>' OnPreRender="Label_PreRender" />
<asp:DynamicFilter runat="server" ID="DynamicFilter" OnFilterChanged="DynamicFilter_FilterChanged" /><br />
</ItemTemplate>
</asp:QueryableFilterRepeater>
<br />
<asp:Button ID="searchButton" runat="server" Text="Search" OnClick="SearchButton_Click" />
</div>
<asp:GridView ID="GridView1" runat="server" DataSourceID="GridDataSource" EnablePersistedSelection="True"
AutoGenerateSelectButton="True"
AutoGenerateColumns="False"
AllowPaging="True" AllowSorting="True" OnDataBound="GridView1_DataBound"
OnRowEditing="GridView1_RowEditing" OnSelectedIndexChanging="GridView1_SelectedIndexChanging"
OnRowDeleted="GridView1_RowDeleted" OnRowUpdated="GridView1_RowUpdated"
OnRowCreated="GridView1_RowCreated" CssClass="DDGridView"
RowStyle-CssClass="td" HeaderStyle-CssClass="th" CellPadding="6">
<Columns>
<%--<asp:TemplateField>
<ItemTemplate>
<asp:DynamicHyperLink ID="DynamicHyperLink1" runat="server" Text="Details" />
<a id="CategoryRouteID" runat="server" href= '<%# GetRouteInformation() %>'/>
<%-- <asp:DynamicHyperLink ID="DynamicHyperLink1" runat="server" Text="Details" />
<!-- Create action link to filter items that
belong to the same category -->
<a ID="CategoryRouteID" runat="server" href='<%# GetRouteInformation() %>'>
</a></asp:DynamicHyperLink>
</ItemTemplate>
</asp:TemplateField>--%>
<asp:DynamicField DataField="OrderNo" HeaderText="Order No" />
<asp:DynamicField DataField="DisplayName" HeaderText="Display name" />
<asp:DynamicField DataField="EmailAddress" HeaderText="Email address" />
<asp:DynamicField DataField="DeliveryDate" HeaderText="Delivery date" />
<asp:DynamicField DataField="Time" HeaderText="Time" />
<asp:DynamicField DataField="Location" HeaderText="Location" />
<asp:DynamicField DataField="Site" HeaderText="Site" />
<asp:DynamicField DataField="OrderProgress" HeaderText="Order progress" />
<asp:DynamicField DataField="tblCateringOrdersDetailsItems" HeaderText="Item details" />
</Columns>
<HeaderStyle CssClass="th" />
<PagerStyle CssClass="DDFooter" />
<RowStyle CssClass="td" />
<SelectedRowStyle CssClass="DDSelected" />
<PagerTemplate>
<asp:GridViewPager ID="GridViewPager1" runat="server" />
</PagerTemplate>
<EmptyDataTemplate>
There are currently no items in this table.
</EmptyDataTemplate>
<SortedAscendingHeaderStyle BackColor="#DEDFF0" Font-Bold="True" />
<SortedDescendingHeaderStyle BackColor="#DEDFF0" Font-Bold="True" />
</asp:GridView>
<asp:EntityDataSource ID="GridDataSource" runat="server" EnableDelete="true" EnableUpdate="true" />
<asp:QueryExtender ID="GridQueryExtender" TargetControlID="GridDataSource" runat="server">
<asp:DynamicFilterExpression ControlID="FilterRepeater" />
</asp:QueryExtender>
<asp:Panel ID="DetailsPanel" runat="server">
<br /><br />
<asp:FormView ID="FormView1" runat="server" DataSourceID="DetailsDataSource" RenderOuterTable="false"
OnPreRender="FormView1_PreRender" OnModeChanging="FormView1_ModeChanging" OnItemUpdated="FormView1_ItemUpdated"
OnItemInserted="FormView1_ItemInserted" OnItemDeleted="FormView1_ItemDeleted" OnItemCommand="FormView1_ItemCommand">
<HeaderTemplate>
<table id="detailsTable" class="DDDetailsTable" cellpadding="6">
</HeaderTemplate>
<ItemTemplate>
<tr class="td">
<td class="DDLightHeader">Order No</td>
<td><asp:DynamicControl ID="OrderNo" runat="server" DataField="OrderNo" /></td>
</tr>
<tr class="td">
<td class="DDLightHeader">User ID</td>
<td><asp:DynamicControl runat="server" DataField="UserID" /></td>
</tr>
<tr class="td">
<td class="DDLightHeader">Display Name</td>
<td><asp:DynamicControl runat="server" DataField="DisplayName" /></td>
</tr>
<tr class="td">
<td class="DDLightHeader">Email Address</td>
<td><asp:DynamicControl ID="EmailAddress" runat="server" DataField="EmailAddress" /></td>
</tr>
<tr class="td">
<td class="DDLightHeader">Project Code</td>
<td><asp:DynamicControl runat="server" DataField="ProjectCode" /></td>
</tr>
<tr class="td">
<td class="DDLightHeader">Event Description</td>
<td><asp:DynamicControl runat="server" DataField="EventDesc" /></td>
</tr>
<tr class="td">
<td class="DDLightHeader">Delivery Date</td>
<td><asp:DynamicControl runat="server" DataField="DeliveryDate" /></td>
</tr>
<tr class="td">
<td class="DDLightHeader">Date Ordered</td>
<td><asp:DynamicControl runat="server" DataField="DateOrdered" /></td>
</tr>
<tr class="td">
<td class="DDLightHeader">Site</td>
<td><asp:DynamicControl runat="server" DataField="Site" /></td>
</tr>
<tr class="td">
<td class="DDLightHeader">Time</td>
<td><asp:DynamicControl runat="server" DataField="Time" /></td>
</tr>
<tr class="td">
<td class="DDLightHeader">Location</td>
<td><asp:DynamicControl runat="server" DataField="Location" /></td>
</tr>
<tr class="td">
<td class="DDLightHeader">Additional Information</td>
<td><asp:DynamicControl runat="server" ID="AdditionalInfo" DataField="AdditionalInfo" /></td>
</tr>
<tr class="td">
<td class="DDLightHeader">Item Costs</td>
<td><asp:DynamicControl runat="server" ID="ItemCosts" DataField="ItemCosts" /></td>
</tr>
<tr class="td">
<td class="DDLightHeader">AdditionalCosts</td>
<td><asp:DynamicControl runat="server" ID="AdditionalCosts" DataField="AdditionalCosts" /></td>
</tr>
<tr class="td">
<td class="DDLightHeader">Total Costs</td>
<td><asp:DynamicControl runat="server" DataField="TotalCosts" /></td>
</tr>
<tr class="td">
<td class="DDLightHeader">More Information Required</td>
<td><asp:DynamicControl runat="server" DataField="MoreInformationRequired" UIHint="MultilineText" /></td>
</tr>
<tr class="td">
<td class="DDLightHeader">Reason Rejected</td>
<td><asp:DynamicControl runat="server" DataField="ReasonRejected" UIHint="MultilineText" /></td>
</tr>
<tr class="td">
<td class="DDLightHeader">Order Progress</td>
<td><asp:DynamicControl runat="server" DataField="OrderProgress" /></td>
</tr>
<tr class="td">
<td class="DDLightHeader">Imported Into Dream</td>
<td><asp:DynamicControl runat="server" DataField="ImportedIntoDream" /></td>
</tr>
<tr class="td">
<td class="DDLightHeader">View Items</td>
<td><asp:DynamicControl runat="server" DataField="tblCateringOrdersDetailsItems" /></td>
</tr>
<%--<asp:DynamicEntity ID="DynamicEntity1" runat="server" />--%>
<tr class="td">
<td colspan="2">
<asp:LinkButton ID="LinkButton1" runat="server" CommandName="Edit" Text="Edit" />
<asp:LinkButton ID="LinkButton2" runat="server" CommandName="Delete" Text="Delete"
OnClientClick='return confirm("Are you sure you want to delete this item?");' />
<%-- <asp:LinkButton ID="LinkButton3" runat="server" CommandName="New" Text="New" />--%>
</td>
</tr>
</ItemTemplate>
<EditItemTemplate>
<tr class="td">
<td class="DDLightHeader">Order No</td>
<td><asp:DynamicControl ID="OrderNo" runat="server" DataField="OrderNo" Mode="ReadOnly"/></td>
</tr>
<tr class="td">
<td class="DDLightHeader">User ID</td>
<td><asp:DynamicControl runat="server" DataField="UserID" Mode="ReadOnly"/></td>
</tr>
<tr class="td">
<td class="DDLightHeader">Display Name</td>
<td><asp:DynamicControl runat="server" DataField="DisplayName" Mode="ReadOnly" /></td>
</tr>
<tr class="td">
<td class="DDLightHeader">Email Address</td>
<td><asp:DynamicControl runat="server" DataField="EmailAddress" /></td>
</tr>
<tr class="td">
<td class="DDLightHeader">Project Code</td>
<td><asp:DynamicControl runat="server" DataField="ProjectCode" Mode="ReadOnly" /></td>
</tr>
<tr class="td">
<td class="DDLightHeader">Event Description</td>
<td><asp:DynamicControl runat="server" DataField="EventDesc" Mode="ReadOnly" /></td>
</tr>
<tr class="td">
<td class="DDLightHeader">Delivery Date</td>
<td><asp:DynamicControl runat="server" DataField="DeliveryDate" Mode="ReadOnly" /></td>
</tr>
<tr class="td">
<td class="DDLightHeader">Date Ordered</td>
<td><asp:DynamicControl runat="server" DataField="DateOrdered" Mode="ReadOnly" /></td>
</tr>
<tr class="td">
<td class="DDLightHeader">Site</td>
<td><asp:DynamicControl runat="server" DataField="Site" Mode="ReadOnly" /></td>
</tr>
<tr class="td">
<td class="DDLightHeader">Time</td>
<td><asp:DynamicControl runat="server" DataField="Time" Mode="ReadOnly" /></td>
</tr>
<tr class="td">
<td class="DDLightHeader">Location</td>
<td><asp:DynamicControl runat="server" DataField="Location" Mode="ReadOnly" /></td>
</tr>
<tr class="td">
<td class="DDLightHeader">Additional Information</td>
<td><asp:DynamicControl runat="server" DataField="AdditionalInfo" Mode="ReadOnly" /></td>
</tr>
<tr class="td">
<td class="DDLightHeader">Item Costs</td>
<td><asp:DynamicControl runat="server" ID="ItemCosts" DataField="ItemCosts" Mode="Edit" /></td>
</tr>
<tr class="td">
<td class="DDLightHeader">Additional Costs</td>
<td><asp:DynamicControl runat="server" ID="AdditionalCosts" DataField="AdditionalCosts" Mode="Edit" /></td>
</tr>
<tr class="td">
<td class="DDLightHeader">Total Costs</td>
<td><asp:DynamicControl runat="server" ID="TotalCosts" DataField="TotalCosts" Mode="Edit" /></td>
<%--<td><asp:Button runat="server" ID="btnCalculateTotalCosts" Text="Calculate total costs" CommandName="Calculate" /></td>--%>
<%-- <asp:Button ID="btnUpdateOrder" runat="server" onclick="btnUpdateOrder_Click"
Text="Update Order" />--%>
</tr>
<tr class="td">
<td class="DDLightHeader">More Information Required</td>
<td><asp:DynamicControl runat="server" DataField="MoreInformationRequired" Mode="Edit" UIHint="MultilineText" /></td>
</tr>
<tr class="td">
<td class="DDLightHeader">Reason Rejected</td>
<td><asp:DynamicControl runat="server" DataField="ReasonRejected" Mode="Edit" UIHint="MultilineText" /></td>
</tr>
<tr class="td">
<td class="DDLightHeader">Order Progress</td>
<td><asp:DynamicControl runat="server" DataField="OrderProgress" Mode="Edit" UIHint="OrderProgressDropDown" /></td>
</tr>
<tr class="td">
<td class="DDLightHeader">Imported Into Dream</td>
<td><asp:DynamicControl runat="server" DataField="ImportedIntoDream" Mode="Edit" /></td>
</tr>
<tr class="td">
<td class="DDLightHeader">View Items</td>
<td><asp:DynamicControl runat="server" DataField="tblCateringOrdersDetailsItems" Mode="Edit" /></td>
</tr>
<%--<asp:DynamicEntity ID="DynamicEntity2" runat="server" Mode="Edit" />--%>
<tr class="td">
<td colspan="2">
<asp:LinkButton ID="LinkButton4" runat="server" CommandName="Update" Text="Update" />
<asp:LinkButton ID="LinkButton5" runat="server" CommandName="Cancel" Text="Cancel" CausesValidation="false" />
</td>
</tr>
</EditItemTemplate>
<InsertItemTemplate>
<asp:DynamicEntity ID="DynamicEntity3" runat="server" Mode="Insert" />
<tr class="td">
<td colspan="2">
<asp:LinkButton ID="LinkButton6" runat="server" CommandName="Insert" Text="Insert" />
<asp:LinkButton ID="LinkButton7" runat="server" CommandName="Cancel" Text="Cancel" CausesValidation="false" />
</td>
</tr>
</InsertItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:FormView>
<asp:EntityDataSource ID="DetailsDataSource" runat="server" EnableDelete="true" EnableInsert="true" EnableUpdate="true" />
<asp:QueryExtender ID="QueryExtender1" TargetControlID="DetailsDataSource" runat="server">
<asp:ControlFilterExpression ControlID="GridView1" />
</asp:QueryExtender>
</asp:Panel>
<%--code for details items --%>
<asp:Panel runat="server" ID="PanelItemDetails">
<asp:GridView ID="GridView2" runat="server"
DataSourceID="EntityDataSourceItemDetails" EnablePersistedSelection="True"
DataKeyNames="OrderNo"
AutoGenerateSelectButton="True"
AutoGenerateColumns="False"
AllowPaging="True" AllowSorting="True" OnDataBound="GridView2_DataBound"
OnRowEditing="GridView2_RowEditing" OnSelectedIndexChanging="GridView2_SelectedIndexChanging"
OnRowDeleted="GridView2_RowDeleted" OnRowUpdated="GridView2_RowUpdated"
OnRowCreated="GridView2_RowCreated" CssClass="DDGridView"
RowStyle-CssClass="td" HeaderStyle-CssClass="th" CellPadding="6">
<Columns>
<%--<asp:DynamicField DataField="tblCateringItemsDetail" HeaderText="Item" />--%>
<asp:BoundField DataField="Description" HeaderText="Description"
ReadOnly="True" SortExpression="Description" />
<asp:BoundField DataField="Quantity" HeaderText="Quantity" ReadOnly="True"
SortExpression="Quantity" />
<asp:BoundField DataField="TotalUnitCost" HeaderText="TotalUnitCost"
ReadOnly="True" SortExpression="TotalUnitCost" />
<asp:BoundField DataField="OrderNo" HeaderText="OrderNo" ReadOnly="True"
SortExpression="OrderNo" />
</Columns>
<HeaderStyle CssClass="th" />
<PagerStyle CssClass="DDFooter" />
<RowStyle CssClass="td" />
<SelectedRowStyle CssClass="DDSelected" />
<PagerTemplate>
<asp:GridViewPager ID="GridViewPager1" runat="server" />
</PagerTemplate>
<EmptyDataTemplate>
There are currently no items in this table.
</EmptyDataTemplate>
<SortedAscendingHeaderStyle BackColor="#DEDFF0" Font-Bold="True" />
<SortedDescendingHeaderStyle BackColor="#DEDFF0" Font-Bold="True" />
</asp:GridView>
<asp:QueryExtender ID="QueryExtender2" TargetControlID="EntityDataSourceItemDetails" runat="server">
<asp:CustomExpression
OnQuerying="OrdersQueryExtender_Querying" />
</asp:QueryExtender>
<asp:EntityDataSource ID="EntityDataSourceItemDetails" runat="server"
ConnectionString="name=cateringEntities"
DefaultContainerName="cateringEntities" EnableFlattening="False"
EntitySetName="vCateringOrdersAllDetails"
Select="it.[Description], it.[Quantity], it.[TotalUnitCost], it.[OrderNo]" ORDERBY="it.OrderNo]" >
</asp:EntityDataSource>
</asp:Panel>
</ContentTemplate>
</asp:UpdatePanel>
C# code:
protected void SelectOrder_Selected(object sender, EntityDataSourceSelectedEventArgs e)
{
IEnumerable<OrderItems> orderItem = e.Results.Cast<Order>();
foreach (Order o in orderItem)
{
customerId = c.Customer_Id;
}
}
protected void OrderQueryExtender_Querying(object sender, system.Web.UI.WebControls.Expressions.CustomExpressionEventArgs e)
{
e.Query = (from a in e.Query.Cast<Order>()
where a.OrderNo == orderNo
select a);
}
Any help would be greatly appreciated.
Claire
My approach is as follows
First I display list of all orders selected in a grid view.
When user selects to see detail of any order i fire grid view row command event and pass order id as command argument.
Then in code behind i get order entity with the help of order id passed in step 2 and along with order entity i get order details and display it in second grid view.
Thank you Nimit for your response. It was very useful. If it helps anyone else I found exactly what I was looking for at http://www.asp.net/web-forms/tutorials/getting-started-with-ef/the-entity-framework-and-aspnet-getting-started-part-4.

Error in parsing asp.net page

Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled
Details: Error parsing near <HTML><HEAD><TITLE><
Please help me out , this is bugging me....
<body>
<form id="form1" runat="server">
<aspAtlas:ScriptManager ID="MyScriptManager" runat="server" AllowCustomErrorsRedirect="true">
</aspAtlas:ScriptManager>
<div class="headerborder" id="hd_SubmissionGuidelines">
<aspAtlas:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td class="t_head">
<asp:HiddenField ID="hfdSizeAttached" runat="server" />
<asp:HiddenField ID="hfdConfidentialDoc" runat="server" />
<asp:HiddenField ID="hfdJustificationDoc" runat="server" />
<asp:HiddenField ID="hfdRedactedVersionDoc" runat="server" />
<asp:Button ID="btnHiddenAttachDoc" runat="server" Style="visibility: hidden" OnClick="btnHiddenAttachDoc_Click" />
<asp:HiddenField ID="hdnDocsAttached" runat="server"></asp:HiddenField>
</td>
</tr>
</table>
</ContentTemplate>
<Triggers>
<aspAtlas:AsyncPostBackTrigger ControlID="btnAgree" EventName="Click" />
<aspAtlas:PostBackTrigger ControlID="btnSubmit" />
<aspAtlas:AsyncPostBackTrigger ControlID="btnBack" EventName="Click" />
<aspAtlas:AsyncPostBackTrigger ControlID="btnHiddenAttachDoc" EventName="Click" />
</Triggers>
</aspAtlas:UpdatePanel>
</div>
<aspAtlas:UpdatePanel ID="UpdPagePanel" runat="server">
<ContentTemplate>
<asp:Panel ID="pnlSubmissionGuidelines" runat="server">
<div class="div_main" id="hd_MainGuidelines">
<div>
<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td class="t_guidelines_head">
Doc Submit
</td>
</tr>
<tr>
<td class="t_guidelines_subhead">
Definitions:
</td>
</tr>
<tr>
<td class="t_guidelines_text">
Dummy lines
<br />
<br />
Dummy lines
<br />
<br />
dummy lines
<br />
<br />
dummy lines
</td>
</tr>
<tr>
<td class="t_guidelines_subhead">
dummy lines
</td>
</tr>
<tr>
<td class="t_guidelines_text">
<font style="text-decoration: underline">Process</font>
<br />
<br />
dummy lines
<br />
<br />
dummy lines
<br />
dummy lines
<br />
<br />
<font class="t_guidelines_ul">Trade Secret </font>
<br />
<font class="t_guidelines_ul">Sample </font><br />
<font class="t_guidelines_ul">Sample text</font>
<br />
<br />
dummy lines
<br />
<br />
<font style="text-decoration: underline">Sample text</font>
<br />
<br />
dummy lines
<br />
<br />
<font class="t_guidelines_ul">Sample ddffvdffvdfgvfv
simple text; </font>
<br />
<font class="t_guidelines_ul">simple text; </font>
<br />
<font class="t_guidelines_ul">simple text; </font>
<br />
<font class="t_guidelines_ul">simple text;</font><br />
<font class="t_guidelines_ul">simple text; </font>
<br />
<font class="t_guidelines_ul">and</font><br />
<font class="t_guidelines_ul">simple text.</font><br />
<br />
<br />
<font style="text-decoration: underline">simple text</font>
<br />
<br />
simple text
<br />
<br />
</td>
</tr>
<tr>
<td align="center">
<asp:Button ID="btnAgree" runat="server" CssClass="top_button" OnClick="btnAgree_Click"
Text="I Agree" />
<asp:Button ID="btnDisagree" runat="server" CssClass="top_button" Text="I Disagree"
OnClientClick="javascript:window.close();" />
</td>
</tr>
</table>
</div>
</div>
</asp:Panel>
<asp:Panel ID="pnlConfidentialDocuments" runat="server">
<table width="99%" cellspacing="0" style="border-left: 1px solid #C3C3C3; border-right: 1px solid #C3C3C3;
border-bottom: 1px solid #C3C3C3;" cellpadding="0" align="center" id="Table1">
<tr class="headerborder">
<td class="t_head">
<span id="Conf_Docs_Close" style="cursor: hand" onclick="hideArea('Conf_Docs','Conf_Docs_Close','Conf_Docs_Open')">
-</span><span id="Conf_Docs_Open" onclick="showArea('Conf_Docs','Conf_Docs_Open','Conf_Docs_Close')"
style="cursor: hand; display: none">+</span> Add Confidential Documents
</td>
</tr>
<tr id="Conf_Docs">
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0" align="left" id="Table2">
<tr valign="top">
<td class="astrik">
</td>
<td class="form_field">
<img style="vertical-align: top" alt="Required Field" src="../Images/MandatoryField.gif" />
<asp:Label ID="LblDocType" runat="server"><label for='<%= ddlDocumentType.ClientID %>'>Document Type</label></asp:Label>
</td>
<td class="form_element">
<asp:DropDownList ID="ddlDocumentType" runat="server" CssClass="form_select">
</asp:DropDownList>
<a id="lnkDocumentClassificationHelp" runat="server" onclick="window.open('http://google.com');return false;">
<img src="<% =Request.ApplicationPath %>/images/help_icon.gif" alt='Document Classification Help'
width='16' height='16' /></a>
</td>
<td>
</td>
</tr>
<tr>
<td class="astrik">
</td>
<td class="form_field" style="vertical-align: top">
<img style="vertical-align: top" alt="Required Field" src="../Images/MandatoryField.gif" />
<asp:Label ID="LblDocTitle" runat="server"><label for='<%= txtDocTitle.ClientID %>'>Document Title</label></asp:Label>
</td>
<td class="form_element" colspan="2">
<asp:TextBox ID="txtDocTitle" runat="server" CssClass="textarea_Conf" TextMode="MultiLine"
MaxLength="2000" Rows="10" />
<br />
<asp:Label ID="lblDocTitleLength" runat="server" CssClass="form_label_textareaLength"
Text="Characters remaining: 2000"></asp:Label>
</td>
</tr>
<tr>
<td colspan="4">
<table width="92%" border="0" cellspacing="0" cellpadding="0" align="left" id="Table3">
<tr>
<td class="form_element" align="right">
<asp:Button ID="btnAttachDocs" runat="server" CssClass="top_button" Text="Attach Document"
OnClientClick="javascript:return OpenAttachDocPopup()" />
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr class="bottomborder">
<td class="toptr">
<asp:Button ID="btnSubmit" Text="Done" CssClass="top_button" runat="server" OnClientClick="javascript:return Validate();"
OnClick="btnSubmit_Click" />
<asp:Button ID="btnBack" Text="Back" CssClass="top_button" runat="server" OnClick="btnBack_Click" />
</td>
</tr>
</table>
</asp:Panel>
<asp:Panel ID="pnlConfidentialDocsGrid" runat="server" Visible="false">
<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td class="t_head">
Attached Documents
</td>
</tr>
<tr>
<td>
<asp:DataGrid ID="dgdDocuments" runat="server" Width="100%" OnDeleteCommand="dgdDocuments_Delete"
DataKeyField="DocGuidName" AutoGenerateColumns="false" OnItemDataBound="dgdDocuments_ItemDataBound">
<HeaderStyle CssClass="t_grid_subheadin" />
<ItemStyle CssClass="t_grid_datain" />
<AlternatingItemStyle CssClass="t_grid_datainalt" />
<Columns>
<asp:TemplateColumn ItemStyle-Width="3%" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:Image ID="ImgSecurity" runat="server" ToolTip="Confidential" ImageUrl='<%# DataBinder.Eval(Container.DataItem, "SecurityImageDisplay") %>' />
<asp:Label ID="HiddenSecurity" runat="server" Visible="false" Text='<%# DataBinder.Eval(Container.DataItem, "SecurityImageDisplay") %>' />
<asp:HiddenField ID="hfdIsJustification" runat="server" Value='<%# DataBinder.Eval(Container.DataItem, "IsJustificationDoc").ToString() %>' />
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn ItemStyle-Width="3" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:Image ID="ImgMimeType" runat="server" ImageUrl='<%# DataBinder.Eval(Container.DataItem, "MimeTypeImagePath") %>' />
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Document Type" ItemStyle-Width="18%">
<ItemTemplate>
<asp:Label ID="LblType" runat="server" Text='<%# ((WSMatter.IDNameEntity)DataBinder.Eval(Container.DataItem, "DocType")).Name %>'></asp:Label>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Document Title" ItemStyle-Width="50%">
<ItemTemplate>
<asp:Label ID="LblTitle" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "DocTitle") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="File Name" ItemStyle-Width="16%">
<ItemTemplate>
<asp:Label ID="LblName" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "DocName") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Size" ItemStyle-Width="10%" ItemStyle-HorizontalAlign="Right">
<ItemTemplate>
<asp:Label ID="LblSize" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "SizetoDisplay") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn ItemStyle-Width="3%" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:LinkButton ID="LnkDelete" runat="server" CommandName="Delete"><img src="../Images/nok.gif" alt="Delete"/></asp:LinkButton>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:DataGrid>
<asp:HiddenField ID="HdnTotalSizeAttached" runat="server" />
</td>
</tr>
</table>
</asp:Panel>
</ContentTemplate>
<Triggers>
<aspAtlas:AsyncPostBackTrigger ControlID="btnAgree" EventName="Click" />
<aspAtlas:PostBackTrigger ControlID="btnSubmit" />
<aspAtlas:AsyncPostBackTrigger ControlID="btnBack" EventName="Click" />
<aspAtlas:AsyncPostBackTrigger ControlID="btnHiddenAttachDoc" EventName="Click" />
</Triggers>
</aspAtlas:UpdatePanel>
</form>
</body>
As per your code it seems you are not using masterpage, and you have not shown us your tag, so I assume following could help you.
Normally in asp.net webforms, <Head> tag is attributed as
runat="server", So you may try <head runat="server">
Note: I have written it as an answer because there are many comments on the answer, it alerts the moderators. So better new comments get after the answers.
Edit:
This error occurs on the server while processing the response to an asynchronous postback.
There are some links to solve this issue, check it they help:
http://weblogs.asp.net/leftslipper/archive/2007/02/26/sys-webforms-pagerequestmanagerparsererrorexception-what-it-is-and-how-to-avoid-it.aspx
http://forums.asp.net/t/1038252.aspx/1/10
ASP.NET Ajax Error: Sys.WebForms.PageRequestManagerParserErrorException

Button Control No Engaging After Calender Selector Is Used

I have a calender selector that looks like
<asp:ImageButton ID="calStartImage" runat="server" ImageUrl="../images/SmallCalendar.gif"
AlternateText="Please select start date" />
<ajaxToolkit:CalendarExtender ID="calStartDate" runat="server" TargetControlID="txtStartDate"
Format="MM/dd/yyyy" PopupButtonID="calStartImage" />
And A search button that look like this
<asp:Button ID="btnSearch" runat="server" Text="Search" OnClick="btnSearch_Click"
CausesValidation="false" />
When I select a date from the calender and press Search..The first time btnSearch_Click doesnt fire..If I click Search again it works fine. So I have to click the Search button twice before the click event works. This only happens if I select a date from the calender control.
Here is the full control:
<ajaxToolkit:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</ajaxToolkit:ToolkitScriptManager>
<table>
<tr>
<td class="SearchBox">
<table>
<tr>
<td colspan="2">
<b>Enter name to filter results</b>
<asp:TextBox ID="txtProjectName" runat="server"></asp:TextBox><br />
<br />
</td>
</tr>
<tr>
<td valign="middle">
<b>From:</b>
<asp:TextBox ID="txtStartDate" runat="server"></asp:TextBox>
<asp:ImageButton ID="calStartImage" runat="server" ImageUrl="../images/SmallCalendar.gif"
AlternateText="Please select start date" />
<ajaxToolkit:CalendarExtender ID="calStartDate" runat="server" TargetControlID="txtStartDate"
Format="MM/dd/yyyy" PopupButtonID="calStartImage" />
<b>Thru:</b>
<asp:TextBox ID="txtEndDate" runat="server"></asp:TextBox>
<asp:ImageButton runat="server" ID="calEndImage" ImageUrl="../images/SmallCalendar.gif"
AlternateText="Please select end date" />
<ajaxToolkit:CalendarExtender ID="calEndDate" runat="server" TargetControlID="txtEndDate"
Format="MM/dd/yyyy" PopupButtonID="calEndImage" />
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="From Date is Required"
ControlToValidate="txtStartDate" Display="Dynamic"></asp:RequiredFieldValidator>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="Thru Date is Required"
ControlToValidate="txtEndDate" Display="Dynamic"></asp:RequiredFieldValidator>
<asp:RangeValidator ID="RangeValidator1" runat="server" ErrorMessage="Invalid From Date"
ControlToValidate="txtStartDate" Display="Dynamic" MaximumValue="1/1/2099" MinimumValue="1/1/2006"
SetFocusOnError="True" Type="Date"></asp:RangeValidator>
<asp:RangeValidator ID="RangeValidator2" runat="server" ControlToValidate="txtEndDate"
ErrorMessage="Invalid Thru Date" SetFocusOnError="True" Type="Date" Display="Dynamic"
MaximumValue="1/1/2999" MinimumValue="1/1/2006"></asp:RangeValidator>
<br />
</td>
</tr>
<tr>
<td align="left">
<asp:Button ID="btnSearch" runat="server" Text="Search" OnClick="btnSearch_Click"
CausesValidation="false" />
</td>
</tr>
</table>
</td>
<td align="right" style="width:560px">
Guide
</td>
</tr>
</table>
Here is more from the page....
<ajaxToolkit:ModalPopupExtender ID="mdlPopupExtender" runat="server" TargetControlID="btnShowPopup"
PopupControlID="pnlProject" BackgroundCssClass="modalBackground" Drag="true"
DropShadow="true" CancelControlID="btnClose" PopupDragHandleControlID="TitleBar">
</ajaxToolkit:ModalPopupExtender>
<asp:Button ID="btnShowPopup" runat="server" Style="display: none" />
<asp:Panel ID="pnlProject" runat="server" BackColor="WhiteSmoke">
<asp:Panel ID="TitleBar" runat="server" CssClass="modalPopupTitleBar">
Add/Edit Project
</asp:Panel>
<asp:UpdatePanel ID="upPopList" runat="server" UpdateMode="Conditional">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnAddNew" EventName="Click" />
</Triggers>
<ContentTemplate>
<table cellspacing="10">
<tr>
<td colspan="2">
</td>
</tr>
<tr>
<td>
<b>Project Name:</b>
</td>
<td>
<asp:TextBox ID="txtProject" runat="server" Width="200px"></asp:TextBox>
<asp:RequiredFieldValidator ID="reqProject" runat="server" ErrorMessage="Required!"
Display="Dynamic" ControlToValidate="txtProject"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td>
<b>Field Office:</b>
</td>
<td>
<asp:TextBox ID="txtFieldOffice" runat="server" Width="200px"></asp:TextBox>
<asp:RequiredFieldValidator ID="reqFieldOffice" runat="server" ErrorMessage="Required!"
Display="Dynamic" ControlToValidate="txtFieldOffice"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td>
<b>Created By:</b>
</td>
<td>
<asp:Label ID="lblCreatedBy" runat="server"></asp:Label>
</td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>
<table>
<tr>
<td>
<br />
<asp:Button ID="btnSubmit" runat="server" Text="Save" OnClick="btnSubmit_Click" />
<asp:Button ID="btnClose" runat="server" Text="Close" CausesValidation="false" />
<br />
</td>
</tr>
</table>
</asp:Panel>
Any Ideas?
You need to add ValidationGroup to your validation controls so that each validation group can perform validation independently from other validation group on a specific page. more you can read here Specifying Validation Groups
Here is your code with group validation. you can change it as your environment.
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<table>
<tr>
<td>
<table>
<tr>
<td colspan="2">
<b>Enter name to filter results</b>
<asp:TextBox ID="txtProjectName" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td valign="middle">
<b>From:</b>
<asp:TextBox ID="txtStartDate" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="formDateRequiredValidator" ValidationGroup="Date"
runat="server" ErrorMessage="Enter From Date." ControlToValidate="txtStartDate"></asp:RequiredFieldValidator>
<asp:RangeValidator ID="RangeValidator1" runat="server" ValidationGroup="Date" ErrorMessage="Invalid From Date"
ControlToValidate="txtStartDate" Display="Dynamic" MaximumValue="1/1/2099" MinimumValue="1/1/2006"
SetFocusOnError="True" Type="Date"></asp:RangeValidator>
<asp:ImageButton ID="calStartImage" runat="server" AlternateText="Please select start date" />
<asp:CalendarExtender ID="calStartDate" runat="server" TargetControlID="txtStartDate"
Format="MM/dd/yyyy" PopupButtonID="calStartImage" />
<b>Thru:</b>
<asp:TextBox ID="txtEndDate" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="endDateRequiredValidator" ValidationGroup="Date"
runat="server" ErrorMessage="Enter Thru Date." ControlToValidate="txtEndDate"></asp:RequiredFieldValidator>
<asp:RangeValidator ID="RangeValidator2" ValidationGroup="Date" runat="server" ErrorMessage="Invalid From Date"
ControlToValidate="txtStartDate" Display="Dynamic" MaximumValue="1/1/2099" MinimumValue="1/1/2006"
SetFocusOnError="True" Type="Date"></asp:RangeValidator>&nbsp
<asp:ImageButton runat="server" ID="calEndImage" ImageUrl="../images/SmallCalendar.gif"
AlternateText="Please select end date" />
<asp:CalendarExtender ID="calEndDate" runat="server" TargetControlID="txtEndDate"
Format="MM/dd/yyyy" PopupButtonID="calEndImage" />
</td>
</tr>
<tr>
<td align="left">
<asp:Button ID="btnSearch" runat="server" Text="Search" ValidationGroup="Date" CausesValidation="false" />
</td>
</tr>
</table>
</td>
<td align="right">
Guide
</td>
</tr>
</table>
<asp:ModalPopupExtender ID="mdlPopupExtender" runat="server" TargetControlID="btnShowPopup"
PopupControlID="pnlProject" BackgroundCssClass="modalBackground" Drag="true"
DropShadow="true" CancelControlID="btnClose" PopupDragHandleControlID="TitleBar">
</asp:ModalPopupExtender>
<asp:Button ID="btnShowPopup" runat="server" Style="display: none" />
<asp:Panel ID="pnlProject" runat="server" BackColor="WhiteSmoke">
<asp:Panel ID="TitleBar" runat="server">
Add/Edit Project
<%-- I have added this Button you can replace with yours becaus specified in Triggers to run the code i need to add this(btnAddNew) Button--%>
<asp:Button ID="btnAddNew" runat="server" Text="AddNew" />
</asp:Panel>
<asp:UpdatePanel ID="upPopList" runat="server" UpdateMode="Conditional">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnAddNew" />
</Triggers>
<ContentTemplate>
<table>
<tr>
<td colspan="2">
</td>
</tr>
<tr>
<td>
<b>Project Name:</b>
</td>
<td>
<asp:TextBox ID="txtProject" runat="server" Width="200px"></asp:TextBox>
<asp:RequiredFieldValidator ID="reqProject" ValidationGroup="ProjectInfo" runat="server"
ErrorMessage="Required!" Display="Dynamic" ControlToValidate="txtProject"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td>
<b>Field Office:</b>
</td>
<td>
<asp:TextBox ID="txtFieldOffice" runat="server" Width="200px"></asp:TextBox>
<asp:RequiredFieldValidator ID="reqFieldOffice" ValidationGroup="ProjectInfo" runat="server"
ErrorMessage="Required!" Display="Dynamic" ControlToValidate="txtFieldOffice"></asp:RequiredFieldValidator>
</td>
</tr>
</td> </tr>
<tr>
<td>
<b>Created By:</b>
</td>
<td>
<asp:Label ID="lblCreatedBy" runat="server"></asp:Label>
</td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>
<table>
<tr>
<td>
<br />
<asp:Button ID="btnSubmit" runat="server" Text="Save" OnClick="btnSubmit_Click" />
<asp:Button ID="btnClose" runat="server" Text="Close" CausesValidation="false" ValidationGroup="ProjectInfo"
OnClick="btnClose_Click" />
<br />
</td>
</tr>
</table>
</asp:Panel>
Hope this helps.
I don't know why but your problem can be solved by setting the CausesValidation property of btnSearch to true
<asp:Button ID="btnSearch" runat="server" Text="Search" OnClick="btnSearch_Click"
CausesValidation="true" />

Categories