<telerik:RadGrid ID="gvSearchTelerik" runat="server" |
OnItemCreated="gvSearchTelerik_ItemCreated" |
EnableAjaxSkinRendering="false" |
AllowSorting="True" |
AllowPaging="True" |
PageSize="15" |
GridLines="None" |
Width="100%" |
AllowFilteringByColumn="True" |
DataSourceID="sqlSearchDevice" |
HeaderStyle-Wrap="false" |
HeaderStyle-Width="150px" |
ShowGroupPanel="True" |
ShowStatusBar="true"> |
<MasterTableView CommandItemDisplay="Top"> |
<CommandItemTemplate> |
<asp:ImageButton ID="bXls" runat="server" |
OnInit="bXls_Init" |
OnPreRender="bXls_PreRender" |
OnClick="bXls_Click" |
style="margin:3px 2px 1px 2px" |
SkinID="ExportToExcel"/> |
</CommandItemTemplate> |
<Columns> |
<telerik:GridBoundColumn DataField="Id" DataType="System.Int32" |
HeaderText="MojeIdecko"> |
</telerik:GridBoundColumn> |
</Columns> |
</MasterTableView> |
<PagerStyle Mode="NextPrevAndNumeric"></PagerStyle> |
<ExportSettings IgnorePaging="true" OpenInNewWindow="true" ExportOnlyData="true" > |
<Excel FileExtension="xls" Format="ExcelML" /> |
</ExportSettings> |
<ClientSettings AllowDragToGroup="True" |
AllowColumnsReorder="true" |
ReorderColumnsOnClient="true"> |
<Scrolling AllowScroll="True" |
UseStaticHeaders="True" |
SaveScrollPosition="true" |
FrozenColumnsCount="1" /> |
</ClientSettings> |
</telerik:RadGrid> |
protected void bXls_Click(object sender, ImageClickEventArgs e) |
{ |
gvSearchTelerik.ExportSettings.ExportOnlyData = true; |
gvSearchTelerik.ExportSettings.IgnorePaging = true; |
gvSearchTelerik.ExportSettings.OpenInNewWindow = true; |
gvSearchTelerik.MasterTableView.ExportToExcel(); |
} |
protected void gvSearchTelerik_ItemCreated(object sender, Telerik.Web.UI.GridItemEventArgs e) |
{ |
if (e.Item is GridCommandItem) |
{ |
ImageButton ibExportToExcel = (e.Item as GridCommandItem).FindControl("bXls") as ImageButton; |
this.RegisterPostbackControl(this, ibExportToExcel); //this function just registers input control // via ScriptManager placed on the MasterPage |
} |
} |
SELECT Contacts.ID, Contacts.ContactName, Contacts.Email, Countries.ID AS CountryID, Countries.CountryName, COUNT(Contacts.ID) AS TotalContacts
FROM Contacts RIGHT OUTER JOIN Countries ON Contacts.CountryID = Countries.ID
GROUP BY Contacts.CountryID, Countries.ID, Countries.CountryName, Contacts.ContactName, Contacts.Email, Contacts.ID
<
telerik:RadGrid
ID
=
"RadGrid1"
runat
=
"server"
DataSourceID
=
"SqlData"
AutoGenerateColumns
=
"False"
AllowSorting
=
"True"
AllowMultiRowSelection
=
"False"
AllowPaging
=
"True"
PageSize
=
"15"
GridLines
=
"None"
OnRowDrop
=
"RadGrid1_RowDrop"
>
<
PagerStyle
Mode
=
"NumericPages"
></
PagerStyle
>
<
MasterTableView
DataSourceID
=
"SqlData"
DataKeyNames
=
"ID"
GroupLoadMode
=
"Server"
>
<
GroupByExpressions
>
<
telerik:GridGroupByExpression
>
<
SelectFields
>
<
telerik:GridGroupByField
FieldAlias
=
"Country"
FieldName
=
"Country"
></
telerik:GridGroupByField
>
<
telerik:GridGroupByField
FieldName
=
"TotalContact"
Aggregate
=
"Count"
></
telerik:GridGroupByField
>
</
SelectFields
>
<
GroupByFields
>
<
telerik:GridGroupByField
FieldName
=
"Country"
></
telerik:GridGroupByField
>
</
GroupByFields
>
</
telerik:GridGroupByExpression
>
</
GroupByExpressions
>
<
Columns
>
<
telerik:GridDragDropColumn
HeaderStyle-Width
=
"18px"
/>
<
telerik:GridBoundColumn
SortExpression
=
"ID"
HeaderText
=
"ID"
HeaderButtonType
=
"TextButton"
datafield
=
"ID"
UniqueName
=
"ID"
/>
<
telerik:GridBoundColumn
SortExpression
=
"ContactName"
HeaderText
=
"Name"
HeaderButtonType
=
"TextButton"
datafield
=
"ContactName"
UniqueName
=
"ContactName"
/>
<
telerik:GridBoundColumn
SortExpression
=
"Country"
HeaderText
=
"Country"
HeaderButtonType
=
"TextButton"
DataField
=
"Country"
UniqueName
=
"Country"
/>
</
Columns
>
</
MasterTableView
>
<
ClientSettings
AllowRowsDragDrop
=
"true"
>
<
Selecting
AllowRowSelect
=
"True"
EnableDragToSelectRows
=
"false"
/>
</
ClientSettings
>
</
telerik:RadGrid
>
This is inside the DataBound event of grid:
foreach (GridDataItem item in RadGrid_IDPicker.Items)
{
if (Convert.ToString(DataBinder.Eval(item.DataItem, "IID")) == lblID.Text)
{
item.Style.Add(HtmlTextWriterStyle.FontWeight, "Bold");
}
if (lblIDTemp.Text != lblID.Text)
{
string radalertscript = "<
script
language
=
'javascript'
>function f(){confirm_select('" + lblIDtemp.ClientID + "'); Sys.Application.remove_load(f);}; Sys.Application.add_load(f);</
script
>";
Page.ClientScript.RegisterStartupScript(this.GetType(), "myScript", radalertscript);
}
}
<telerik:RadScriptManager ID="RadScriptManager1" Runat="server">
</telerik:RadScriptManager>
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="OverviewGrid">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="OverviewGrid" />
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManager>
<telerik:RadGrid ID="OverviewGrid" runat="server" AllowFilteringByColumn="True"
AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False"
CellSpacing="0" CssClass="grid" Skin="WebBlue" GridLines="None">
<
MasterTableView>
<
CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
<
RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
<
HeaderStyle Width="20px"></HeaderStyle>
</
RowIndicatorColumn>
<
ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
<
HeaderStyle Width="20px"></HeaderStyle>
</
ExpandCollapseColumn>
<Columns>
<telerik:GridHyperLinkColumn DataNavigateUrlFields="ObjectId"
DataNavigateUrlFormatString="Request.aspx?ObjectId={0}"
DataTextField="Employee" FilterControlAltText="Filter Employee"
HeaderText="Employee" SortExpression="Employee" Target="_blank"
UniqueName="Employee">
</telerik:GridHyperLinkColumn>
<telerik:GridBoundColumn DataField="Division"
FilterControlAltText="Filter Division" HeaderText="Division"
SortExpression="Division" UniqueName="Division">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="CostCenter"
FilterControlAltText="Filter Cost Center" HeaderText="Cost Center"
SortExpression="CostCenter" UniqueName="CostCenter">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="RequestPeriod"
FilterControlAltText="Filter Request Period" HeaderText="Date"
SortExpression="RequestPeriod" UniqueName="RequestPeriod" DataFormatString="{0:d}">
</telerik:GridBoundColumn>
<telerik:GridNumericColumn DataField="Hours" DecimalDigits="2"
FilterControlAltText="Filter Hours" HeaderText="Hours"
SortExpression="Hours" UniqueName="Hours" DataFormatString="{0:N}">
</telerik:GridNumericColumn>
<telerik:GridBoundColumn DataField="Reason"
FilterControlAltText="Filter Reason" HeaderText="Reason"
SortExpression="Reason" UniqueName="Reason">
</telerik:GridBoundColumn>
<telerik:GridNumericColumn DataField="Overtime" DecimalDigits="2"
FilterControlAltText="Filter Overtime" HeaderText="Current Overtime"
SortExpression="Overtime" UniqueName="Overtime" ReadOnly="true" DataFormatString="{0:N}">
</telerik:GridNumericColumn>
<telerik:GridCheckBoxColumn DataField="ApprovalSuperior"
FilterControlAltText="Filter Superior Approval" HeaderText="Superior"
SortExpression="ApprovalSuperior" UniqueName="ApprovalSuperior" ReadOnly="true">
</telerik:GridCheckBoxColumn>
<telerik:GridCheckBoxColumn DataField="ApprovalCctResponsible"
FilterControlAltText="Filter Cost Center Approval" HeaderText="Cost Center"
SortExpression="ApprovalCctResponsible" UniqueName="ApprovalCCT" ReadOnly="true">
</telerik:GridCheckBoxColumn>
<telerik:GridCheckBoxColumn DataField="ApprovalBuResponsible"
FilterControlAltText="Filter BU Responsible Approval" HeaderText="HR BU"
SortExpression="ApprovalBuResponsible" UniqueName="ApprovalBU" ReadOnly="true">
</telerik:GridCheckBoxColumn>
<telerik:GridCheckBoxColumn DataField="ApprovalHeadHr"
FilterControlAltText="Filter Head HR Approval" HeaderText="Head HR"
SortExpression="ApprovalHeadHr" UniqueName="ApprovalHR" ReadOnly="true">
</telerik:GridCheckBoxColumn>
<telerik:GridCheckBoxColumn DataField="ApprovalWorksCouncil"
FilterControlAltText="Filter Works Council Approval" HeaderText="Works Council"
SortExpression="ApprovalWorksCouncil" UniqueName="ApprovalWC" ReadOnly="true">
</telerik:GridCheckBoxColumn>
<telerik:GridCheckBoxColumn DataField="ApprovalEmployee"
FilterControlAltText="Filter Employee Approval" HeaderText="Employee"
SortExpression="ApprovalEmployee" UniqueName="ApprovalEmployee" ReadOnly="true">
</telerik:GridCheckBoxColumn>
</Columns>
<
EditFormSettings>
<
EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn>
</
EditFormSettings>
</
MasterTableView>
<
FilterMenu EnableImageSprites="False"></FilterMenu>
<
HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default"></HeaderContextMenu>
</telerik:RadGrid>
IsLoggedIn
:[ScriptService]
[WebService(Namespace =
"http://tempuri.org/"
)]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public
class
Authentication : WebService
{
[WebMethod]
public
bool
IsLoggedIn()
{
return
Context.User.Identity.IsAuthenticated;
}
}
<telerik:RadCodeBlock runat=
"server"
ID=
"RadCodeBlock1"
>
<script type=
"text/javascript"
>
function
OnClientBeforeShow(sender, eventArgs)
{
Authentication.IsLoggedIn(successfulAuthCallback, failedAuthCallback, eventArgs);
}
function
successfulAuthCallback(isLoggedInResult,eventArgs) {
if
(isLoggedInResult !=
true
)
{
// reload the entire page so the Forms Auth will see that the cookie has expired and redirect to login
window.location.reload(
true
);
}
}
function
failedAuthCallback(result, eventArgs)
{
alert(
"Auth Callback failed: Reason -- "
+ result);
}
</script>
</telerik:RadCodeBlock>
IsLoggedIn
has no formal parameters. However, it is being passed 3 parameters.successfulAuthCallback
is being passed 2 parameters. It has two parameters. But where are they being passed to it.public partial class WebForm2 : System.Web.UI.Page |
{ |
Panel panel; |
Button button; |
protected void Page_Load(object sender, EventArgs e) |
{ |
AddControls(); |
} |
void AddControls() |
{ |
//Create controls |
panel = new Panel(); |
button = new Button { Text = "Update" }; |
//Add event handler |
button.Click += new EventHandler(button_Click); |
//Add controls |
Form.Controls.Add(panel); |
panel.Controls.Add(button); |
//Register with manager |
RadAjaxManager1.AjaxSettings.AddAjaxSetting(panel, button, null); |
} |
void button_Click(object sender, EventArgs e) |
{ |
RadAjaxManager1.Alert(RadAjaxManager1.IsAjaxRequest.ToString()); |
} |
} |