In the method body convert the object [] to the needed array type . You can do it this way:
parameter is:
(object[] eventTypes) int[] eventTypeIDs = eventTypes.Select( Convert.ToInt32).ToArray();
(object[] eventTypes) int[] eventTypeIDs = eventTypes.Select( Convert.ToInt32).ToArray();
public struct ShowMyClass{};
If your download button inside the RadGrid doesnt work if in an ajax panel:
All you have to do is below( "btnDownload" is the id of the control
which causes the download):
function RequestStart(sender, args) {
if (args.get_eventTarget().indexOf("btnDownload") >= 0) {
args.set_enableAjax(false);
}
}
<telerik:RadAjaxPanel runat="server" LoadingPanelID="pnlLoading"
ID="pnlMain" ClientEvents-OnRequestStart="RequestStart">
<telerik:GridTemplateColumn HeaderText="Business Card" >
<ItemTemplate>
<asp:LinkButton runat="server" ID="btnDownload" Text="Download"
CommandName="Download" CommandArgument='<%#Eval("ID") %>' >
</asp:LinkButton>
</ItemTemplate>
</telerik:GridTemplateColumn>
If you want call javascript from server side while using RadAjaxPanel use
ResponseScripts.Add method.
//Doesnt work : ScriptManager.RegisterStartupScript(this, GetType(), "RefreshDD", "RefreshDD();", true);
//Works :
pnlMain.ResponseScripts.Add("RefreshDD();");
This works : <telerik:GridTemplateColumn HeaderText="Edit"> <ItemTemplate> <asp:Button runat="server" Text="Edit" AutoPostBack="False" OnClientClick='<%# String.Format("openAddContact({0})",Eval("ID"))%> '></asp:Button> </ItemTemplate> </telerik:GridTemplateColumn>
This doesn't: <telerik:GridTemplateColumn HeaderText="Edit"> <ItemTemplate> <telerik:RadButton ID="Button1" runat="server" Text="Edit"
AutoPostBack="False"
OnClientClicked='<%# String.Format("openAddContact({0})",Eval("ID"))%> '> </telerik:RadButton> </ItemTemplate> </telerik:GridTemplateColumn>
intersting hah
<telerik:GridTemplateColumn HeaderText="No of Subscribers">
<ItemTemplate>
<%#Eval("SentToCount") %>
</ItemTemplate>
<EditItemTemplate>
<telerik:RadNumericTextBox ID="rnSentCount" runat="server" MaxValue="1000000"
CausesValidation="True" NumberFormat-DecimalDigits="0" DataType="Int32" MinValue="1"
DbValue='<%#Bind("SentToCount") %>'/>
</EditItemTemplate>
<InsertItemTemplate>
<telerik:RadNumericTextBox ID="rnSentCount" runat="server" MaxValue="1000000"
CausesValidation="True" NumberFormat-DecimalDigits="0" DataType="Int32" MinValue="1"
DbValue='<%#Bind("SentToCount") %>'/>
</InsertItemTemplate>
</telerik:GridTemplateColumn>
<%#Bind ()%> will not work with Value property so use DbValue instead and it will
work like a charm. Why intellisense doesnt display DbValue : good question ... to telerik :)
<asp:RadioButtonList ID="rblSentTo" runat="server"
SelectedValue='<%#Bind("SentTo") %>'> <Items> <asp:ListItem Text="Community Members" Value="C"></asp:ListItem> <asp:ListItem Text="Parents/Students" Value="P"></asp:ListItem> <asp:ListItem Text="" Value=""></asp:ListItem> </Items> </asp:RadioButtonList>Here the SentTo is nullable , in case your field is not , you do not need the 3rd ListItem with "" value but if it's nullable, you must add it, otherwise it cant find a match to null value and give an error
EmptyListItemText="None" EmptyListItemValue="" EnableEmptyListItem="True"
<telerik:GridDropDownColumn HeaderText="TargetOrganisation" ListValueField="ID" UniqueName="TargetOrganisationID" DataField="TargetOrganisationID" ListTextField="Alias" DataSouceID="edsOrganisation"EmptyListItemText="None" EmptyListItemValue="" EnableEmptyListItem="True"> </telerik:GridDropDownColumn>
public override string[] GetRolesForUser(string username)
And this is my method which returns Role objects as IList:
public static List<Role> GetUsersRoles(string userName) { User user; using (Entities entities = new Entities()) { entities.Connection.Open(); user = entities.Users.Include("Roles").FirstOrDefault(p => p.Username == userName); } if (user != null) { return user.Roles.ToList(); } else { return null; } }
<telerik:RadDatePicker runat="server" ID="rdDeterminationDate"
DbSelectedDate='<%#Bind("DeterminationDate") %>' >
</telerik:RadDatePicker>