I have a user control which I am adding to my page at the runtime.
This controls has a Telerik dropdown which does the async PostBack using RadAjaxPanel.
Now to successfully make the dropdown postback work I need to add the control to the page on every post back.
The issue is along with this control, I am adding many other controls based on SQL query in a single function.
And all the controls do query the database to get their data which puts load on the server as well.
So I need to know is there any better way of just doing post back and refresh on the one control which I want to on async post back from the dropdown list.
And somehow avoid adding the all other controls again and again.
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"> <AjaxSettings> <telerik:AjaxSetting AjaxControlID="rgrAnalisi"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="rgrAnalisi" LoadingPanelID="RadAjaxLoadingPanel1" /> </UpdatedControls> </telerik:AjaxSetting> </AjaxSettings> </telerik:RadAjaxManager> <telerik:RadWindowManager ID="RadWindowManager1" runat="server" EnableViewState="False"> </telerik:RadWindowManager> <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Default"> </telerik:RadAjaxLoadingPanel> <telerik:RadCodeBlock ID="RadCodeBlock2" runat="server"> <script type="text/javascript"> <!-- function gridCommand(sender, args) { if (args.get_commandName() == "Rapportino" || args.get_commandName() == "DownloadAttachment") { var manager = $find('<%= RadAjaxManager.GetCurrent(Page).ClientID %>'); manager.set_enableAJAX(false); setTimeout(function () { manager.set_enableAJAX(true); }, 0); } } function conditionalPostback(sender, eventArgs) { var theRegexp = new RegExp("\.UpdateButton$|\.PerformInsertButton$", "ig"); var eventArgument = eventArgs.get_eventArgument(); if (eventArgument.indexOf("Update") > -1 || eventArgument.indexOf("PerformInsert") > -1) { if (upload && upload.getFileInputs()[0].value != "") { eventArgs.set_enableAjax(false); } } } --> </script> </telerik:RadCodeBlock> <telerik:RadGrid runat="server" ID="rgrAnalisi" Skin="Vista" AllowPaging="True" AllowSorting="True" GridLines="None" PageSize="12" style="margin-top: 100px; margin-left:27px;" Width="900px" ShowGroupPanel="True" ondetailtabledatabind="rgrAnalisi_DetailTableDataBind" oncolumncreated="rgrAnalisi_ColumnCreated" onitemdatabound="rgrAnalisi_ItemDataBound" onitemcommand="rgrAnalisi_ItemCommand"> <GroupingSettings CaseSensitive="false" /> <PagerStyle Mode="NumericPages"/> <ClientSettings> <Selecting AllowRowSelect="true"/> <ClientEvents OnCommand="gridCommand" /> </ClientSettings> <MasterTableView ShowHeadersWhenNoRecords="true" > <DetailTables> <telerik:GridTableView Name="Customer" Width="100%"> <Columns> <telerik:GridBoundColumn UniqueName="colCustomer" HeaderText="Cliente" Visible="false"> </telerik:GridBoundColumn> <telerik:GridBoundColumn UniqueName="colComm" HeaderText="Commessa" Visible="false"> </telerik:GridBoundColumn> </Columns> <DetailTables> <telerik:GridTableView Name="Commesse" Width="100%"> <Columns> <telerik:GridBoundColumn UniqueName="colCustomer" HeaderText="Cliente" Visible="false"> </telerik:GridBoundColumn> <telerik:GridBoundColumn UniqueName="colComm" HeaderText="Commessa" Visible="false"> </telerik:GridBoundColumn> </Columns> <DetailTables> <telerik:GridTableView Name="Rapportini" Width="100%"> <Columns> <telerik:GridBoundColumn UniqueName="colCustomer" HeaderText="Cliente" Visible="false"> </telerik:GridBoundColumn> <telerik:GridBoundColumn UniqueName="colComm" HeaderText="Commessa" Visible="false"> </telerik:GridBoundColumn> <telerik:GridTemplateColumn UniqueName="colView" ItemStyle-HorizontalAlign="Center" AllowFiltering="false"> <ItemTemplate> <asp:Image runat="server" ID="linkView" ImageUrl="~/images/Zoom.png"> </asp:Image> <telerik:RadToolTip runat="server" Width="300" Height="300" RenderInPageRoot="true" ShowEvent="OnMouseOver" HideEvent="ManualClose" HideDelay="2" ID="Tooltip" Position="TopRight" Animation="Resize" RelativeTo="Element" > </telerik:RadToolTip> </ItemTemplate> </telerik:GridTemplateColumn> <telerik:GridTemplateColumn UniqueName="colView" ItemStyle-HorizontalAlign="Center" AllowFiltering="false"> <ItemTemplate> <asp:LinkButton runat="server" ID="linkRappo" Text="Rapportino" CommandName="Rapportino"> </asp:LinkButton> </ItemTemplate> </telerik:GridTemplateColumn> </Columns> </telerik:GridTableView> </DetailTables> </telerik:GridTableView> </DetailTables> </telerik:GridTableView> </DetailTables> <Columns> <telerik:GridBoundColumn UniqueName="colMese" Visible="false"> </telerik:GridBoundColumn> <telerik:GridBoundColumn UniqueName="colEseguite" Visible="false"> </telerik:GridBoundColumn> <telerik:GridBoundColumn UniqueName="colAddebitare" Visible="false"> </telerik:GridBoundColumn> </Columns> </MasterTableView> </telerik:RadGrid>protected void rgrAnalisi_ItemCommand(object source, GridCommandEventArgs e) { if (e.CommandName == "Rapportino") { GridDataItem item = e.Item as GridDataItem; short Year = short.Parse(txtYear.Text); ; int Number = int.Parse(item["NumeroRappo"].Text); Session.Add("RappoYear", Year); Session.Add("RappoNumber", Number); Session.Add("RappoProvenience", "Rapportini"); RadWindowManager manager = new RadWindowManager(); RadWindow newwindow = new RadWindow(); newwindow.ID = "RadWindow2"; newwindow.NavigateUrl = "Rapportino.aspx"; newwindow.VisibleTitlebar = true; newwindow.Behaviors = WindowBehaviors.Close; newwindow.VisibleOnPageLoad = true; manager.Windows.Add(newwindow); } }<head runat="server">
<title>Test Page</title>
<script>
function openWindow()
{
alert("openWindow Activated");
var oWnd = window.radopen("http://www.yahoo.ca", "RadWindow1");
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<telerik:RadWindow ID="RadWindow1" runat="server">
</telerik:RadWindow>
<button onclick="openWindow();return false;" class="Button" style="WIDTH:190px">
Show window (using radopen)
</button>
</form>
</body>
</html>
Kyle
<telerik:RadGrid ID="gridDelegates" runat="server" AutoGenerateColumns="False" GridLines="Both" OnNeedDataSource="gridDelegates_NeedDataSource" OnInsertCommand="gridDelegates_InsertCommand" OnUpdateCommand="gridDelegates_UpdateCommand" OnDeleteCommand="gridDelegates_DeleteCommand"> <MasterTableView AutoGenerateColumns="false" DataKeyNames="ID" CommandItemDisplay="Top" EditMode="PopUp"> <NoRecordsTemplate> No delegates have been assigned. </NoRecordsTemplate> <RowIndicatorColumn> <HeaderStyle Width="20px"></HeaderStyle> </RowIndicatorColumn> <ExpandCollapseColumn> <HeaderStyle Width="20px"></HeaderStyle> </ExpandCollapseColumn> <Columns> <telerik:GridEditCommandColumn UniqueName="colEdit" /> <telerik:GridBoundColumn HeaderText="Name" UniqueName="colNameOfDelegate" DataField="NameOfDelegate"> </telerik:GridBoundColumn> <telerik:GridBoundColumn HeaderText="Start Date" DataFormatString="{0:MM-dd-yyyy}" UniqueName="colStartDate" DataField="StartDate"> <ItemStyle Width="68px" /> </telerik:GridBoundColumn> <telerik:GridBoundColumn HeaderText="End Date" DataFormatString="{0:MM-dd-yyyy}" UniqueName="colEndDate" DataField="EndDate"> <ItemStyle Width="65px" /> </telerik:GridBoundColumn> <telerik:GridBoundColumn UniqueName="colOffice" HeaderText="Office" DataField="Office"> <ItemStyle Width="60px" /> </telerik:GridBoundColumn> <telerik:GridTemplateColumn UniqueName="colFullDept" HeaderText="Department"> <ItemStyle Width="60px" /> <ItemTemplate> <span><%# DataBinder.Eval(Container.DataItem, "Dept")%>-<%# DataBinder.Eval(Container.DataItem, "SubDept")%></span> </ItemTemplate> </telerik:GridTemplateColumn> <telerik:GridButtonColumn ConfirmText="Are you sure you want to delete this delegate? <br/><br/>Click 'OK' to delete.<br/><br/>" ConfirmDialogType="RadWindow" ConfirmTitle="Delete Confirmation" ButtonType="ImageButton" CommandName="Delete" Text="Delete" UniqueName="colDeleteColumn"> <ItemStyle HorizontalAlign="Center" Width="30px" /> </telerik:GridButtonColumn> <telerik:GridBoundColumn UniqueName="colSupervisor" DataField="Supervisor" Visible="false" Display="false" /> <telerik:GridBoundColumn UniqueName="colDelegate" DataField="Delegate" Visible="false" Display="false" /> <telerik:GridBoundColumn UniqueName="colDept" DataField="Dept" Visible="false" Display="false" /> <telerik:GridBoundColumn UniqueName="colSubDept" DataField="SubDept" Visible="false" Display="false" /> <telerik:GridBoundColumn UniqueName="colIsActive" DataField="IsActive" Visible="false" Display="false" /> </Columns> <EditFormSettings UserControlName="~/UserControls/DelegationEditor.ascx" EditFormType="WebUserControl" CaptionDataField="NameOfDelegate" CaptionFormatString="Delegate rule for {0}" InsertCaption="New Delegate"> </EditFormSettings> </MasterTableView> </telerik:RadGrid> Can you invoke radalert or radconfirm or radprompt from code behind?
I am experimenting on the radpanel bar to be my menu items. I have the following code. When user choose delete, I would like to show radconfim and when user chooses to enter, I would like to show radprompt. Can this be done with Radconfirm and Radprompt? If not please suggest if there is any way to achieve this?
Protected Sub RadPanelBar1_ItemClick(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadPanelBarEventArgs) Handles RadPanelBar1.ItemClick
If e.Item.Items.Count > 0 Then
If e.Item.Text <> "Print" Then
"You clicked on top level item. Click on the child item."
End If
If e.Item.Text <> "Issuance" Then
"You clicked on top level item. Click on the child item."
End If
Else
If e.Item.Value = "VIEW" Then
ElseIf e.Item.Value = "UPDATE" Then
ElseIf e.Item.Value = "SAVE" Then
ElseIf e.Item.Value = "DELETE" Then
ElseIf e.Item.Value = "ENTER" Then
End If
End If
End Sub
Thank in advance.