Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
72 views
I have a Hierarchical RADGrid...
<telerik:RadGrid ID="RadGrid1" runat="server"
     GridLines="None" 
     Width="900px"
     OnNeedDataSource="RadGrid1_NeedDataSource"
     oncolumncreated="RadGrid1_ColumnCreated"
     AutoGenerateHierarchy="true"
     AutoGenerateColumns="true" >
</telerik:RadGrid>

That I "adjust" using code-behind...
protected void RadGrid1_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
    this.RadGrid1.DataSource = CreateDataSet();
}
private DataSet CreateDataSet()
{
    DataSet dataset = new DataSet();
    string previousFY = string.Empty;
    string currentFY = string.Empty;
    if (DateTime.Now.Month >= 7)
    {
        previousFY = DateTime.Now.Year.ToString();
        currentFY = (DateTime.Now.Year + 1).ToString();
    }
    else
    {
        previousFY = (DateTime.Now.Year - 1).ToString();
        currentFY = DateTime.Now.Year.ToString();
    }
    OpenDataDataContext db = new OpenDataDataContext();
    // FUND
    var prevFYFundTotals = from t in db.open_FY_Totals
                            join f in db.Funds on new { Fund = t.Fund } equals new { Fund = f.fieldcode }
                            where
                                t.FY == currentFY
                            group new { t, f } by new
                            {
                                t.FY,
                                Fund = t.Fund.Substring(0, 2)
                            } into g
                            orderby
                                g.Key.FY,
                                g.Key.Fund
                            select new
                            {
                                g.Key.FY,
                                g.Key.Fund,
                                Fund_Desc = g.Max(p => p.f.desc30),
                                Budget = String.Format("{0:$#,0.00}", (System.Decimal?)g.Sum(p => p.t.BudgetAmt)),
                                Actual = String.Format("{0:$#,0.00}", (System.Decimal?)g.Sum(p => p.t.ActualAmt)),
                                Encumbered = String.Format("{0:$#,0.00}", (System.Decimal?)g.Sum(p => p.t.EncAmt)),
                                Committed = String.Format("{0:$#,0.00}", (System.Decimal?)(g.Sum(p => p.t.ActualAmt) + g.Sum(p => p.t.EncAmt))),
                                PercentCommitted = String.Format("{0:0.00}%", (Decimal?)Convert.ToDecimal((g.Sum(p => p.t.ActualAmt) + g.Sum(p => p.t.EncAmt)) / g.Sum(p => p.t.BudgetAmt) * 100)),
                                Remaining = String.Format("{0:$#,0.00}", (System.Decimal?)(g.Sum(p => p.t.BudgetAmt) - (g.Sum(p => p.t.ActualAmt) + g.Sum(p => p.t.EncAmt))))
                            };
    DataTable dtPrevFYFundTotals = new DataTable();
    dtPrevFYFundTotals.TableName = "PrevFYFundTotals";
    dtPrevFYFundTotals.Columns.Add("Fund", typeof(string));
    dtPrevFYFundTotals.Columns.Add("Fund_Desc", typeof(string));
    dtPrevFYFundTotals.Columns.Add("Budget", typeof(string));
    dtPrevFYFundTotals.Columns.Add("Actual", typeof(string));
    dtPrevFYFundTotals.Columns.Add("Encumbered", typeof(string));
    dtPrevFYFundTotals.Columns.Add("Committed", typeof(string));
    dtPrevFYFundTotals.Columns.Add("PercentCommitted", typeof(string));
    dtPrevFYFundTotals.Columns.Add("Remaining", typeof(string));
    DataColumn[] keys = new DataColumn[1];
    keys[0] = dtPrevFYFundTotals.Columns["Fund"];
    dtPrevFYFundTotals.PrimaryKey = keys;
    dataset.Tables.Add(dtPrevFYFundTotals);
    foreach (var item in prevFYFundTotals)
    {
        dtPrevFYFundTotals.Rows.Add(new object[] { item.Fund, item.Fund_Desc, item.Budget, item.Actual, item.Encumbered, item.Committed, item.PercentCommitted, item.Remaining });
    }
    // RESP
    var prevFYRespTotals = from t in db.open_FY_Totals
                            join r in db.Resps on new { Resp = t.Resp } equals new { Resp = r.fieldcode }
                            where
                                t.FY == currentFY
                            group new { t, r } by new
                            {
                                t.FY,
                                Fund = t.Fund.Substring(0, 2),
                                t.Resp
                            } into g
                            orderby
                                g.Key.Fund,
                                g.Key.Resp
                            select new
                            {
                                Fund = g.Key.Fund.Substring(0, 2),
                                Resp = g.Key.Resp.Replace(".", ""),
                                Resp_Desc = g.Max(p => p.r.desc30),
                                Budget = String.Format("{0:$#,0.00}", (System.Decimal?)g.Sum(p => p.t.BudgetAmt)),
                                Actual = String.Format("{0:$#,0.00}", (System.Decimal?)g.Sum(p => p.t.ActualAmt)),
                                Encumbered = String.Format("{0:$#,0.00}", (System.Decimal?)g.Sum(p => p.t.EncAmt)),
                                Committed = String.Format("{0:$#,0.00}", (System.Decimal?)(g.Sum(p => p.t.ActualAmt) + g.Sum(p => p.t.EncAmt))),
                                PercentCommitted = String.Format("{0:0.00}%", g.Sum(p => p.t.BudgetAmt) > 0 ? ((g.Sum(p => p.t.ActualAmt) + g.Sum(p => p.t.EncAmt)) / g.Sum(p => p.t.BudgetAmt)) * 100 : 0),
                                Remaining = String.Format("{0:$#,0.00}", (System.Decimal?)(g.Sum(p => p.t.BudgetAmt) - (g.Sum(p => p.t.ActualAmt) + g.Sum(p => p.t.EncAmt))))
                            };
    DataTable dtPrevFYRespTotals = new DataTable();
    dtPrevFYRespTotals.TableName = "PrevFYRespTotals";
    dtPrevFYRespTotals.Columns.Add("Fund", typeof(string));
    dtPrevFYRespTotals.Columns.Add("Resp", typeof(string));
    dtPrevFYRespTotals.Columns.Add("Resp_Desc", typeof(string));
    dtPrevFYRespTotals.Columns.Add("Budget", typeof(string));
    dtPrevFYRespTotals.Columns.Add("Actual", typeof(string));
    dtPrevFYRespTotals.Columns.Add("Encumbered", typeof(string));
    dtPrevFYRespTotals.Columns.Add("Committed", typeof(string));
    dtPrevFYRespTotals.Columns.Add("PercentCommitted", typeof(string));
    dtPrevFYRespTotals.Columns.Add("Remaining", typeof(string));
    keys = new DataColumn[2];
    keys[0] = dtPrevFYRespTotals.Columns["Fund"];
    keys[1] = dtPrevFYRespTotals.Columns["Resp"];
    dtPrevFYRespTotals.PrimaryKey = keys;
    dataset.Tables.Add(dtPrevFYRespTotals);
    foreach (var item in prevFYRespTotals)
    {
        dtPrevFYRespTotals.Rows.Add(new object[] { item.Fund, item.Resp, item.Resp_Desc, item.Budget, item.Actual, item.Encumbered, item.Committed, item.PercentCommitted, item.Remaining });
    }
    //OBJECT
    var prevFYObjTotals = from t in db.open_FY_Totals
                            join o in db.Object_Mgts on new { Obj = t.Obj } equals new { Obj = o.fieldcode }
                            where
                            t.FY == currentFY
                            group new { t, o } by new
                            {
                                t.FY,
                                Fund = t.Fund.Substring(0, 2),
                                t.Resp,
                                t.Obj
                            } into g
                            orderby
                            g.Key.Fund,
                            g.Key.Resp,
                            g.Key.Obj
                            select new
                            {
                                Fund = g.Key.Fund.Substring(0, 2),
                                Resp = g.Key.Resp.Replace(".", ""),
                                Obj = g.Key.Obj.Replace(".", ""),
                                Obj_Desc = g.Max(p => p.o.desc30),
                                Budget = String.Format("{0:$#,0.00}", (System.Decimal?)g.Sum(p => p.t.BudgetAmt)),
                                Actual = String.Format("{0:$#,0.00}", (System.Decimal?)g.Sum(p => p.t.ActualAmt)),
                                Encumbered = String.Format("{0:$#,0.00}", (System.Decimal?)g.Sum(p => p.t.EncAmt)),
                                Committed = String.Format("{0:$#,0.00}", (System.Decimal?)(g.Sum(p => p.t.ActualAmt) + g.Sum(p => p.t.EncAmt))),
                                PercentCommitted = String.Format("{0:0.00}%", g.Sum(p => p.t.BudgetAmt) > 0 ? ((g.Sum(p => p.t.ActualAmt) + g.Sum(p => p.t.EncAmt)) / g.Sum(p => p.t.BudgetAmt)) * 100 : 0),
                                Remaining = String.Format("{0:$#,0.00}", (System.Decimal?)(g.Sum(p => p.t.BudgetAmt) - (g.Sum(p => p.t.ActualAmt) + g.Sum(p => p.t.EncAmt))))
                            };
    DataTable dtPrevFYObjTotals = new DataTable();
    dtPrevFYObjTotals.TableName = "PrevFYObjTotals";
    dtPrevFYObjTotals.Columns.Add("Fund", typeof(string));
    dtPrevFYObjTotals.Columns.Add("Resp", typeof(string));
    dtPrevFYObjTotals.Columns.Add("Obj", typeof(string));
    dtPrevFYObjTotals.Columns.Add("Obj_Desc", typeof(string));
    dtPrevFYObjTotals.Columns.Add("Budget", typeof(string));
    dtPrevFYObjTotals.Columns.Add("Actual", typeof(string));
    dtPrevFYObjTotals.Columns.Add("Encumbered", typeof(string));
    dtPrevFYObjTotals.Columns.Add("Committed", typeof(string));
    dtPrevFYObjTotals.Columns.Add("PercentCommitted", typeof(string));
    dtPrevFYObjTotals.Columns.Add("Remaining", typeof(string));
    keys = new DataColumn[3];
    keys[0] = dtPrevFYObjTotals.Columns["Fund"];
    keys[1] = dtPrevFYObjTotals.Columns["Resp"];
    keys[2] = dtPrevFYObjTotals.Columns["Obj"];
    dtPrevFYObjTotals.PrimaryKey = keys;
    dataset.Tables.Add(dtPrevFYObjTotals);
    foreach (var item in prevFYObjTotals)
    {
        dtPrevFYObjTotals.Rows.Add(new object[] { item.Fund, item.Resp, item.Obj, item.Obj_Desc, item.Budget, item.Actual, item.Encumbered, item.Committed, item.PercentCommitted, item.Remaining });
    }
    // Create Relationships
    // Fund DataTable to Resp DataTable relationship
    DataRelation FundRespRelation = new DataRelation("FundResp", dataset.Tables["PrevFYFundTotals"].Columns["Fund"],
                                                                    dataset.Tables["PrevFYRespTotals"].Columns["Fund"]);
    // Resp DataTable to Obj DataTable
    DataRelation RespObjRelation = new DataRelation("RespObj", dataset.Tables["PrevFYRespTotals"].Columns["Resp"],
                                                                    dataset.Tables["PrevFYObjTotals"].Columns["Resp"]);
    // there may not be records all the way down...
    dataset.EnforceConstraints = false;
    dataset.Relations.Add(FundRespRelation);
    dataset.Relations.Add(RespObjRelation);
    return dataset;
}
protected void RadGrid1_ColumnCreated(object sender, GridColumnCreatedEventArgs e)
{
    if (e.Column.UniqueName == "Fund")
        e.Column.Visible = false;
    else if (e.Column.UniqueName == "Resp")
        e.Column.Visible = false;
    else if (e.Column.UniqueName == "Obj")
        e.Column.Visible = false;
    else if (e.Column.HeaderText.Contains("Desc"))
    {
        e.Column.HeaderText = "Account Description";
        e.Column.HeaderStyle.HorizontalAlign = HorizontalAlign.Center;
        e.Column.HeaderStyle.VerticalAlign = VerticalAlign.Bottom;
        if (e.OwnerTableView.Name == "")
            e.Column.HeaderStyle.Width = Unit.Pixel(350);
        else if (e.OwnerTableView.Name == "PrevFYRespTotals")
            e.Column.HeaderStyle.Width = Unit.Pixel(265);
        else
            e.Column.HeaderStyle.Width = Unit.Pixel(240);
    }
    else if (e.Column.HeaderText == "Budget")
    {
        e.Column.HeaderText = "Annual Budget";
        e.Column.HeaderStyle.HorizontalAlign = HorizontalAlign.Right;
        e.Column.HeaderStyle.VerticalAlign = VerticalAlign.Bottom;
        e.Column.HeaderStyle.Width = Unit.Pixel(100);
        e.Column.ItemStyle.HorizontalAlign = HorizontalAlign.Right;
    }
    else if (e.Column.HeaderText == "Actual")
    {
        e.Column.HeaderText = "Actual Spent";
        e.Column.HeaderStyle.HorizontalAlign = HorizontalAlign.Right;
        e.Column.HeaderStyle.VerticalAlign = VerticalAlign.Bottom;
        e.Column.HeaderStyle.Width = Unit.Pixel(100);
        e.Column.ItemStyle.HorizontalAlign = HorizontalAlign.Right;
    }
    else if (e.Column.HeaderText == "Encumbered")
    {
        e.Column.HeaderText = "Unpaid Purchase Orders";
        e.Column.HeaderStyle.HorizontalAlign = HorizontalAlign.Right;
        e.Column.HeaderStyle.VerticalAlign = VerticalAlign.Bottom;
        e.Column.HeaderStyle.Width = Unit.Pixel(100);
        e.Column.ItemStyle.HorizontalAlign = HorizontalAlign.Right;
    }
    else if (e.Column.HeaderText == "Committed")
    {
        e.Column.HeaderText = "Total Committed";
        e.Column.HeaderStyle.HorizontalAlign = HorizontalAlign.Right;
        e.Column.HeaderStyle.VerticalAlign = VerticalAlign.Bottom;
        e.Column.HeaderStyle.Width = Unit.Pixel(100);
        e.Column.ItemStyle.HorizontalAlign = HorizontalAlign.Right;
    }
    else if (e.Column.HeaderText == "Percent Committed")
    {
        e.Column.HeaderText = "Percent Committed";
        e.Column.HeaderStyle.HorizontalAlign = HorizontalAlign.Right;
        e.Column.HeaderStyle.VerticalAlign = VerticalAlign.Bottom;
        e.Column.HeaderStyle.Width = Unit.Pixel(50);
        e.Column.ItemStyle.HorizontalAlign = HorizontalAlign.Right;
    }
    else if (e.Column.HeaderText == "Remaining")
    {
        e.Column.HeaderText = "Remaining Budget";
        e.Column.HeaderStyle.HorizontalAlign = HorizontalAlign.Right;
        e.Column.HeaderStyle.VerticalAlign = VerticalAlign.Bottom;
        e.Column.HeaderStyle.Width = Unit.Pixel(100);
        e.Column.ItemStyle.HorizontalAlign = HorizontalAlign.Right;
    }
}

The result is attached...

I want to add 'Google-like filtering' but I only need to filter on the 'Account Description' column (at each level).

I looked at the Telerik.Web.Examples.Integration.GridAndCombo example and tried to use it as a jumping off point but since it isn't a hierarchical grid i started running into walls.

Can you please point me in the right direction?
Tsvetina
Telerik team
 answered on 03 Feb 2011
1 answer
187 views
Hi guys (and girls),

I have been scouring the net for a solution to a problem some colleagues of mine have been having but have been unsuccessful in finding an answer.

Problem :  Our default browser here is IE 6.0 and our Web Server is running IIS 6.0 and we are having all sorts of issues with CSS (which we currently did not have using IE 6.0 and VS 2010) so we have decided to see if we have the same problems running on IIS 7.0.  Now here is the problem, I cannot get any of the RAD controls to actually render onto the page?  Now I have read posts saying that the app pool should run in classic or you can add a handler to the <system.webServer> section of the web.config file but neither have made any change.

<add name="Telerik_Web_UI_WebResource_axd" path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" verb="*" preCondition="integratedMode,runtimeVersionv2.0"/>

Initially I had a bit of trouble getting classic to work due to the ISAPI and CGI http Handlers not being enabled but I think I managed to sort that out.

Any help on the issue would be much appreciated.

Thanks in advance,
                            Matthew Burhop
Iana Tsolova
Telerik team
 answered on 03 Feb 2011
1 answer
76 views
Hi in my application i have a radwindow with  treeview inside a combobox for selecting items ...
Issue is i have set the height and width of the window, and if i click the combobox the height remains the same but i am getting a scrollbar to navigate the treeview...

what property can i set inorder to display the treeview items out of the window if it exceeds the window height so that users don wnat to scroll the window for selecting the items...

Georgi Tunev
Telerik team
 answered on 03 Feb 2011
1 answer
46 views
Hi,

I'm dynamically creating a RadGrid on PageLoad event and binding some data.
i have set the property EnableEmbededSkins="false" i have imported the skin file to the "/app_themes/forest/grid.css".
i have set the property Skin="Forest". i have enabled grouping options in the grid.

problem is I'm not able to see style for the "Grouping" buttons.
one more problem is sum of all columns width  is not taking 100%.
i have set the grid width property to 100%.

Thanks
K²


Iana Tsolova
Telerik team
 answered on 03 Feb 2011
1 answer
144 views
Hi,
i am facing following problem with RadGrid if i am using ClientEvents-OnCommand.
the problem is if i am adding ClientEvents-OnCommand in radgrid, it does fire itemcomamnd event of grid for user defined command,
but it always points to the first item in radgrid (e.Item) .


 .ascx

       <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">

            <script type="text/javascript">

                    function OnCommand(sender, args) {
                    // it is doing nothing
                }

            </script>

        </telerik:RadCodeBlock>



.cs

    protected void Page_Load(object sender, EventArgs e)
    {
        this.RadGrid1.ItemCommand += OnItemCommand;
        this.RadGrid1.ClientSettings.ClientEvents.OnCommand = "OnCommand";
    }

    void OnItemCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
    {
        if (e.Item == null)
            return;

        switch (e.CommandName)
        {
            // user defined
            case "Standard":

                 GridDataItem item = (GridDataItem)e.Item;

                // e.g  id is always Id of the first item in radgrid if ClientEvents-OnCommand is defined
                var id = new Guid(item["Id"].Text);
... etc


if i remove ClientEvents-OnCommand, it works fine.


am i doing anything wrong ?
Princy
Top achievements
Rank 2
 answered on 03 Feb 2011
3 answers
62 views
So I have a Grid with a header that is multiple lined.  I allow my user to sort the grid on any of the columns.  When they click the column header to perform said sort, the column header get odd looking.  I don't know how to exactly describe it so I have attached screen shots of the header when the grid 1st comes up and one after sorting.  I have also included my grid source code.
<telerik:RadGrid ID="rgResults" runat="server" Width="98%"
    DataSourceID="sqlResults" AllowPaging="True" GridLines="Both"
    AllowSorting="True" AutoGenerateColumns="False" BackColor="WhiteSmoke" 
    HorizontalAlign="Left" Font-Names="Verdana" Font-Size="10px" 
    Skin="Windows7" Height="500px">
    <ClientSettings AllowDragToGroup="False">
        <Scrolling AllowScroll="True" UseStaticHeaders="True" FrozenColumnsCount="4" /> 
        <Selecting AllowRowSelect="True" />
        <Resizing AllowColumnResize="True" AllowResizeToFit="True" EnableRealTimeResize="True" ResizeGridOnColumnResize="True" />                            
    </ClientSettings>
    <AlternatingItemStyle Font-Names="Verdana" Font-Size="9px" 
        BackColor="#CCFFCC" VerticalAlign="Top" />
    <HeaderStyle Font-Bold="True" HorizontalAlign="Center" BackColor="#3366CC" 
        ForeColor="White" Wrap="False" Height="35px" />
    <ItemStyle Font-Names="Verdana" Font-Size="9px" BackColor="WhiteSmoke" VerticalAlign="Top" />
    <MasterTableView AllowMultiColumnSorting="True" GridLines="Both">
        <CommandItemSettings ExportToPdfText="Export to Pdf" />
        <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
            <HeaderStyle Width="20px" />
        </RowIndicatorColumn>
        <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
            <HeaderStyle Width="20px" />
        </ExpandCollapseColumn>
        <Columns>
            <telerik:GridBoundColumn DataField="act_tick_id" 
                FilterControlAltText="Filter column column" UniqueName="ID" Visible="False">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="Target_DT" 
                FilterControlAltText="Filter column column"  HeaderStyle-Width="88px"
                HeaderText="Target Close<br />Date & Time" UniqueName="TargDT" DataType="System.DateTime"  DataFormatString="{0:MM/dd/yyyy hh:mm tt}">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="priority_code" 
                FilterControlAltText="Filter Priority column" HeaderText="Priority" 
                UniqueName="Priority"  HeaderStyle-Width="55px">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="act_step_ticket_num" 
                FilterControlAltText="Filter column column" HeaderText="Ticket #" 
                UniqueName="Ticketnum" AutoPostBackOnFilter="True">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="acct_number" 
                FilterControlAltText="Filter column column" HeaderText="Account #" 
                UniqueName="AcctNum">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="line_num" 
                FilterControlAltText="Filter column column" HeaderText="Line #" 
                UniqueName="LineNum">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="act_step_open_csr" 
                FilterControlAltText="Filter column column" HeaderText="Open By" 
                UniqueName="OpenBy">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="user_group_code" 
                FilterControlAltText="Filter column column" HeaderText="Current<br />Group" 
                UniqueName="CurrGrp">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="user_first" 
                FilterControlAltText="Filter column column" HeaderText="Member" 
                UniqueName="Member">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="act_code" 
                FilterControlAltText="Filter column column" HeaderText="Action<br />Code" 
                UniqueName="ActCode">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="status_desc" 
                FilterControlAltText="Filter column column" HeaderText="Status" 
                UniqueName="Status">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="Open_DT" 
                FilterControlAltText="Filter column column" HeaderText="Open<br />Date & Time" 
                UniqueName="Open_DT"  HeaderStyle-Width="88px">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="Phase_DT" 
                FilterControlAltText="Filter column column" HeaderText="Phase<br />Date & Time" 
                UniqueName="Phase_DT"  HeaderStyle-Width="88px">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="Close_DT" 
                FilterControlAltText="Filter column column" HeaderText="Actual Close<br />Date & Time" 
                UniqueName="Close_DT"  HeaderStyle-Width="88px">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="act_overall_due_status" 
                FilterControlAltText="Filter column column" HeaderText="Close<br />Status" 
                UniqueName="CloseStat">
            </telerik:GridBoundColumn>
        </Columns>
        <EditFormSettings>
            <EditColumn FilterControlAltText="Filter EditCommandColumn column">
            </EditColumn>
        </EditFormSettings>
    </MasterTableView>
    <FilterMenu EnableImageSprites="False">
    </FilterMenu>
    <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default">
    </HeaderContextMenu>
</telerik:RadGrid>
I am using the latest versoin of the software and I am observing this anomally in IE8.
Pavlina
Telerik team
 answered on 03 Feb 2011
5 answers
117 views
Is it possible to transfer items to\from a listbox to\from other types of controls? Or is it exclusive feature for listboxes? I'd really like to transfer items from a radgrid to a listbox.
Thanks.
Genady Sergeev
Telerik team
 answered on 03 Feb 2011
5 answers
99 views
Hi,

I am using jQuery to prepopulate a number of fields on a new item form, with one of the fields utilising the RadEditor. I can populate the field fine, but would like to add line breaks and unsure if and how to do so. So basically I want to be able to pass in a string to the RadEditor and including some basic formatting (tabs, new lines etc)

"This is what I have now: Add description here"
 -------------------------------------
"This is wat I would like:

Add description here"


How can I achieve this?

Thanks

David
Stanimir
Telerik team
 answered on 03 Feb 2011
3 answers
207 views
Hi,
is it possible to load a usercontrol client-side to show as tooltip?

I have problems with using the manager.targetcontrols.add... it feels like random, sometimes the tooltip shows up sometimes it doesn't.
So I want to try load the tooltip client-side instead.
I checked out some examples with client-side code:
    function showToolTip(element, id) { 
        var tooltipManager = $find("<%= radToolTipManager.ClientID %>"); 
 
        //If the user hovers the image before the page has loaded, there is no manager created 
        if (!tooltipManager) return
 
        //Find the tooltip for this element if it has been created 
        var tooltip = tooltipManager.getToolTipByElement(element); 
 
        //Create a tooltip if no tooltip exists for such element 
        if (!tooltip) { 
            tooltip = tooltipManager.createToolTip(element); 
 
            //Use the fact that the image was named after a country 
            //Extract the country name from the image, and set it as the value to be supplied to the web-service 
            //var src = element.getAttribute("src", 2); 
            //var country = src.substring (src.lastIndexOf("/") + 1, src.lastIndexOf(".")); 
            alert(id);
            tooltip.set_value(id); 
        } 
 
        tooltip.show(); 
    } 

<telerik:RadToolTipManager ID="radToolTipManager" runat="server" Position="BottomRight" Animation="None" AutoTooltipify="false"  
    Skin="Hay" EnableEmbeddedSkins="false" EnableEmbeddedBaseStylesheet="false" AutoCloseDelay="0" ShowDelay="100" CssClass="tooltip"  
    Width="300" Height="200" OffsetX="10" OffsetY="10"
    <WebServiceSettings Method="GetToolTip" Path="/usercontrols/Tooltip.ascx" /> 
</telerik:RadToolTipManager> 


So far so good, the id is the correct one when I hoover.

Just for fun I tried to set the usercontrol in the managers webservicesettings but when running I get:
The server method 'GetToolTip' failed.

Can this work or do I have to use targetcontrols.add...?

Thanks!

/Mattias

Svetlina Anati
Telerik team
 answered on 03 Feb 2011
3 answers
111 views
Hello,
 i'm implementing the Tooltipified RadGrid on my sharepoint site. I've followed all the instructions on the demo.
Upon mouseover on my radgrid, my tool tip pops-up but it's empty(no content).

I'm using this example: http://demos.telerik.com/aspnet-ajax/tooltip/examples/targetcontrolsandajax/defaultcs.aspx

when I step through the code,  the user control for the tooltip is present and I can view the text attribute of the control.
 
 I also stripped down the user control  page to a bare minimum to  just one label control but I had no success.
 At this point I don't know what's  causing the tool tip to be blank. 
  
 After a few mouseovers on the radgrid items, I get the following error:
-------------
Windows Internet Explorer

Stop running this script?

A script on this page is causing Internet Explorer to run slowly.
If it continues to run, your computer might become
unresponsive.
-----------


ASPX CODE:
<%@ Register Src="ActivityDetails.ascx" TagName="ActivityDetails" TagPrefix="actDetails" %>
 
 <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server">
    </telerik:RadAjaxLoadingPanel>
     
   <telerik:RadToolTipManager ID="RadToolTipManager1" OffsetY="-1" HideEvent="ManualClose"
        Width="250" Height="350" runat="server" EnableShadow="true" OnAjaxUpdate="OnAjaxUpdate" RelativeTo="Element"
        Position="MiddleRight">
    </telerik:RadToolTipManager>
 
   <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="rgCampaigns">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="rgCampaigns" LoadingPanelID="RadAjaxLoadingPanel1" />
                    <telerik:AjaxUpdatedControl ControlID="RadToolTipManager1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>



C# Code:
protected void OnAjaxUpdate(object sender, ToolTipUpdateEventArgs args)
        {
            this.UpdateToolTip(args.Value, args.UpdatePanel);
        }
        private void UpdateToolTip(string ActivityCode, UpdatePanel panel)
        {
            Control ctrl = Page.LoadControl("/_controltemplates/WP_Campaigns/ActivityDetails.ascx");
            panel.ContentTemplateContainer.Controls.Add(ctrl);
                         
            ActivityDetails details = (ActivityDetails)ctrl;
            details.ActivityCode = ActivityCode;
          
        }
 
protected void rgCampaigns_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
        {
         
                        if (e.Item.ItemType == GridItemType.Item || e.Item.ItemType == GridItemType.AlternatingItem)
                        {
                            Control target = e.Item.FindControl("lblTitle");
                            if (!Object.Equals(target, null))
                            {
                                if (!Object.Equals(this.RadToolTipManager1, null))
                                {
                                    //Add the button (target) id to the tooltip manager
                                    this.RadToolTipManager1.TargetControls.Add(target.ClientID, (e.Item as GridDataItem).GetDataKeyValue("GlobalCode").ToString(), true);
 
                                }
                            }
                        }
 
                    
        }
reciated:

USER Control ASPX page:
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ActivityDetails.ascx.cs"
    Inherits="Cosmos3.WebPages.ActivityDetails, Cosmos3.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5f15fbcafb2bcb72" %>
<asp:Label ID="lbltest" runat="server" Text="Label"></asp:Label>


USER Control C# page:
namespace Cosmos3.WebPages
{
    public partial class ActivityDetails : System.Web.UI.UserControl
    {
 
        public string ActivityCode
        {
            get
            {
                if (ViewState["ActivityCode"] == null)
                {
                    return "";
                }
                return (string)ViewState["ActivityCode"];
            }
            set
            {
 
                ViewState["ActivityCode"] = value;
 
            }
        }
 
        protected void Page_Load(object sender, EventArgs e)
        {
 
            lbltest.Text += "<br>Activity code: "+ActivityCode;
            
        }
    }
}


your help is highly appreciated.
Thank you.
-roland




Svetlina Anati
Telerik team
 answered on 03 Feb 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?