Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
134 views
Hi,

In loaded event of tree I look through nodes and get reference to <img/> inside each node which is templated through <NodeTemplate>.I want the user to be able to left click on it and see context menu (same context menu as user can see by right clicking on any tree item). This is how I add 'onclick' handler to <img/>:
imgTag.click(nodes[i], function (e) {
    var menu = e.data.get_contextMenu();
    if (menu)
        menu.showAt(e.pageX, e.pageY);
 
    //$telerik.cancelRawEvent(e);
    e.stopPropagation();
});

Now when I click on img I can see the context menu, but no events are fired and obviously postback doesn't happen (regular right click based menu works as expected). I tried with treeView.showNodeContextMenu but it fails internally on get_contextMenu call.

How to fix that? :) Thank you!

Related posts with similar problems:
http://www.telerik.com/community/forums/aspnet-ajax/treeview/show-contextmenu-when-hovering-on-node-instead-of-right-click.aspx
http://www.telerik.com/community/forums/aspnet/treeview/show-context-menu.aspx
Shukhrat Nekbaev
Top achievements
Rank 1
 answered on 14 Oct 2011
1 answer
114 views
Hi guys

I i succsesfuly viev appointments from the sql sever database from my scheduler, Now all my appointments appear in the "all day" slot
While each appointment hav a start time and an end time.

How can i solve this?
Ivana
Telerik team
 answered on 14 Oct 2011
8 answers
286 views

 

 

I am trying to get the user control on th eItemcommand of the grid but it is coming null. can some one please help as in what i am missing in here.

the user control comes null. please help.......
Code Behind

protected
void GridResult_ItemCommand(object source, GridCommandEventArgs e)

 

{

 

 

if (e.CommandName == RadGrid.EditCommandName)

 

{

 

 

GridDataItem item = e.Item as GridDataItem;

 

 

 

UserControl userControl = (UserControl)e.Item.FindControl(GridEditFormItem.EditFormUserControlID);

 

(userControl.FindControl(

 

"A") as HiddenField).Value = item["x"].Text;

 

(userControl.FindControl(

 

"B") as HiddenField).Value = item["Y"].Text;

 

}

}

Page Details.
Grid Columns:
this is my button

 

 

<telerik:GridEditCommandColumn UniqueName="actionsCommandColumn" EditText="Go" ButtonType="PushButton">

 

 

 

</telerik:GridEditCommandColumn>

<

 

 

EditFormSettings PopUpSettings-Modal="true" InsertCaption="Actions" UserControlName="CustomControl.ascx"

 

 

 

 

 

 

 

EditFormType="WebUserControl">

 

</EditFormSettings>

 

 

 

 

Pravesh
Top achievements
Rank 1
 answered on 14 Oct 2011
2 answers
584 views
PROBLEM SOLVED
Moderator can close this thread.

On the website there seems to be missing an explicit explanation that After you do an CallbackUpdate you have to add a Javascript function where you do a sender.show() so your notification window could be seen on clientside.

**********************************************************************************************************************************************************

Hello, I started using RadNotification control today and I have encountered a problem that is really weird.

The problem is that I am using a really simple implementation of this control using a callback method on the server, and this the notification doesn't Fire up when the event ends... in Fact it never FIRES up anytime the event ends.

Here is my code (I used the same code provided in the Demo website) REF: http://demos.telerik.com/aspnet-ajax/notification/examples/updateinterval/defaultcs.aspx

The only difference is that I am not using the QuickStart Library or Event Log Console.

(CODE)

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="ListaBase.UserControls.WebForm1" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
 
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
     
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
    </telerik:RadScriptManager>
    <br />
    <telerik:RadNotification ID="RadNotification1" runat="server" LoadContentOn="TimeInterval"
        Width="300" Animation="Fade" EnableRoundedCorners="true" EnableShadow="true"
        Title="Received messages" OffsetX="-20" OffsetY="-20"
        TitleIcon="none" UpdateInterval="3000" AutoCloseDelay="1500" OnCallbackUpdate="OnCallbackUpdate">
        <ContentTemplate>
            <asp:Literal ID="lbl" runat="server"></asp:Literal>
        </ContentTemplate>
    </telerik:RadNotification>
     
     
    </div>
    </form>
</body>
</html>


namespace ListaBase.UserControls
{
    public partial class WebForm1 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
 
        }
 
        protected void OnCallbackUpdate(object sender, RadNotificationEventArgs e)
        {
            int newMsgs = DateTime.Now.Second % 10;
            if (newMsgs == 5 || newMsgs == 7 || newMsgs == 8 || newMsgs == 9) newMsgs = 0;
            lbl.Text = "You have " + newMsgs + " new messages!";
            RadNotification1.Value = newMsgs.ToString();
        }
    }
}
Kristian
Top achievements
Rank 2
 answered on 14 Oct 2011
1 answer
98 views
Got a strange one here.
We run a scheduler in timeline mode to show a bunch of bookings for an ad server.
90% of the time it works flawlessly.
But around once or twice a day out of many 10s of hits per day by our staff, the appointments render truncated in the view.
On closer inspection I noticed they are all exactly half-sized.  It's set to 1 day per slot, so ads that are booked for a full day take up half a slot, and a ten-day campaign stretches 5 slots leaving the next 5 days as incorrcectly available. Hitting F5 will always remedy the error, only for it randomly trigger later in the day.

I have applied the actual start and end dates to the tooltip for the appointment and have confirmed that when they truncate, the actual data behind it is still correct. So it seems it is just a rendering issue, not a data source issue.

I can't seem to find any reference to this being a known bug, so I'm still looking at what might be causing it in our implementation.  But it is strange that such a bug should be intermittent.  We're using Firefox v 3.6.3.

Just thought I'd throw it out there in case it rings any bells with anyone.

Thanks for your time
Peter
Telerik team
 answered on 14 Oct 2011
5 answers
781 views
Hello,

I have an issue with a Heirarchy - Grid/Programmatic Binding.

I tried following this example as best as i can: http://demos.telerik.com/aspnet-ajax/grid/examples/programming/detailtabledatabind/defaultcs.aspx

I have a main table and three nested grids:
Main Table 
    -  Table 1
- Table 2
- Table 3

I can expand just find from Main -> Table 1. But when i try to expand a row from table 1 to get to table 2 i keep getting an error "Object reference not set to an instance of an object". I debugged through my code and saw that it breaks down on the line that contains:

portfolioTypeCode = dataItem.GetDataKeyValue("PortfolioTypeCode").ToString();


It's odd that it doesn't work because I can see the PortfoliotypeCode Column in table 1 with all the correct data, and I named everything correctly on the front end. Here is my grid front end (the table not working is named 'PortfolioTypeCode':

<telerik:RadGrid ID="PNLViewGrid" runat="server" Width="100%" AutoGenerateColumns="false"
    AllowSorting="true" AllowPaging="false" OnNeedDataSource="PNLView_NeedDataSource"
    OnDetailTableDataBind="PNLView_DetailTableDataBind">
    <MasterTableView Width="100%" DataKeyNames="PortfolioCode,PortfolioTypeCode,Strategy,StrategyId,SymbolCode,AsOfDate"
        AllowMultiColumnSorting="true">
        <DetailTables>
            <telerik:GridTableView DataKeyNames="PortfolioCode,AsOfDate" Name="PortfolioCode" Width="100%">
                <DetailTables>
                    <telerik:GridTableView DataKeyNames="PortfolioCode,PortfolioTypeCode,AsOfDate" Name="PortfolioTypeCode" Width="100%">
                        <DetailTables>
                            <telerik:GridTableView DataKeyNames="PortfolioCode,PortfolioTypeCode,StrategyId,AsOfDate" Name="Strategy" Width="100%">
                                <Columns>
                                    <telerik:GridBoundColumn SortExpression="SymbolCode" HeaderText="Symbol Code" HeaderButtonType="TextButton" DataField="SymbolCode" />
                                    <telerik:GridBoundColumn SortExpression="DailyPNL" HeaderText="Total Daily PNL" HeaderButtonType="TextButton" DataField="DailyPNL" />
                                    <telerik:GridBoundColumn SortExpression="MTDPNL" HeaderText="Total Montly PNL" HeaderButtonType="TextButton" DataField="MTDPNL" />
                                    <telerik:GridBoundColumn SortExpression="YTDPNL" HeaderText="Total Yearly PNL" HeaderButtonType="TextButton" DataField="YTDPNL" />
                                    <telerik:GridBoundColumn SortExpression="BaseMktValue" HeaderText="Total Base Market Value" HeaderButtonType="TextButton" DataField="BaseMktValue" />
                                    <telerik:GridDateTimeColumn SortExpression="AsOfDate" HeaderText="As Of Date" HeaderButtonType="TextButton" DataField="AsOfDate" Visible="false" />
                                </Columns>
                            </telerik:GridTableView>
                        </DetailTables>
                        <Columns>
                            <telerik:GridNumericColumn SortExpression="StrategyId" HeaderText="StrategyId" HeaderButtonType="TextButton" DataField="StrategyId" Visible="false" />
                            <telerik:GridBoundColumn SortExpression="Strategy" HeaderText="Strategy" HeaderButtonType="TextButton" DataField="Strategy" />
                            <telerik:GridBoundColumn SortExpression="DailyPNL" HeaderText="Total Daily PNL" HeaderButtonType="TextButton" DataField="DailyPNL" />
                            <telerik:GridBoundColumn SortExpression="MTDPNL" HeaderText="Total Montly PNL" HeaderButtonType="TextButton" DataField="MTDPNL" />
                            <telerik:GridBoundColumn SortExpression="YTDPNL" HeaderText="Total Yearly PNL" HeaderButtonType="TextButton" DataField="YTDPNL" />
                            <telerik:GridBoundColumn SortExpression="BaseMktValue" HeaderText="Total Base Market Value" HeaderButtonType="TextButton" DataField="BaseMktValue" />
                            <telerik:GridDateTimeColumn SortExpression="AsOfDate" HeaderText="As Of Date" HeaderButtonType="TextButton" DataField="AsOfDate" Visible="false" />
                        </Columns>
                    </telerik:GridTableView>
                </DetailTables>
                <Columns>
                    <telerik:GridBoundColumn SortExpression="PortfolioTypeCode" HeaderText="Portfolio Type Code" HeaderButtonType="TextButton" DataField="PortfolioTypeCode" />
                    <telerik:GridBoundColumn SortExpression="DailyPNL" HeaderText="Total Daily PNL" HeaderButtonType="TextButton" DataField="DailyPNL" />
                    <telerik:GridBoundColumn SortExpression="MTDPNL" HeaderText="Total Montly PNL" HeaderButtonType="TextButton" DataField="MTDPNL" />
                    <telerik:GridBoundColumn SortExpression="YTDPNL" HeaderText="Total Yearly PNL" HeaderButtonType="TextButton" DataField="YTDPNL" />
                    <telerik:GridBoundColumn SortExpression="BaseMktValue" HeaderText="Total Base Market Value" HeaderButtonType="TextButton" DataField="BaseMktValue" />
                    <telerik:GridDateTimeColumn SortExpression="AsOfDate" HeaderText="As Of Date" HeaderButtonType="TextButton" DataField="AsOfDate" Visible="false" />
                </Columns>
            </telerik:GridTableView>
        </DetailTables>   
        <Columns>
            <telerik:GridBoundColumn SortExpression="PortfolioCode" HeaderText="Portfolio Code" HeaderButtonType="TextButton" DataField="PortfolioCode" />
            <telerik:GridBoundColumn SortExpression="DailyPNL" HeaderText="Total Daily PNL" HeaderButtonType="TextButton" DataField="DailyPNL" />
            <telerik:GridBoundColumn SortExpression="MTDPNL" HeaderText="Total Montly PNL" HeaderButtonType="TextButton" DataField="MTDPNL" />
            <telerik:GridBoundColumn SortExpression="YTDPNL" HeaderText="Total Yearly PNL" HeaderButtonType="TextButton" DataField="YTDPNL" />
            <telerik:GridBoundColumn SortExpression="BaseMktValue" HeaderText="Total Base Market Value" HeaderButtonType="TextButton" DataField="BaseMktValue" />
            <telerik:GridDateTimeColumn SortExpression="AsOfDate" HeaderText="As Of Date" HeaderButtonType="TextButton" DataField="AsOfDate" Visible="false" />
        </Columns>
    </MasterTableView>
</telerik:RadGrid>


Here is my codebehind:

protected void PNLView_DetailTableDataBind(object sender, GridDetailTableDataBindEventArgs e)
       {
           GridDataItem dataItem = (GridDataItem) e.DetailTableView.ParentItem;
           pnlVO item = (pnlVO) dataItem.DataItem;
           string portfolioCode = "";
           string portfolioTypeCode = "";
           string strategy = "";
           int strategyId = 0;
           string date = "";
           switch (e.DetailTableView.Name)
           {
               case "PortfolioCode":
                   portfolioCode = dataItem.GetDataKeyValue("PortfolioCode").ToString();
                   date = dataItem.GetDataKeyValue("AsOfDate").ToString();
                   e.DetailTableView.DataSource = ViewUtil.Instance.GetByPortfolioTypeCode(portfolioCode, date);
                   break;
               case "PortfolioTypeCode":
   ERROR HERE ===> portfolioTypeCode = dataItem.GetDataKeyValue("PortfolioTypeCode").ToString();
                   portfolioCode = dataItem.GetDataKeyValue("PortfolioCode").ToString();
                   date = dataItem.GetDataKeyValue("AsOfDate").ToString();
                   e.DetailTableView.DataSource = ViewUtil.Instance.GetByStrategy(portfolioTypeCode, portfolioCode, date);
                   break;
               case "Strategy":
                   portfolioTypeCode = dataItem.GetDataKeyValue("PortfolioTypeCode").ToString();
                   portfolioCode = dataItem.GetDataKeyValue("PortfolioCode").ToString();
      strategyId = Convert.ToInt32(dataItem.GetDataKeyValue("StrategyId").ToString());
                   date = dataItem.GetDataKeyValue("AsOfDate").ToString();
                   e.DetailTableView.DataSource = ViewUtil.Instance.GetBySymbolCode(portfolioTypeCode, portfolioCode, strategyId, date);
                   break;
           }
       }


Can someone please help me? I know for a fact that the PortfolioTypeCode column is being populated because i can see it in Table 1. Why is it not able to get the datakeyvalue? It looks to me like it can't get the datakeyvalue from a detail nested table but can only read the datakeyvalues whos columns are found within the main table. Anyway around this?

Thanks!
CG
Top achievements
Rank 1
 answered on 14 Oct 2011
3 answers
279 views
Hi

Been trying to deleet an appointment, below is my back code for attempting to delete the appointment

 

 

public void rsAppointments_AppointmentDelete(object sender, SchedulerCancelEventArgs e)

 

{

 

systemBusinessLayer.deleteAppointment(

 

Convert.ToInt32(e.Appointment.ID));

 

}



When i put a brake point I see it doesnt even come near the event.

below is the code from my businesLayer

public

 

 

void deleteAppointment(int appointmentID)

 

{

 

 

using (SqlConnection con = new SqlConnection(ConnString))

 

{

 

 

SqlCommand cmd = new SqlCommand("procDeleteAppointment", con);

 

cmd.CommandType =

 

CommandType.StoredProcedure;

 

cmd.Parameters.Add(

 

new SqlParameter("@appointmentID", SqlDbType.Int));

 

cmd.Parameters[

 

"@appointmentID"].Value = appointmentID;

 

 

 

try

 

{

con.Open();

cmd.ExecuteNonQuery();

}

 

 

catch (SqlException exp)

 

{

 

 

throw new ApplicationException(exp.Message);

 

}

}

}

 


Plamen
Telerik team
 answered on 14 Oct 2011
2 answers
111 views
New to using the Radgrid and trying to learn my way around but I found that I am stuck and need some help.

I have a small web app that allows the user to import a *.csv file that I bind to a RadGrid. I want the user to have the ability to add, edit or delete rows before storing to a table. I've got everything working except adding data.

For the edit (RadGrid.UpdateCommand) I am able to get the Item Index, cast as a GridEditableItem, specify the column name, cast as a textbox and get the text value.

Dim editItem As GridEditableItem = CType(gvMSR.EditItems(e.Item.ItemIndex), GridEditableItem)
dtb.Rows(e.Item.ItemIndex).Item("column1") = CType(editItem("column1").Controls(0), TextBox).Text

When I try to do this for the add record row, which has an Item Index of -1, I get an error "Index was out of range. Must be non-negative and less than the size of the collection."

I have also tried using the unique ID from the sender and concatenating that with the column number to get the unique ID for the individual textbox (which I have verified using Google Chrome dev tools) but get an "Object reference not set to an instance of an object" error.

Dim itemPrefix As String = e.Item.UniqueID.ToString & "$ctl"
dtb.Item("column1") = CType(e.Item.FindControl(itemPrefix & "00"), TextBox).Text

So I'm stuck. I'm sure there is a better way to do this but I'm not familiar enough with RadGrid yet to know how.

Any help is appreciated. Thanks.
License
Top achievements
Rank 1
 answered on 14 Oct 2011
8 answers
365 views
I'm trying to create a form with text boxes and combo boxes, that have a set width and right aligned labels.

Using the label attribute of the of the controls, the final rendered output between the two are not consistent. The text box puts the <label> and the <input type=text> in two different table cells. While the combobox renders with in a single cell. So using CSS on the LabelCssClass doesn't get the same results.

I've seen examples on your site of right aligned text on the combo box (http://demos.telerik.com/aspnet-ajax/combobox/examples/functionality/expandanimation/defaultcs.aspx) but it is using standard text instead of the <label for="">. I need it to use the label tag for 508 compliance.

Can you point me to another example of how this is done?
Princy
Top achievements
Rank 2
 answered on 14 Oct 2011
2 answers
163 views
Hi, I'm trying to create a compositeControl that contains a RadEditor:

public class TextEditorRad : CompositeControl
    {
        public TextEditorRad()
        {
          
  
protected override void OnInit(EventArgs e)
        {
            CreateChildControls();
            base.OnInit(e);
        }
  
        #region CreateChildControls
        protected override void CreateChildControls()
        {
            Controls.Clear();
            editor = new RadEditor();
            editor.ID = "edEdit";
  
            //DoControl();
            this.Controls.Add(editor);
              
        }
        #endregion
        #region RecreateChildControls
        protected override void RecreateChildControls()
        {
            EnsureChildControls();
        }
        #endregion
        #region Render
        protected override void Render(HtmlTextWriter writer)
        {
            AddAttributesToRender(writer);
            editor.RenderControl(writer);            
        }
        #endregion
}

When I drag this from my tool box on to an aspx and view the page, The editor is visible but I cannot select the text area and I get the following error showing in FF error console:
Error: a is undefined
Source File: http://localhost/myapp/Telerik.Web.UI.WebResource.axd?_TSM_HiddenField_=ctl00_RadScriptManager1_TSM&compress=1&_TSM_CombinedScripts_=%3b%3bSystem.Web.Extensions%2c+Version%3d3.5.0.0%2c+Culture%3dneutral%2c+PublicKeyToken%3d31bf3856ad364e35%3aen-US%3ad0c4ca6e-6b5d-49b6-922d-5244924fb100%3aea597d4b%3ab25378d2%3bTelerik.Web.UI%2c+Version%3d2010.1.309.20%2c+Culture%3dneutral%2c+PublicKeyToken%3d121fae78165ba3d4%3aen-US%3af0c88abc-2e1c-4c5d-ab67-8dc4eeeb22f8%3a16e4e7cd%3aed16cbdc%3af7645509%3a24ee1bba%3a1e771326%3ae524c98b%3a874f8ea2%3adc7e0bd%3a1569bb5f%3a63b115ed%3a1c565fc%3a30f1f089%3a19620875%3a33108d14
Line: 6

Any ideas?

Thanks
ric c
Top achievements
Rank 1
 answered on 14 Oct 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Dean
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Emil
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Dean
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Emil
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?