Here is the problem im having. I have 5 buttons on my form that appear next to each other (horizontal). 3 out of the 5 buttons had to be put in an update panel b/c these buttons have to do AsyncPostBack, the other 2 buttons need to be outside to do a postback. Everything works the way I would like accept that all the buttons dont appear on the same line. Is there anything I can do put get these 5 buttons to appear on the same line, given the different functionality of these buttons?
The UpdatePanel renders a <div> you need to style this div so that that it displays inline Notice the Style="display:inline" in the following code. There's other ways to accomplish this depending on your layout but this is the most straightforward.
<asp:UpdatePanel ID="UpdatePanel1" runat="server" Style="display:inline">
<ContentTemplate>
<asp:Label ID="labelText" runat="server" Text="Label" />
<asp:Button ID="Button1" runat="server" Text="Button1" />
<asp:Button ID="Button2" runat="server" Text="Button2" />
<asp:Button ID="Button3" runat="server" Text="Button3" />
</ContentTemplate>
</asp:UpdatePanel>
<asp:Button ID="Button4" runat="server" Text="Button4" />
<asp:Button ID="Button5" runat="server" Text="Button5" />
You don't have to have your buttons inside the UpdatePanel to make this work. You would simply need to define them as AsyncPostBackTriggers. You don't have to worry about breaking your layout then.
<div class="toolbar">
<asp:Button ID="Button1" runat="server" Text="Button1" />
<asp:Button ID="Button2" runat="server" Text="Button2" />
<asp:Button ID="Button3" runat="server" Text="Button3" />
</div>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Label ID="labelText" runat="server" Text="Label" />
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Button1" EventName="Click" />
<asp:AsyncPostBackTrigger ControlID="Button2" EventName="Click" />
<asp:AsyncPostBackTrigger ControlID="Button3" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
Related
I have a page that shows a ckeditor in an update panel. My page is as follows:
<form id="form1" runat="server">
<cc1:ToolkitScriptManager runat="server" ID="ToolkitScriptManager" EnablePartialRendering="true"></cc1:ToolkitScriptManager>
<div>
<asp:Label ID="Label1" runat="server" Text="Hello"></asp:Label><br />
<br />
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<script src="../../../../../ckeditor/ckeditor.js" type="text/javascript"></script>
<asp:TextBox class="ckeditor" ID="tbEditorHeader" runat="server" ClientIDMode="Static" TextMode="MultiLine" Columns="80" Rows="4"></asp:TextBox>
<asp:Button ID="Button1" runat="server" Text="Button" />
</ContentTemplate>
</asp:UpdatePanel>
</div>
</form>
Has anyone seen this issue? Any known solutions?
Thanks for the help!!
<ajaxToolkit:Accordion ID="Accordion1" CssClass="accordion" SelectedIndex="0" HeaderCssClass="accordionHeader" HeaderSelectedCssClass="accordionHeaderSelected" AutoSize="None" RequireOpenedPane="false" ContentCssClass="accordionContent" runat="server">
<Panes>
<ajaxToolkit:AccordionPane ID="Pane1" runat="server">
<Header><b>Panel 1</b></Header>
<Content>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<br>
Age: <asp:textbox id="Age1" runat="server" Width="35" Font-Bold="True"/><br>
Attorney: <asp:CheckBox ID="Attorney" runat="server" /><br>
<asp:button ID="Button1" text="Submit" OnClick="Button1_Click"
runat="server"/><br>
<asp:label id="Message1" runat="server" ForeColor="White" Font-Size="Small" Font-Bold="True"/>
</ContentTemplate>
</asp:UpdatePanel>
</Content>
</ajaxToolkit:AccordionPane>
<ajaxToolkit:AccordionPane ID="Pane2" runat="server">
<Header><b>Panel 2</b></Header>
<Content>
<asp:UpdatePanel ID="UpdatePanel2" runat="server">
<ContentTemplate>
<br>
<asp:textbox id="Age2" runat="server" Width="35" Font-Bold="True"/><br>
<asp:button ID="Button2" text="Submit" onclick="Button2_Click"
runat="server"/><br><br>
<asp:label id="Message2" runat="server" ForeColor="White" Font-Size="Small" Font-Bold="True" />
</ContentTemplate>
</asp:UpdatePanel>
</Content>
</ajaxToolkit:AccordionPane>
</Panes>
protected void Button1_Click(object sender, EventArgs e) {
if (Attorney.Checked) {
Pane2.Visible = true;
} else {
Pane2.Visible = false;
}
//Message1.Text = Age1.Text;
}
I have five Accordion Panels. Last Panel should be displayed only if a checkbox is checked in the first panel. Inside each Accordion Panel I have a UpdatePanel and within that I have ContentTemplate with controls and submit button particular to that accordion panel. The reason I added UpdatePanel is so that when i update a particular panel it does not affect other accordion panels.
The problem is I need to toggle last accordion panel display depending upon if a checkbox is checked in the first Panel and submit button is clicked. In Code behind, in the btnSubmit1 event...I have code that says if checkbox is checked....Pane2.Visible = true else Pane2.Visible=false. For some reasons it still shows the LastPanel.
I am not sure where am I going wrong...please advise!
Thanks!
Jini
I fixed the problem by adding an outer update panel...and removed the updatepanel for Panel 2. Haven't tested it thoroughly but so far looks good.
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
<asp:UpdatePanel ID="OuterPanel" UpdateMode="Always" ChildrenAsTriggers="true" runat="server">
<ContentTemplate>
<ajaxToolkit:Accordion ID="Accordion1" CssClass="accordion" SelectedIndex="0" HeaderCssClass="accordionHeader"
HeaderSelectedCssClass="accordionHeaderSelected" AutoSize="None" RequireOpenedPane="false" ContentCssClass="accordionContent" runat="server">
<Panes>
<ajaxToolkit:AccordionPane ID="Pane1" runat="server">
<Header><b>Panel 1</b></Header>
<Content>
<br>
Age: <asp:textbox id="Age1" runat="server" Width="35" Font-Bold="True" /><br />
Attorney: <asp:CheckBox ID="Attorney" runat="server" /><br>
<asp:button ID="Button1" text="Submit" OnClick="Button1_Click"
runat="server"/><br>
<asp:label id="Message1" runat="server" ForeColor="White" Font-Size="Small" Font-Bold="True"/>
</Content>
</ajaxToolkit:AccordionPane>
<ajaxToolkit:AccordionPane ID="Pane2" runat="server">
<Header><b>Panel 2</b></Header>
<Content>
<br>
<asp:textbox id="Age2" runat="server" Width="35" Font-Bold="True"/>
<asp:button ID="Button2" text="Submit" onclick="Button2_Click"
runat="server"/><br><br>
<asp:label id="Message2" runat="server" ForeColor="White" Font-Size="Small" Font-Bold="True" />
</Content>
</ajaxToolkit:AccordionPane>
</Panes>
</ajaxToolkit:Accordion>
</ContentTemplate>
I'd like to see your code to be sure, but I'm expecting it's because you have an UpdatePanel in each of the AccordionPanels. Once an event happens in one UpdatePanel, ASP.NET will not run code handling that event that is attached to another UpdatePanel.
First, I'd take out all UpdatePanels to see if your code works as expected. Then, I'd add one UpdatePanel wrapped around the entire Accordion and see if your code still works.
If you really decided you need to have 5 UpdatePanels, look into the <Triggers> portion of the UpdatePanel. You'll be able to provide the CheckBox's ID to force the other associated UpdatePanel to PostBack.
I'm working on a project with multiple RadGrids and RadHtmlCharts, and the page is laid out with two RadSplitters. The top splitter contains two RadGrids, the bottom splitter contains three RadHtmlCharts.
Code below (code not relevant to the question removed for cleaner reading):
<telerik:RadAjaxManagerProxy ID="AjaxManager1" runat="server">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="Tasks">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="InterviewProgressPieChartErrorMessage" />
<telerik:AjaxUpdatedControl ControlID="InterviewProgressPanePieChart" />
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManagerProxy>
<telerik:RadSplitter ID="GridStorageSplitter" runat="server" Orientation="Vertical" Width="920" LiveResize="false" CssClass="radSplitter" BorderStyle="None" BorderSize="0">
<telerik:RadPane ID="NotificationsPane" runat="server" CssClass="gridpaneleft" MinWidth="250">
<telerik:RadGrid ID="Notifications" runat="server" AllowSorting="True" CellSpacing="0" DataSourceID="EventLog" AutoGenerateColumns="False" GridLines="None" CssClass="gridgrid">
</telerik:RadGrid>
</telerik:RadPane>
<telerik:RadSplitBar ID="GridSplitter" runat="server">
<AdjacentPanesNames LeftPaneName="NotificationsPane" RightPaneName="TasksPane" />
</telerik:RadSplitBar>
<telerik:RadPane ID="TasksPane" runat="server" CssClass="gridpaneright" MinWidth="400">
<telerik:RadGrid ID="Tasks" DataSourceID="JobsInfo" runat="server" AutoGenerateColumns="False" CellSpacing="0" GridLines="None" CssClass="gridgrid">
<ClientSettings EnablePostBackOnRowClick="true">
<Selecting AllowRowSelect="true" EnableDragToSelectRows ="false"/>
<Scrolling AllowScroll="True" UseStaticHeaders="True" />
</ClientSettings>
<MasterTableView DataSourceID="JobsInfo" AllowMultiColumnSorting="True" HierarchyLoadMode="Client" ShowHeader="false">
</MasterTableView>
</telerik:RadGrid>
</telerik:RadPane>
</telerik:RadSplitter>
<telerik:RadSplitter ID="GraphStorageSplitter" runat="server" Orientation="Vertical" Width="920" Height="400" LiveResize="false" CssClass="radSplitter" BorderStyle="None" BorderSize="0">
<telerik:RadPane ID="JobNumbersPane" runat="server" Width="70" MinWidth="60">
<asp:Table ID="JobNumbersTable" runat="server" CssClass="topmargin7"></asp:Table>
</telerik:RadPane>
<telerik:RadSplitBar ID="GraphSplitter1" runat="server">
<AdjacentPanesNames LeftPaneName="JobNumbersPane" RightPaneName="InterviewStartTimesGraphPane" />
</telerik:RadSplitBar>
<telerik:RadPane ID="InterviewStartTimesGraphPane" runat="server" Width="30%" MinWidth="280">
<telerik:RadHtmlChart ID="interviewStartTimes" runat="server" Legend-Appearance-Visible="false"></telerik:RadHtmlChart>
</telerik:RadPane>
<telerik:RadSplitBar ID="GraphSplitter2" runat="server">
<AdjacentPanesNames LeftPaneName="InterviewStartTimesGraphPane" RightPaneName="ReferralsChartPane" />
</telerik:RadSplitBar>
<telerik:RadPane ID="ReferralsChartPane" runat="server" Width="30%" MinWidth="200">
<telerik:RadHtmlChart ID="referralsChart" runat="server" OnLoad="referralsChart_Load"></telerik:RadHtmlChart>
</telerik:RadPane>
<telerik:RadSplitBar ID="GraphSplitter3" runat="server">
<AdjacentPanesNames LeftPaneName="ReferralsChartPane" RightPaneName="InterviewProgressPane" />
</telerik:RadSplitBar>
<telerik:RadPane ID="InterviewProgressPane" runat="server" Width="30%" MinWidth="200">
<asp:Label ID="InterviewProgressPieChartErrorMessage" runat="server" Text="No Interviews have been sent out for the selected job." Visible="false"></asp:Label>
<telerik:RadHtmlChart runat="server" ID="InterviewProgressPieChart" Visible="true" OnLoad="loadInterviewProgressPieChart">
</telerik:RadHtmlChart>
</telerik:RadPane>
</telerik:RadSplitter>
I'm trying to add functionality to the page to load InterviewProgressPieChart with relevant data when the user clicks on a row in the Tasks RadGrid. It works, but the post back reloads the entire page (including the master page), which I would like to avoid.
I have also tried using RadAjaxManager, but it still reloads the entire page on post back (by design, it seems).
Wrapping the RadSplitters in a RadAjaxPanel allows me to only load the contents of that panel on post back, but you can't put a RadAjaxPanel within a RadSplitter, and I don't know how to put only the relevant Grid/Chart in the AjaxPanel.
You need a setting whose initiator (AjaxControlID) is the grid (Notifications) and in the updated controls you have the InterviewProgressPieChart chart:
<telerik:AjaxSetting AjaxControlID="Notifications">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="InterviewProgressPieChart" />
</UpdatedControls>
</telerik:AjaxSetting>
That is, assuming your grid posts the page automatically on row click.
I'm using visualStudio 2010 vb
I have a UpdateProcess inside a TabContainer which I can not manage to make it show a loading image. I've added below the example code. I'm I missing something to make it show?
<asp:TabContainer ID="TabSelection" runat="server" ActiveTabIndex="0"
Width="1126px" Font-Bold="True" TabStripPlacement="Top"
style="margin-right: 34px; margin-top: 49px;" AutoPostBack="True">
<asp:TabPanel runat="server" HeaderText="Scorecard3" ID="TabScorecard3">
<HeaderTemplate>
Scorecard
</HeaderTemplate>
<ContentTemplate>
<asp:UpdateProgress ID="UProc_Scorecard" runat="server" AssociatedUpdatePanelID="UP_Scorecard"
DisplayAfter="1">
<ProgressTemplate>
<asp:Image id="wait" runat="server" ImageUrl="~/Images/wait3.gif" />
</ProgressTemplate>
</asp:UpdateProgress>
<asp:UpdatePanel ID="UP_Scorecard" runat="server">
<ContentTemplate>
… 3 Grids and 3 tables …
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="DateSelection"
EventName="SelectedIndexChanged"/>
<asp:AsyncPostBackTrigger ControlID="GroupSelection"
EventName="SelectedIndexChanged"/>
</Triggers>
</asp:UpdatePanel>
</ContentTemplate>
</asp:TabPanel>
</asp:TabContainer>
Thanks
I've solved the problem by moving the UpdateProgress and the updatePannel outside the TabContainer also I removed the autopostback in the tabcontainer to prevent a postback each time a tab was selected. I hope this helps someone. Example code below...
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</asp:ToolkitScriptManager>
<asp:UpdateProgress ID="UProc_TabContainer" runat="server" AssociatedUpdatePanelID="UP_TabContainer"
DisplayAfter="1">
<ProgressTemplate>
<div id="dvProgress" runat="server" style="position: absolute; top: 300px; left: 450px;
text-align: center;">
<asp:Image ID="wait" runat="server" ImageUrl="~/Images/wait3.gif" Height="120px"
Width="128px" />
</div>
</ProgressTemplate>
</asp:UpdateProgress>
<asp:UpdatePanel ID="UP_TabContainer" runat="server">
<ContentTemplate>
<asp:Panel ID="Panel1" runat="server" BackColor="#66FFFF">
<asp:DropDownList ID="DateSelection" runat="server" AutoPostBack="True" Height="21px"
Width="134px">
</asp:DropDownList>
<asp:DropDownList ID="GroupSelection" runat="server" AutoPostBack="True" Height="21px"
Width="134px" >
</asp:DropDownList>
</asp:Panel>
<asp:TabContainer ID="TabSelection" runat="server" ActiveTabIndex="0" Width="1126px"
Font-Bold="True" TabStripPlacement="Top"
Style="margin-right: 34px; margin-top: 49px;">
<%-- AutoPostBack="True"--%>
<asp:TabPanel runat="server" HeaderText="Scorecard3" ID="TabScorecard3">
<HeaderTemplate>
Scorecard
</HeaderTemplate>
<ContentTemplate>
… grids and charts …
</ContentTemplate>
</asp:TabPanel>
<asp:TabPanel runat="server" HeaderText="Documentation" ID="TabInfo">
<ContentTemplate>
… documentation …
</ContentTemplate>
</asp:TabPanel>
<asp:TabPanel ID="Project" runat="server" HeaderText="Project">
<ContentTemplate>
… documentation…
</ContentTemplate>
</asp:TabPanel>
</asp:TabContainer>
</ContentTemplate>
</asp:UpdatePanel>
The ASP.NET validation does not seem to work inside ASP:FormView. Can someone let me know what I'm doing wrong? Thank you.
Here is the code.
<asp:ValidationSummary ID="ValidationSummary1" runat="server" ValidationGroup="ValidationSummary1" />
<asp:FormView ID="fv_LeaveRequest" runat="server" DataKeyNames="REQ_ACTION_ID">
<InsertItemTemplate>
<label>Leave Type</label>
<asp:DropDownList ID="ddl_LeaveType" runat="server">
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="This field is required" ValidationGroup="ValidationSummary1" Text="Required" ControlToValidate="ddl_LeaveType"></asp:RequiredFieldValidator>
<asp:Button ID="LeaveReqBtn" runat="server" Text="Submit Leave Request" CommandName="CustomInsert"
CssClass="button-position" ValidationGroup="ValidationSummary1" CausesValidation="true" />
</InsertItemTemplate>
<ItemTemplate>
<asp:LinkButton ID="Edit" runat="server" Text="Edit / Change Request" CommandName="Edit" CssClass="button-position btn-padding" ValidationGroup="ValidationSummary1" />
<label>
Leave Type</label>
<asp:DropDownList ID="ddl_LeaveType" runat="server">
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="This field is required"
ValidationGroup="ValidationSummary1" Text="Required" ControlToValidate="ddl_LeaveType"></asp:RequiredFieldValidator>
</ItemTemplate>
<EditItemTemplate>
<asp:LinkButton ID="Cancel" Text="Cancel" CommandName="Cancel" runat="server" CssClass="button-position btn-padding"
ValidationGroup="ValidationSummary1" />
<label>
Leave Type</label>
<asp:DropDownList ID="ddl_LeaveType" runat="server">
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="This field is required"
ValidationGroup="ValidationSummary1" Text="Required" ControlToValidate="ddl_LeaveType"></asp:RequiredFieldValidator>
</EditItemTemplate>
</asp:FormView>
You need to add one attribute for Initial Value to your RequiredFieldValidators. When you're using a RequiredFieldValidator with a DropDownList, you need to add InitialValue="0".