Telerik Forums
UI for ASP.NET AJAX Forum
8 answers
385 views
I'm having an issue with a context menu where the menu doesn't populate the _targetElement property within the eventargs. This only happens when a menu is used (right click) and then another item is right clicked to invoke the menu once again. I need to grab some values from the _targetElement. Code is below, can someone help out.

Thanks,

Lou


//-------------control declaration---------------
<telerik:RadContextMenu id="EmailRightClickEditMenu"
Skin="Context_Nav"
EnableEmbeddedSkins="false"
OnClientItemClicked = "EmailRightClickMenu_Clicked"
OnClientShowing="EmailRightClickMenu_Showing" runat="server">
<Items>
<telerik:RadMenuItem Value="Open" meta:resourcekey="OpenMenu" runat="server" />
<telerik:RadMenuItem Value="Reply" meta:resourcekey="ReplyMenu" runat="server" />
<telerik:RadMenuItem Value="Reply All" meta:resourcekey="ReplyAllMenu" runat="server" />
<telerik:RadMenuItem Value="Forward" meta:resourcekey="ForwardMenu" runat="server" />
<telerik:RadMenuItem Value="Delete" meta:resourcekey="DeleteMenu" runat="server" />
</Items>
</telerik:RadContextMenu>
//------------------------------------------------------------------------

//--------------------javascript 

function

Email_MenuItemClicked(sender, args)

{

var itemValue = args.get_item().get_value();

var target = GetFirstParent(args.get_item().get_element(), NodeHasAttribute('UpdatePanel'));

switch (itemValue)

{

case "New":

ComposeEmail(target,

null);

break;

case "Delete":

DeleteSelected(

'tblEmails');

break;

case "Reply":

ReplySelected(

'tblEmails', target);

break;

case "ReplyAll":

ReplyAllSelected(

'tblEmails', target);

break;

case "Forward":

ForwardSelected(

'tblEmails', target);

break;

}

}

 

/*

This function is fired by the Telerik Context Menu when the user right-clicks

It sets the row clicked over top of as the selected row

*/

 

function

EmailRightClickMenu_Showing(sender, args)

{

var target = GetFirstParent(args.get_targetElement(), NodeHasAttribute('UpdatePanel'));

SetSelected(target,

'selectedRow');

var Reply = sender.findItemByText('Reply');

var ReplyAll = sender.findItemByText('Reply to All');

var Forward = sender.findItemByText('Forward');

var selRows = getSelectedRows('tblEmails');

if (selRows.length > 1)

{

Reply.disable();

ReplyAll.disable();

Forward.disable();

}

else

 

{

Reply.enable();

ReplyAll.enable();

Forward.enable();

}

}

 

/*

This function is the event handler for both right-click context menu

Controls all behavior of the menu

*/

 

function

EmailRightClickMenu_Clicked(sender, args)

{

var itemValue = args.get_item().get_value();

var target = GetFirstParent(args.get_targetElement(), NodeHasAttribute('UpdatePanel'));

switch(itemValue)

{

case "Delete":

DeleteSelected(

'tblEmails');

break;

case "Open":

EditSelected(

'tblEmails', target);

break;

case "Forward":

ForwardSelected(

'tblEmails', target);

break;

case "Reply" :

ReplySelected(

'tblEmails', target);

break;

case "Reply All" :

ReplyAllSelected(

'tblEmails', target);

break;

}

}

//-----------------------------------------------------------------------


args.get_targetElement() == null after the second right click to display another context menu.

Simon
Telerik team
 answered on 24 Jul 2008
3 answers
171 views
Greetings,
  I have a RadGrid within a CompositeControl (along with a couple RadMenus and some other controls). I store a user's column visibility and sort preferences serverside and manually add the columns and sortexpression when a grid is loaded. The error I am getting is:

Unable to cast object of type 'Telerik.Web.UI.GridImageButton' to type 'System.Web.UI.WebControls.Button'.

which occurs Only when I add my own sortexpression to the mastertableview during Grid.Init (after all the columns have been added). If I comment out the
Grid.MasterTableView.SortExpressions.AddSortExpression(sortExp);
then everything works as expected, but I don't get my sort, of course.

I have tried setting Col.ShowSortIcon to false but that did not change anything. I have also played with different values for Col.HeaderButtonType, also without change.

Any insight would be greatly appreciated.

Thanks,
 - Forrest
Forrest
Top achievements
Rank 1
 answered on 24 Jul 2008
2 answers
90 views

I have a RadGrid in a user control on a page.  In IE I am able to select text in the grid and copy it.  So in an email column I can select one of the addresses right click and copy.  Yet in FireFox I dont seem to be able too.  In Fire Fox I dont even get the correct cursur.  Does anyone know any reason for this?

Thanks for any help.

Mark
Mark
Top achievements
Rank 1
 answered on 24 Jul 2008
1 answer
280 views
Hello,

   I am getting an error with the viewstate. I need to do some stuff in the code behind of the child radwindow prior to closing it. Then I need to do some other tasks on the parent form. After I click the close window of the child radwindow and then click the button on the parent form I get the message "Failed to load viewstate. The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during the previous request.  For example, when adding controls dynamically, the controls added during a post-back must match the type and position of the controls added during the initial request. " I am new to this and have read the __doPostBack, but am not sure if I need that or where to start. I would appreciate any insight. I have supplied the code below. Thanks.

John

parentForm

aspx

<

html xmlns="http://www.w3.org/1999/xhtml" >

<

head runat="server">

<title>Untitled Page</title>

</

head>

<

body>

<form id="form1" runat="server">

<telerik:radscriptmanager id="ScriptManager1" runat="server" enabletheming="True"></telerik:radscriptmanager>

<div>

</div>

<telerik:radwindowmanager id="RadWindowManager1" runat="server" behavior="Default"

initialbehavior="None" left="" top=""></telerik:radwindowmanager>

<asp:Button ID="Button1" runat="server" Text="Button" />

</form>

</

body>

</

html>



code behind

Public

Partial Class frmMDI

Inherits System.Web.UI.Page

Dim newWindow1 As New Telerik.Web.UI.RadWindow()

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

If Not IsPostBack Then

Try

'create child modal window

newWindow1.Behaviors = Telerik.Web.UI.WindowBehaviors.Move

newWindow1.Height =

"320"

newWindow1.Width =

"422"

newWindow1.Title =

"Child Window"

newWindow1.Modal =

True

newWindow1.VisibleTitlebar =

False

newWindow1.VisibleOnPageLoad =

True

newWindow1.NavigateUrl =

"frmChild.aspx"

newWindow1.Visible =

True

newWindow1.DestroyOnClose =

True

RadWindowManager1.Windows.Add(newWindow1)

Catch ex As Exception

Dim strEr As String = ex.ToString

End Try

Else

End If

End Sub

Protected Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

'do some code behind

Button1.Text =

"Refreshed"

End Sub

End

Class


child form

aspx

<

html xmlns="http://www.w3.org/1999/xhtml" >

<

head runat="server">

<title>Child Window</title>

<script type="text/javascript">

function get_RadWindow() //verify that it's a radWindow

{

var oWindow = null;

if (window.radWindow)

{ oWindow = window.radWindow; }

else if (window.frameElement.radWindow)

{ oWindow = window.frameElement.radWindow; }

return oWindow;

}

function JustClose()

{

get_RadWindow().Close();

}

</script>

</

head>

<

body>

<form id="form1" runat="server">

<telerik:RadScriptManager ID="ScriptManager1" runat="server" EnableTheming="True">

</telerik:RadScriptManager>

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">

</telerik:RadAjaxManager>

<telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" Height="200px" Width="300px">

<asp:Button ID="Button1" runat="server" Text="Close Window" /></telerik:RadAjaxPanel>

</form>

</

body>

</

html>



code behind

Protected Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

'do some code behind

RadAjaxManager1.ResponseScripts.Add(

"JustClose()")

End Sub

Georgi Tunev
Telerik team
 answered on 24 Jul 2008
1 answer
102 views
I would like to configure a drop down button on the tool bar that has items that can be checked (selected) or unchecked.  The visual appearance would show the check/unchecked status.  I figured this might be common enough that you had a sample lying around somewhere or could point me in the best direction.

Regards,
Bob
Peter
Telerik team
 answered on 24 Jul 2008
2 answers
100 views
Hi,
I have noticed that there are a few stings appearing in command history (undo) of the radeditor which don't seem to be in any of the resx files. Specifically "Unlink" and "Insert HTML". Is there a way to localize these strings?

Thanks
Sub
Top achievements
Rank 1
 answered on 24 Jul 2008
8 answers
1.3K+ views
I am using a checkbox that needs to align right

<td style="align:right;"><checkbox></td>

it works fine but as soon as I drop the FormDecorator on the page, it aligns left (all other controls - ddl and txt align properly).

Any reason for this?

also note.  i put the formdecorator control on the masterpage and not directly in the form.
Georgi Tunev
Telerik team
 answered on 24 Jul 2008
1 answer
127 views
 

I have a radgrid which is

<radG:RadGrid TabIndex="11" ID="RadGrdFiltered" Skin="Glassy" EnableAJAX="True" AutoGenerateColumns="False"

LoadingTemplateTransparency="20" ItemStyle-Height="20px" AlternatingItemStyle-Height="20px"

AllowMultiRowEdit="false" AllowMultiRowSelection="true" MasterTableView-RetrieveAllDataFields="true"

EnableOutsideScripts="false" EnableAJAXLoadingTemplate="false" runat="server" AllowSorting="false"

AllowPaging="true" PageSize="10">

<ExportSettings OpenInNewWindow="true" ExportOnlyData="true" />

<MasterTableView Width="100%" HorizontalAlign="NotSet" AutoGenerateColumns="false"

AllowAutomaticDeletes="True" CssClass="master">

<Columns>

<radG:GridBoundColumn HeaderText="ID" ItemStyle-HorizontalAlign="left" ItemStyle-VerticalAlign="Middle"

DataField="ID" SortExpression="ID" HeaderStyle-Width="10%" />

<radG:GridBoundColumn HeaderText="First Name" ItemStyle-HorizontalAlign="left" ItemStyle-VerticalAlign="Middle"

DataField="First Name" SortExpression="First Name" HeaderStyle-Width="12%" />

<radG:GridBoundColumn HeaderText="Last Name" ItemStyle-HorizontalAlign="left" ItemStyle-VerticalAlign="Middle"

DataField="Last Name" SortExpression="Last Name" HeaderStyle-Width="12%" />

<radG:GridBoundColumn HeaderText="Plan Type" ItemStyle-HorizontalAlign="left" ItemStyle-VerticalAlign="Middle"

DataField="Plan Type" SortExpression="Plan Type" HeaderStyle-Width="12%" />

<radG:GridBoundColumn HeaderText="Status" ItemStyle-HorizontalAlign="left" ItemStyle-VerticalAlign="Middle"

DataField="Status" SortExpression="Status" HeaderStyle-Width="12%" />

<radG:GridBoundColumn HeaderText="Division" ItemStyle-HorizontalAlign="left" ItemStyle-VerticalAlign="Middle"

DataField="Division" SortExpression="Division" HeaderStyle-Width="12%" />

<radG:GridBoundColumn HeaderText="Department" ItemStyle-HorizontalAlign="left" ItemStyle-VerticalAlign="Middle"

DataField="Department" SortExpression="Department" HeaderStyle-Width="12%" />

<radG:GridBoundColumn HeaderText="Location" ItemStyle-HorizontalAlign="left" ItemStyle-VerticalAlign="Middle"

DataField="Location" SortExpression="Location" HeaderStyle-Width="32%" />

</Columns>

</MasterTableView>

<AlternatingItemStyle Height="20px" />

<ItemStyle Height="20px" />

</radG:RadGrid>

Now I tried to export the data in the radgrid to excel using a button click event.  The event is

protected

void btnExport_Clicked(object sender, EventArgs e)

{

 

RadGrdFiltered.ExportSettings.IgnorePaging =

true;

RadGrdFiltered.ExportSettings.OpenInNewWindow =

true;

RadGrdFiltered.MasterTableView.ExportToExcel();

RadGrdFiltered.ExportSettings.FileName =

"QBOutput" + DateTime.Now.ToFileTime() + ".xls";

}

But inspite of giving these things, i am not able to achieve the result. 

Daniel
Telerik team
 answered on 24 Jul 2008
1 answer
88 views
hi,
I am using the sheduler for 5 year planning and was wondering how to present the data nicely. Since i am using timeline and have set the width to 3200px, i found that it is difficult to identify the appointments with its related year. I was wondering that if i could highlight the time slot for every year with different colors or you can provide other alternatives to improve the view.
The details are shown as following:
<TimelineView
GroupingDirection="Vertical" HeaderDateFormat="MM/yy" NumberOfSlots="60"  SlotDuration="31.00:00:00" GroupBy="Generation" /> 

regards,
Chun
Peter
Telerik team
 answered on 24 Jul 2008
1 answer
97 views
Hi All,

I want to know how can I delete or remove my previous thread.
Is there any provision for this?

Best Regards,
Hrushikesh.
Daniel
Telerik team
 answered on 24 Jul 2008
Narrow your results
Selected tags
Tags
+? more
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?