Monday, August 31, 2015
Thursday, August 27, 2015
Page Scrolls to Top on RadDatePicker Click
Problem: You have a Telerik RadDatePicker as a single control or part of a filter on a RadGrid with a DateTime column. User clicks the calendar icon and the page scrolls to the top and the calendar is not displayed. You'll see a javascript ArgumentOutOfRange exception in the Inspect Element window of the browser.The solution for me was replacing the asp:ScriptManager with the. telerik:RadScriptManager
<telerik:RadScriptManager ID="ScriptManager1" runat="server">
<%-- Load scripts as a group and cache on browser. --%>
<Groups>
<telerik:ScriptReferenceGroup>
<Scripts>
<asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
<asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
<asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryPlugins.js" />
</Scripts>
</telerik:ScriptReferenceGroup>
</Groups>
</telerik:RadScriptManager>
Custom Software for Your Business
Visit Blue Canyon Software if you need custom software for your business.Tuesday, August 18, 2015
Free Visual Studio Development Tools!
Visit this link to learn more about free development tools to include:
- Visual Studio Community IDE
- Visual Studio Online
- Visual Studio Code
- Azure App Service
Friday, May 8, 2015
RadioButtonList SelectedIndexChanged Only Fires Once !!!
I ran into an interesting issue today. The SelectedIndexChanged event was raised only once after page load. The problem was solved by adding ClientIdMode="Static"
<asp:RadioButtonList ID="rblTimeStamp" runat="server"
RepeatDirection="Horizontal"
ClientIdMode="Static" AutoPostBack="True" OnSelectedIndexChanged="OnTimeStampTypeChanged" >
<asp:ListItem Value="CurrentTime" Text="Current "></asp:ListItem>
<asp:ListItem Value="CustomTime" Text="Custom" ></asp:ListItem>
</asp:RadioButtonList>Don't use a RadAjaxManager if you set the ClientIdMode to Static. See blog post titled "RadAjaxManager and ClientIdMode="Static".
Another Approach Using RadAjaxManager
Don't set any ClientIdMode values to Static.Set AutoPostBack to true for radiobuttonlist.
Set the radiobuttonlist as the initiator and updated control in the RadAjaxManager.
Reset the selected radiobutton in the event handler.
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" DefaultLoadingPanelID="loadingPanelDlgInjections">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="rblInjectionListChoice">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="rblInjectionListChoice"/>
<telerik:AjaxUpdatedControl ControlID="radCmbInjectionSites" />
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManager>
<telerik:RadAjaxLoadingPanel ID="loadingPanelDlgInjections" runat="server" Skin="Default"></telerik:RadAjaxLoadingPanel>
<asp:RadioButtonList ID="rblInjectionListChoice" runat="server" RepeatDirection="Horizontal" AutoPostBack="True"
OnSelectedIndexChanged="rblInjectionListChoice_SelectedIndexChanged">
<asp:ListItem value="shortList" Text="Short List " Selected="True"></asp:ListItem>
<asp:ListItem value="longList" Text="Long List "></asp:ListItem>
</asp:RadioButtonList></div>
<telerik:RadComboBox ID="radCmbInjectionSites" runat="server" Width="100%"
AutoPostBack="True" RenderMode="Lightweight"
Filter="StartsWith" EmptyMessage="Select Injection Site">
</telerik:RadComboBox>
Event Handler
protected void rblInjectionListChoice_SelectedIndexChanged(object sender, EventArgs e)
{
foreach (ListItem item in rblInjectionListChoice.Items)
{
if (item.Selected)
{
item.Selected = true;
}
}
//Add your code here.
}
Visit www.BlueCanyonSoftware.com if you need custom software for your business.
Wednesday, April 15, 2015
Custom Software Can Free You
Businesses outgrow data management by paper and spreadsheets. At some point, you start to replace your time enjoying your entrepreneurial passion with the mundane task of managing the business data.
Check out this article by Jeff Hayden in Inc.com.
Check out this article by Jeff Hayden in Inc.com.
This quote from Jeff's article nails one of the best reasons to consider custom software to manage your business -- "Leveraging software actually lets you get back to doing more of what you love, because not only does it streamline and automate your processes, it streamlines and automates processes for your customers--and frees you up to think of creative ways that doing what you love can better serve your customers."
Contact Blue Canyon Software Consulting, Inc if you need custom software for your business.
Get back to what you love.
Wednesday, March 25, 2015
Get Assigned Roles With LINQ
Here's one way of creating a RadGrid with assigned roles for users.
<telerik:RadGrid runat="server" ID="gridUsers" AllowSorting="True"
AutoGenerateColumns="False" GroupPanelPosition="Top"
ResolvedRenderMode="Classic"onneeddatasource="gridUsers_NeedDataSource" onitemdatabound="gridUsers_ItemDataBound"> <MasterTableView> <Columns> <telerik:GridBoundColumn DataField="userName" HeaderText="User Name" UniqueName="colUserName"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="roles" HeaderText="Roles" UniqueName="colRoles"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="isApproved" HeaderText="Active User?" UniqueName="colIsApproved"> </telerik:GridBoundColumn> </Columns> </MasterTableView> </telerik:RadGrid>
using System; using System.Linq; using System.Web.Security; using Telerik.Web.UI;
protected void gridUsers_NeedDataSource(object sender,Telerik.Web.UI.GridNeedDataSourceEventArgs e) { try { using (var dc = new MyModel.EntitiesModel()) { var u = dc.Aspnet_Users.Select(a => new { userName = a.UserName, roles = string.Join(",", Roles.GetRolesForUser(a.UserName)), isApproved = (Membership.GetUser(a.UserName)).IsApproved }); if (null != u) { this.gridUsers.DataSource = u.ToList(); } } } catch (Exception) { throw; } }protected void gridUsers_ItemDataBound(object sender,Telerik.Web.UI.GridItemEventArgs e) { if (e.Item is GridDataItem) { GridDataItem dataItem = (GridDataItem)e.Item; if (dataItem["colIsApproved"].Text != null &&dataItem["colIsApproved"].Text == "False"){ dataItem["colIsApproved"].BackColor = System.Drawing.Color.Red; dataItem["colIsApproved"].ToolTip = "This person cannot login."; } } }
Tuesday, March 24, 2015
Hiding a Telerik Menu Choice Based on Role
I have my menu in the site master page. I used the Page_Load() function to make the "Admin" menu item only visible to users with an Admin role.using System;
using System.Linq;
using Telerik.Web.UI;
using System.Web.Security;
<telerik:RadMenu ID="menu" runat="server" RenderMode="Auto" >
<Items>
<telerik:RadMenuItem Text="Admin" Visible="true" />
</Items>
</telerik:RadMenu>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
RadMenuItem item = this.menu.FindItemByText("Admin");
if (null != item)
{
if (Roles.IsUserInRole("Admin"))
{
item.Visible = true;
}
else
{
item.Visible = false;
}
}
}
}
Subscribe to:
Posts (Atom)