I have recently added a updatepanel in my aspx page. My controls are inside a HTML table, labels, dropdownlist etc. And i want the dropdown lists to refresh only.. but no hope at all.. any help..
The sample code is below
<asp:UpdatePanel ID="UpdatePanel1" runat="server" RenderMode="Inline">
<ContentTemplate>
<table id="Table5" height="50" cellspacing="3" cellpadding="3" width="200" border="1">
<tr>
<td width="110" height="21">
<p align="left">
<asp:Label ID="lblDomain" runat="server" CssClass="reportOption" Width="51px">Domain</asp:Label></p>
</td>
<td width="110" height="21">
<p align="left">
<asp:Label ID="lblSystem" runat="server" CssClass="reportOption" Width="51px">System</asp:Label></p>
</td>
<td style="width: 86px" nowrap width="86" height="21">
<p align="left">
<asp:Label ID="lblVendor" runat="server" CssClass="reportOption" Width="88px">Select Vendor</asp:Label></p>
</td>
<td>
<asp:Label ID="lblRegion" runat="server" CssClass="reportOption" Width="77px">Select Region</asp:Label>
</td>
<td>
<asp:Label ID="lblNode" runat="server" CssClass="reportOption" Width="80px">Select Node</asp:Label>
</td>
<td>
<asp:Label ID="lblRouteType" runat="server" CssClass="reportOption" Width="91px"
Visible="False">Select Route Type</asp:Label>
</td>
<td>
<asp:Label ID="lblRoute" runat="server" CssClass="reportOption" Width="80px">Select Route</asp:Label>
</td>
<td>
<asp:Label ID="lblUtil" runat="server" CssClass="reportOption" Width="80px">Enter Utilization > than</asp:Label>
</td>
</tr>
<tr>
<td width="51">
<asp:DropDownList ID="ddlDomain" runat="server" CssClass="reportOption" Width="89px"
AutoPostBack="True">
<asp:ListItem>National</asp:ListItem>
<asp:ListItem>International</asp:ListItem>
<asp:ListItem>[All]</asp:ListItem>
</asp:DropDownList>
</td>
<td width="51">
<asp:DropDownList ID="ddlSystem" runat="server" CssClass="reportOption" Width="55px"
AutoPostBack="True">
<asp:ListItem>NNN</asp:ListItem>
<asp:ListItem>III</asp:ListItem>
<asp:ListItem>TTT</asp:ListItem>
</asp:DropDownList>
</td>
<td width="50">
<asp:DropDownList ID="ddlVendor" runat="server" CssClass="reportOption" Width="91px"
AutoPostBack="True">
</asp:DropDownList>
</td>
<td>
<asp:DropDownList ID="ddlRegion" runat="server" CssClass="reportOption" Width="80px"
AutoPostBack="True">
</asp:DropDownList>
</td>
<td>
<asp:DropDownList ID="ddlNode" runat="server" CssClass="reportOption" Width="80px"
AutoPostBack="True">
</asp:DropDownList>
</td>
<td>
<asp:DropDownList ID="ddlRouteType" runat="server" CssClass="reportOption" Width="80px"
Visible="False">
</asp:DropDownList>
</td>
<td>
<asp:DropDownList ID="ddlRoute" runat="server" CssClass="reportOption" Width="80px">
</asp:DropDownList>
</td>
<td>
<asp:TextBox ID="tbUtil" runat="server" CssClass="reportOption" Height="20px" Width="51px">0.0</asp:TextBox>
</td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>
And yes the script manager is there too..
<asp:ScriptManager ID="AjaxScriptManagerforDDL" runat="server">
</asp:ScriptManager>
This code is fine, you have placed your dropdowns in update panel, and all your dropdowns are Autopostback=true.
Clearly when you select any value from dropdownlist, page should not get refreshed. Thats what is happening with this code.
I created a aspx page, added a script manager, and then added your code, its working fine.
Related
I'm using CommandItemSettings in MasterTablreView to show Export to Excel button.
The CommandItemSettings section of the grid is displayed when Grid has at least 10 records or when I select less than 10 records using a Pager.
However, with less than 10 records after I click the Search button, the CommandItemSettings section is not there and I cannot export the data into an Excel.
Here is the aspx file:
MOSS2 Merchants Report:
<telerik:RadAjaxManager ID="RadAjaxManager" runat="server" EnableAJAX="true">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="btnSearch">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="grdMoss2Merchants" LoadingPanelID="RadAjaxLoadingPanel2"></telerik:AjaxUpdatedControl>
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManager>
<telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server">
<table class="moss2Search" width="100%">
<tr>
<td colspan="4">
<asp:CustomValidator ID="checkForTwoDates" ClientValidationFunction="AtLeastOneDate_ClientValidate"
EnableClientScript="True" ErrorMessage="At least one date should be selected" runat="server"></asp:CustomValidator> <br />
<asp:CompareValidator ID="CompareValidator2" ControlToCompare="RadDatePicker1" ControlToValidate="RadDatePicker2" Operator="GreaterThanEqual"
ErrorMessage="Date range is not valid" runat="server"></asp:CompareValidator>
</td>
</tr>
<tr>
<td>
<div runat="server">
<asp:Label runat="server" CssClass="dateLabels">Boarding Start Date</asp:Label>
<telerik:RadDatePicker RenderMode="Lightweight" ID="RadDatePicker1" runat="server" onkeydown="keyPress(this, event)">
<Calendar runat="server">
<FastNavigationSettings EnableTodayButtonSelection="true"></FastNavigationSettings>
</Calendar>
</telerik:RadDatePicker>
</div>
</td>
<td>
<div runat="server">
<asp:Label runat="server" CssClass="dateLabels">Boarding End Date</asp:Label>
<telerik:RadDatePicker RenderMode="Lightweight" ID="RadDatePicker2" runat="server" onkeydown="keyPress(this, event)">
<Calendar runat="server">
<FastNavigationSettings EnableTodayButtonSelection="true"></FastNavigationSettings>
</Calendar>
</telerik:RadDatePicker>
</div>
</td>
<td>
<div>
<asp:CheckBox ID="chkMerActive" runat="server" Checked="true" TextAlign="Left"/>Active
</div>
</td>
<td>
<telerik:RadButton RenderMode="Lightweight" runat="server" Text="Search" ID="btnSearch" OnClick="btnSearch_Click"/>
</td>
</tr>
</table>
<asp:Label ID="lblMsg" ForeColor="red" runat="server"></asp:Label>
<br />
</telerik:RadAjaxPanel>
<%----%>
<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel2" runat="server" Skin="Default">
</telerik:RadAjaxLoadingPanel>
<telerik:RadAjaxPanel ID="RadAjaxPanel2" runat="server" LoadingPanelID="RadAjaxLoadingPanel2">
<telerik:RadGrid
RenderMode="Lightweight"
runat="server"
ID="grdMoss2Merchants"
AllowPaging="True"
AllowSorting="true"
PagerStyle-AlwaysVisible="true"
OnNeedDataSource="BindToDatasource"
OnSortCommand="grdMoss2Merchants_SortCommand"
ViewStateMode="Enabled"
AutoGenerateColumns="false"
OnPageIndexChanged="grdMoss2Merchants_ChangePage"
ClientSettings-Scrolling-ScrollHeight="360px">
<GroupingSettings CaseSensitive="false"/>
<ExportSettings HideStructureColumns="true" ExportOnlyData="true" OpenInNewWindow="true" Excel-Format="Xlsx" IgnorePaging="true" FileName="Moss2Merchants">
<Excel WorksheetName="Moss2Merchants" Format="Xlsx" AutoFitColumnWidth="AutoFitAll" />
</ExportSettings>
<ClientSettings EnableRowHoverStyle="true">
<Scrolling AllowScroll="true" UseStaticHeaders="True"/>
</ClientSettings>
<SortingSettings EnableSkinSortStyles="false" />
<HeaderStyle Width="160px" CssClass="grdHeader" ForeColor="#2E6E9E" />
<MasterTableView AllowNaturalSort="false" CommandItemDisplay="Bottom">
<CommandItemSettings ShowExportToExcelButton="true" ShowAddNewRecordButton="false" ShowRefreshButton="false" />
<CommandItemStyle HorizontalAlign="Right" />
<PagerStyle AlwaysVisible="true" Mode="NextPrevAndNumeric" PageSizes="5,10,25,50,100" />
<Columns>
<telerik:GridBoundColumn DataField="Moss2 MID" HeaderText="MOSS2 MID" AllowSorting="false" DataFormatString="{0:#}"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="DBA" HeaderText="DBA" HeaderStyle-Width="250px">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Original MID" HeaderText="ORIGINAL MID" AllowSorting="false" DataFormatString="{0:#}"></telerik:GridBoundColumn>
<telerik:GridBoundColumn
DataField="BoardingDate"
DataType="System.DateTime"
HtmlEncode="false"
DataFormatString="{0:MM/dd/yyyy}"
SortExpression="BoardingDate"
UniqueName="BoardingDate"
HeaderText="BOARDING DATE"
HeaderStyle-Width="170px"
ShowFilterIcon="false"
/>
<telerik:GridBoundColumn DataField="Status" HeaderText="STATUS" AllowSorting="false"></telerik:GridBoundColumn>
</Columns>
</MasterTableView>
</telerik:RadGrid>
</telerik:RadAjaxPanel>
The Export To Excel button is showing with Grid having
We have a pretty customized "batch edit" type screen. Out users frequently make changes, then forget to hit Save before moving on to the next page. I have tried the solutions found here:
[a link] http://www.telerik.com/support/code-library/prevent-losing-batch-editing-changes-on-paging-or-any-other-postback
[a link] http://www.telerik.com/forums/prevent-losing-batch-editing-changes-on-paging-or-any-other-postback
But I end up with errors like "RecordNumber" is neither a DataColumn nor a DataRelation. Here's my code. I'm thinking our grid is just too complicated for these straightforward solutions...?
<%# Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true"
CodeFile="AssignTeacherAdvisor2.aspx.cs" Inherits="AssignTeacherAdvisor2" Theme="LBL" %>
<%# Register Src="Controls/ActionBar.ascx" TagName="ActionBar" TagPrefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolderMainAppTop" runat="Server">
<div id="populateTchrIDs" runat="server">
<%-- <script type="text/javascript" language="javascript">
function KGCalChange(sender, eventArgs) {
//debugger;
if (sender.value == "KG") {
showHideLayer('<%= labelKGCal_Search.ClientID %>', 'show');
showHideLayer('<%= comboKGCal_Search.ClientID %>', 'show');
}
else {
showHideLayer('<%= labelKGCal_Search.ClientID %>', 'hide');
showHideLayer('<%= comboKGCal_Search.ClientID %>', 'hide');
}
}
</script>--%>
<script type="text/javascript">
function clientItemChecking(sender, args)
{
if (sender.get_checkedItems().length == 3 && (args.get_item().get_checked() == false))
{
alert("count exceeded");
args.set_cancel(true);
}
}
function clientItemCheckingC(sender, args) {
if (sender.get_checkedItems().length == 5 && (args.get_item().get_checked() == false)) {
alert("count exceeded");
args.set_cancel(true);
}
}
</script>
</div>
<telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server">
<uc1:ActionBar ID="ActionBarTop" runat="server" CancelVisible="True" ExportVisible="True"
SaveVisible="True" Text="Assign Teacher/Advisor" HelpVisible="True" ExportURL="~/DataExport.aspx?frm=AssignTeacherAdvisor2"
OnSaveClick="ActionBar_SaveClick" OnCancelClick="ActionBar_CancelClick" />
<table class="six" style="width: 100%">
<tr>
<td>
<div class="padded header">
Search and Sort
</div>
</td>
<td align="right">
<asp:HyperLink ID="HyperLinkAdvancedSearch" runat="server" NavigateUrl="javascript:ToggleAdvanced();"
class="advancedSearchLink">
Advanced Search</asp:HyperLink>
</td>
</tr>
</table>
<br />
<asp:HiddenField ID="hiddenField" runat="server" />
<asp:Panel ID="PanelSaveSuccess" runat="server" CssClass="infoMessage" Visible="false">
<asp:Label ID="LabelSaveSuccess" runat="server" Text="Information saved successfully." />
</asp:Panel>
<asp:ValidationSummary ID="ValidationSummaryMain" runat="server" />
<asp:CustomValidator ID="CustomValidator1" runat="server" Display="None" ErrorMessage="CustomValidator"></asp:CustomValidator>
<asp:Panel ID="PanelInputs" runat="server" DefaultButton="WebButtonSearch">
<table class="eight" style="width: 100%">
<tr><td colspan = "8" style="text-align: right;">
<sis:InputLabel ID="lblRunReport" runat="server" Text="Report:" Visible="False" />
<telerik:RadComboBox ID="ddlRunReport" runat="server" Width="160px" Visible="False" AutoPostBack="True" OnSelectedIndexChanged="RadComboBoxReport_SelectedIndexChanged">
<CollapseAnimation Duration="200" Type="OutQuint" />
</telerik:RadComboBox>
</td>
<td>
<sis:WebButton ID="wbtnRunReport" runat="server" CausesValidation="true" ImageUrl="~/App_Themes/LBL/wbtnRunReport.gif"
AutoTipKey="Run Report" UseCssHover="True" OnClick="wbtnRunReport_Click" Visible="False" />
</td></tr>
<tr>
<td class="start">
<sis:InputLabel ID="lblLastName_Search" runat="server" Text="Last Name:" />
</td>
<td class="start data">
<telerik:RadTextBox ID="txtLastName_Search" runat="server">
</telerik:RadTextBox>
</td>
<td class="start">
<sis:InputLabel ID="lblFirstName_Search" runat="server" Text="First Name:" />
</td>
<td class="start data">
<telerik:RadTextBox ID="txtFirstName_Search" runat="server">
</telerik:RadTextBox>
</td>
<td class="start">
<sis:InputLabel ID="lblGrades_Search" runat="server" Text="Grade Level:"></sis:InputLabel>
</td>
<td>
<telerik:RadComboBox ID="lstGrades_Search" runat="server" CheckBoxes="true" EnableCheckAllItemsCheckBox="true" Width ="100px" ></telerik:RadComboBox>
<asp:Literal ID="Literal3" runat="server" />
</td>
<td class="end">
<sis:InputLabel ID="lblTeacherAssigned_Search" runat="server" Text="Teacher Assigned:" />
</td>
<td class="end data">
<telerik:RadComboBox ID="cmbTeacherAssigned_Search" runat="server" Width="75px">
<Items>
<telerik:RadComboBoxItem runat="server" Selected="True" Text=" " />
<telerik:RadComboBoxItem runat="server" Text="Yes" Value="Yes" />
<telerik:RadComboBoxItem runat="server" Text="No" Value="No" />
</Items>
<CollapseAnimation Duration="200" Type="OutQuint" />
</telerik:RadComboBox>
</td>
</table>
<table class="six" style="width: 100%">
<tr>
<td class="start">
<%-- <div id="labelKGCal_Search" runat="server">
<sis:InputLabel ID="lblKGCal_Search" runat="server" Text="KG Calendar:" />
</div>--%>
</td>
<td class="start data">
<%-- <div id="comboKGCal_Search" runat="server" style="width: 301px">
<telerik:RadComboBox ID="cmbKGCal_Search" runat="server" Width="249px" Height="31px">
<CollapseAnimation Duration="200" Type="OutQuint" />
</telerik:RadComboBox>
</div>--%>
</td>
<td class="end">
</td>
<td class="end data">
</td>
</tr>
</table>
<div id="DivAdvancedSearch" class="advancedSearch" runat="server">
<table class="eight" style="width: 100%">
<tr>
<td class="start">
<sis:InputLabel ID="lblCurrentYearTeacher_Search" runat="server" Text="Current Year Teacher/Advisor:"></sis:InputLabel>
</td>
<td>
<telerik:RadComboBox ID="lstCurrentYearTeacher_Search" runat="server" CheckBoxes="true" EnableCheckAllItemsCheckBox="false" Width ="250px" OnClientItemChecking="clientItemCheckingC" ></telerik:RadComboBox>
<asp:Literal ID="Literal1" runat="server" />
</td>
<td class="start">
<sis:InputLabel ID="lblPriorYearTeacher_Search" runat="server" Text="Prior Year Teacher/Advisor:"></sis:InputLabel>
</td>
<td>
<telerik:RadComboBox ID="lstPriorYearTeacher_Search" runat="server" CheckBoxes="true" EnableCheckAllItemsCheckBox="false" Width ="250px" OnClientItemChecking="clientItemCheckingC"></telerik:RadComboBox>
<asp:Literal ID="Literal2" runat="server" />
</td>
<td class="start">
<sis:InputLabel ID="lblGender" runat="server" Text="Gender:"></sis:InputLabel>
</td>
<td class="start data">
<telerik:RadComboBox ID="cmbGender_Search" runat="server" Width="85px">
<Items>
<telerik:RadComboBoxItem runat="server" Selected="True" Text=" " />
<telerik:RadComboBoxItem runat="server" Text="Male" Value="Male" />
<telerik:RadComboBoxItem runat="server" Text="Female" Value="Female" />
</Items>
<CollapseAnimation Duration="200" Type="OutQuint" />
</telerik:RadComboBox>
</td>
<td class="end">
<sis:InputLabel ID="lblRowsToDisplay_Search" runat="server" Text="Rows to Display:" />
</td>
<td class="end data">
<telerik:RadComboBox ID="cmbRowsToDisplay_Search" runat="server" Width="65px">
<Items>
<telerik:RadComboBoxItem runat="server" Text="10" Value="10" />
<telerik:RadComboBoxItem runat="server" Text="20" Value="20" />
<telerik:RadComboBoxItem runat="server" Text="30" Value="30" />
<telerik:RadComboBoxItem runat="server" Text="50" Value="50" />
<telerik:RadComboBoxItem runat="server" Text="100" Value="100" />
</Items>
<CollapseAnimation Duration="200" Type="OutQuint" />
</telerik:RadComboBox>
</td>
</tr>
<tr>
<td class="start">
<sis:InputLabel ID="lblFlags_Search" runat="server" Text="Flags (up to 3):"></sis:InputLabel>
</td>
<td>
<telerik:RadComboBox ID="lstFlags_Search" runat="server" CheckBoxes="true" EnableCheckAllItemsCheckBox="false" Width ="250px" OnClientItemChecking="clientItemChecking"></telerik:RadComboBox>
<asp:Literal ID="itemsClientSide" runat="server" />
</td>
<td class="start">
<sis:InputLabel ID="lblIncludeFlag_Search" runat="server" Text="Include Flag:"></sis:InputLabel>
</td>
<td class="start data">
<telerik:RadComboBox ID="cmbIncludeFlag_Search" runat="server" Width="85px">
<Items>
<telerik:RadComboBoxItem runat="server" Selected="True" Text=" " />
<telerik:RadComboBoxItem runat="server" Text="All Flags" Value="A" />
<telerik:RadComboBoxItem runat="server" Text="One or more" Value="O" />
<telerik:RadComboBoxItem runat="server" Text="None of These" Value="N" />
</Items>
<CollapseAnimation Duration="200" Type="OutQuint" />
</telerik:RadComboBox>
</td>
<td class="start">
<sis:InputLabel ID="InputLabelCY" runat="server" Text="Cohort Year:" />
</td>
<td class="start data" align="left" style="width: 138px">
<telerik:RadComboBox ID="RadComboBoxCY_Search" runat="server" TabIndex="4" Width="100px">
<CollapseAnimation Duration="200" Type="OutQuint" />
</telerik:RadComboBox>
</td>
<td class="end">
</td>
<td class="end data">
</td>
</tr>
</table>
<table style="width: 100%" class="six">
<tr>
<td style="width: 121px" class="start" valign="top">
<sis:InputLabel ID="lblDOBFrom_Search" runat="server" Text="DOB Range - From:"></sis:InputLabel>
</td>
<td style="width: 99px" class="start data" valign="top">
<telerik:RadDatePicker ID="dateDOBFrom_Search" runat="server" Width="100px">
<DateInput InvalidStyleDuration="100">
</DateInput>
</telerik:RadDatePicker>
</td>
<td align="right" style="width: 37px" class="start" valign="top">
<sis:InputLabel ID="lblDOBTo_Search" runat="server" Text="To:"></sis:InputLabel>
</td>
<td align="left" style="width: 113px" class="start data" valign="top">
<telerik:RadDatePicker ID="dateDOBTo_Search" runat="server" Width="100px">
<DateInput InvalidStyleDuration="100">
</DateInput>
</telerik:RadDatePicker>
</td>
<td>
</td>
</tr>
</table>
</div>
<table class="eight" style="width: 100%">
<tr>
<td>
<sis:WebButton ID="WebButtonSearch" runat="server" UseCssHover="true" ImageUrl="~/App_Themes/LBL/wbtnSearch.gif"
AutoTipKey="Search" OnClick="WebButtonSearch_Click" AllowLoadBox="True" />
<sis:WebButton ID="WebButtonReset" runat="server" UseCssHover="true" ImageUrl="~/App_Themes/LBL/wbtnReset.gif"
AutoTipKey="Reset" OnClick="WebButtonReset_Click" />
</td>
</tr>
</table>
<asp:Label ID="lblReturnExceedMax" runat="server" CssClass="ListPageStatus"></asp:Label>
</asp:Panel>
<asp:HiddenField ID="HiddenFieldAdvanced" runat="server" />
<br />
<div class="hr">
<hr />
</div>
<table style="width: 100%">
<tr>
<td align="left" style="width: 90px">
<div id="totals" class="padded header" style="width: 93px">
Students
</div>
</td>
<td align="left">
<sis:WebButton ID="WebButtonTotals" runat="server" ImageUrl="~/App_Themes/LBL/wbtnViewTotals.gif"
AutoTipKey="View totals" OnClick="WebButtonTotals_Click" UseCssHover="true" />
</td>
<td><sis:WebButton ID="WebButtonVerify" runat="server"
ImageUrl="~/App_Themes/LBL/wbtnVerify.gif" AutoTipKey="Verify" onclick="WebButtonVerify_Click"
UseCssHover="True" AlertEnabled="True" AlertIcon="Question"
AlertText="You have requested to verify Teacher/Advisor assignments. Would you like to continue?"
AlertTitle="Verify" /></td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
<telerik:RadGrid ID="grdResults" runat="server" AutoGenerateColumns="False"
AllowCustomPaging="True" AllowPaging="True" OnNeedDataSource="grdResults_NeedDataSource"
OnItemDataBound="grdResults_ItemDataBound" OnItemEvent="grdResults_ItemEvent"
VirtualItemCount="999999" GroupingEnabled="False" >
<ExportSettings>
<Pdf PaperSize="Letter" FontType="Subset"></Pdf>
<Csv RowDelimiter="NewLine" ColumnDelimiter="Comma"></Csv>
</ExportSettings>
<MasterTableView CurrentResetPageIndexAction="SetPageIndexToFirst" Dir="LTR" Frame="Border"
TableLayout="Auto" CommandItemDisplay="None" DataKeyNames="RecordNumber" VirtualItemCount="999999"
AllowCustomPaging="true" EditMode="InPlace" PagerStyle-Position="TopAndBottom">
<RowIndicatorColumn CurrentFilterFunction="NoFilter" FilterListOptions="VaryByDataType"
Visible="False">
<HeaderStyle Width="20px"></HeaderStyle>
</RowIndicatorColumn>
<ExpandCollapseColumn CurrentFilterFunction="NoFilter" FilterListOptions="VaryByDataType"
Visible="False" Resizable="False">
<HeaderStyle Width="20px"></HeaderStyle>
</ExpandCollapseColumn>
<Columns>
<telerik:GridBoundColumn DataField="StudentName.FullName" CurrentFilterFunction="NoFilter"
HeaderText="Preferred Name" UniqueName="Name" ReadOnly="true">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Grade" CurrentFilterFunction="NoFilter" HeaderText="Grade"
ReadOnly="true">
<HeaderStyle HorizontalAlign="Center" />
<ItemStyle HorizontalAlign="Center" />
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="KindergartenCalendar" UniqueName="KGCal" CurrentFilterFunction="NoFilter"
HeaderText="KG Calendar" Display="False" ReadOnly="true">
</telerik:GridBoundColumn>
<telerik:GridTemplateColumn HeaderText="Current Year Teacher/Advisor" UniqueName="CurrentTchrID"
DataField="CurrentTeacherID" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center">
<ItemTemplate>
<telerik:RadComboBox ID="RadComboBoxTeacher" runat="server" Height="350px">
</telerik:RadComboBox>
</ItemTemplate>
<HeaderStyle HorizontalAlign="Center" />
<ItemStyle HorizontalAlign="Center" />
</telerik:GridTemplateColumn>
<telerik:GridBoundColumn DataField="NextTeacherID" UniqueName="NextTchrID" CurrentFilterFunction="NoFilter"
HeaderText="Prior Year Teacher/Advisor" ReadOnly="true">
</telerik:GridBoundColumn>
</Columns>
<EditFormSettings>
<EditColumn CurrentFilterFunction="NoFilter" FilterListOptions="VaryByDataType">
</EditColumn>
<PopUpSettings ScrollBars="None" />
</EditFormSettings>
<NoRecordsTemplate>
No Records Returned
</NoRecordsTemplate>
<PagerStyle Position="TopAndBottom" />
</MasterTableView>
<SortingSettings EnableSkinSortStyles="False" />
<ClientSettings AllowColumnsReorder="true" ReorderColumnsOnClient="true" ColumnsReorderMethod="Reorder" Resizing-ShowRowIndicatorColumn="False">
<Resizing ResizeGridOnColumnResize="True"
AllowColumnResize="True"></Resizing>
</ClientSettings>
</telerik:RadGrid>
<uc1:ActionBar ID="ActionBarBottom" runat="server" CancelVisible="True" ExportVisible="True"
SaveVisible="True" Text="Assign Teacher/Advisor" HelpVisible="True" ExportURL="~/DataExport.aspx?frm=AssignTeacherAdvisor2"
OnSaveClick="ActionBar_SaveClick" OnCancelClick="ActionBar_CancelClick" />
</telerik:RadAjaxPanel>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolderFooter" runat="Server">
</asp:Content>
I used an input text, upload file and command button properties.My File upload mode is basic.In command button i made ajax=false.I used required=true in both the fields.While clicking save with empty fields, corresponding method is executing and message is displaying in console, but error message is not displaying in UI.
<p:dialog widgetVar="addDialogWidgetVar" id="addDialogWidgetVarId" dynamic="true" >
<table style="width: 100%;">
<tr>
<td>
<p:messages for="errorMsgId" id="errorMsgId" autoUpdate="true" showDetail="false" showSummary="true" closable="true"/>
</td>
</tr>
</table>
<h:form id="formId" enctype="multipart/form-data">
<table>
<tr>
<td>
<label style="margin-top: 5%"><h:outputText value="Name:"/><h:outputText value="*" style="color:red"/></label>
</td>
<td width="10%"/>
<td>
<p:inputText value="#{manageBean.attachment.fileName}" id="fileNameId" maxlength="60" style="width:70"
required="#{not empty param[save.clientId]}" requiredMessage="Please enter Attachment name"></p:inputText>
</td>
</tr>
<tr height="10"></tr>
<tr>
<td>
<label style="margin-top: 5%"><h:outputText value="Upload Attachment:"/><h:outputText value="*" style="color:red"/></label>
</td>
<td width="10%"/>
<td>
<p:fileUpload label="Select a file" mode="simple" value="#{manageBean.attachment.file}"
allowTypes="/(\.|\/)(pdf|doc|docx|xls|xlsx|gif|jpg|jpeg|png|PNG|GIF|JPG|JPEG)$/"
invalidFileMessage="Allow only (pdf|doc|docx|xls|xlsx|gif|jpg|jpeg|png|PNG|GIF|JPG|JPEG) file."
multiple="false" required="#{not empty param[save.clientId]}" requiredMessage="Please select a file" >
</p:fileUpload>
</td>
</tr>
</table>
<br />
<table style="margin-left: 30%;">
<tr align="center">
<td>
<p:commandButton value="Close" actionListener="#{manageBean.cancelAttachment}" oncomplete="addDialogWidgetVar.hide()" />
</td>
<td>
<p:commandButton id="submitbtnid" value="Save" ajax="false" binding="#{save}"
actionListener="#{manageBean.saveAttachment}" update=":errorMsgId"/>
</td>
</tr>
</table>
</h:form>
</p:dialog>
Try do submit without ajax for test, and also put p:growl in the page, try get messages without update messages component and find bug.
Am using a datalist to show the product details. In this time i want to show the image, but it displayed when the image filed having the image path, otherwise it's empty. I want to show the dummy image when the field is empty..
Here is my code:
<asp:DataList ID="DataList1" CaptionAlign="Right" runat="server" Width="100%" Visible="true" >
<ItemTemplate>
<table width="100%" border="0" cellspacing="5" cellpadding="0">
<tr>
<td width="2%">
</td>
<td>
<div class="Curved_box">
<div class="curved_Top">
<div class="curved_TopLft">
</div>
<div class="curved_TopRft">
</div>
</div>
<div class="CurvedContent">
<a href="#">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td style="width: 14px; height: 65px;">
</td>
<td style="width: 113px; height: 65px;">
<asp:Image ID="Image1" Style="border: solid 1px #eaeaea; background: " runat="server"
Height="60px" Width="60px" ImageUrl='<%#Bind("fldpic") %>' />
</td>
<td width="80%" align="right" style="height: 65px">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="2" style="height: 20px" align="left">
<asp:Label ID="lbl_name" runat="server" Font-Bold="true" Text='<%#Bind("name") %>'></asp:Label>
</td>
</tr>
<tr>
<td style="width: 247px; height: 20px;" align="left">
<asp:Label ID="lblProd_Keywd" runat="server" Text='<%# Bind("Desig") %>' Font-Bold="True"></asp:Label>
</td>
<td align="left" style="height: 20px">
<asp:Label ID="lblProd_Code" runat="server" Text='<%# Bind("fldempid") %>'
Font-Bold="True"></asp:Label>
</td>
</tr>
<tr>
</tr>
</table>
</td>
</tr>
</table>
</a>
</div>
<div class="curved_Btm">
<div class="curved_BtmLft">
</div>
<div class="curved_BtmRft">
</div>
</div>
</div>
</td>
<td width="2%">
</td>
</tr>
</table>
</ItemTemplate>
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#507CD1" Font-Bold="True" HorizontalAlign="Left" ForeColor="White" />
</asp:DataList>
add onerror attribute on <asp:Image> tag like onerror="this.src = 'url of dummy image'"
change this mark up
<asp:Image ID="Image1" Style="border: solid 1px #eaeaea; background: "
runat="server" Height="60px" Width="60px" ImageUrl='<%#Bind("fldpic") %>' />
to
<asp:Image ID="Image1" Style="border: solid 1px #eaeaea; background: "
runat="server" Height="60px" Width="60px" ImageUrl='<%#Bind("fldpic") %>'
onerror="this.src = 'url of dummy image'" />
I have jsp using struts bean tag library:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
<link rel="stylesheet" type="text/css" href="css/stylesheet.css">
</head>
<body>
<p><a class="colorGrey" href="Welcome.do">
<bean:message key="menu.label" />
</a> >><bean:message key="menu.link.addnews" /> </p>
<p><br>
</p>
<html:form action="/NewsSave">
<table width="100%" border="0">
<tr>
<td class="colorGrey" width="164" height="35">
<bean:message key="body.news.title" /> </td>
<td width="577">
<html:text property="newsTitle" size="40" value=""/> </td>
</tr>
<tr>
<td colspan="2">
<html:errors property="newstitle" />
</td>
</tr>
<tr>
<td class="colorGrey">
<bean:message key="body.news.date" /> </td>
<td>
<html:text property="newsDate" size="10" value=""/> </td>
</tr>
<tr>
<td height="21" colspan="2" valign="top">
<html:errors property="newsdate" />
</td>
</tr>
<tr>
<td class="colorGrey" height="61" valign="top">
<bean:message key="body.news.brief" /> </td>
<td valign="top">
<html:textarea property="brief" cols="40" rows="6" value=""/>
</td>
</tr>
<tr>
<td height="23" colspan="2" valign="top"><html:errors property="brief" /></td>
</tr>
<tr>
<td class="colorGrey" height="100" valign="top">
<bean:message key="body.news.content" />
</td>
<td valign="top">
<html:textarea property="content" cols="40" rows="12" value=""/>
</td>
</tr>
<tr>
<td height="23" colspan="2" valign="top">
<html:errors property="content" />
</td>
</tr>
</table>
<html:submit value="SAVE"/>
</html:form>
<form method="POST"
action="Link.do?method=newsList"
onsubmit="return confirm('<bean:message key="body.onsubmit.cancel" />')">
<input type="submit" value="CANCEL">
</form>
And I use validator plugin, which means that after receiving incorrect info it gives message bellow text field telling what's wrong. But problem is that everything disappear after submiting. So it no info in text or text-areatags. I know that it happens because of value="". But I have another page with the same fields for adding info, which should be clear from the beginning. And if I remove value="", the info from this fields will be displayed on that page after forwarding. So
What should I do to clear info from forms after forwarding to
another page?
How to make info remain after success validation?
As you mentioned, you should remove value="" as this is setting the fields to empty. If you want to clear the values then you should do this in the Action class in which your Form bean is populated.
If you are finding that your Form beans are retaining their values between requests then check that they are request scope: the scope attribute of the action element should be "request" in struts.config