Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
102 views
Hi,
As per my requirement, i need to create template column programmatically (I don't know columns of data source at design time).
Am able to add template columns programmatically but data in columns lost in postbacks.
To overcome this, i moved columns adding logic to OnInit event, but same set of columns are adding again and again between postbacks.
I tried

gv1.MasterTableView.Columns.Clear(); and gv1.Columns.Clear(); methods but they have not worked for me.

Please help me to fix this. Sample code will be greatly appreciated.

Thanks,
Sumanth

 


Pavlina
Telerik team
 answered on 12 Oct 2010
1 answer
79 views
Hello,

I have a grid which need to occupy 100% of screen and has lot of columns.

If I give the fixed property it is streched to occupy 100% of the screen but the columns are so condensed and hence the page lacks readability

Is there anyway to stretch the grid to 100% of screen and have horizontal scroll bars to view those columns which are beyond right margin?

Thank you

Regards
Raj
Pavlina
Telerik team
 answered on 12 Oct 2010
2 answers
66 views
hi telerik team,

I have a clientside timer control, a radxmlhttppanel and a radtree. the timer updates the radtree every 10 secondes. it works great, but i have to keep the actual state of the tree after the refresh!

I found following example: http://www.telerik.com/help/aspnet/treeview/tree_store_expanded_callback.html

but if i collapse a node, after the refresh the node is expanded again...

regards,
ingemar
Ingemar
Top achievements
Rank 1
 answered on 12 Oct 2010
2 answers
126 views

I have two comboboxes that are inside a panel control. The panel's visibility is false initially. When the user selects an option, the panel with the 2 combo boxes is made visible. Depending on what the user selects in the first combo box, I need to enable or disable the second combo box client side. However, I am unable to access the combo using $find('<%= cbxAdminAction.ClientID %>'). 

I have also tried accessing the combo boxes usingTelerik.Web.UI.RadComboBox.ComboBoxes. I was able to find the combo controls in the Firebug console. However, when the page loads, Telerik.Web.UI.RadComboBox.ComboBoxes[14] is out of range.

How do I access the combo boxes from client side?

The function below is wired to the onClientSelectedIndexChanged event for the first combo box.

01.function EnableSubActionDropDown(combo, eventArgs)
02.{
03.   var value = Telerik.Web.UI.RadComboBox.ComboBoxes[14].get_value();
04.          
05.     if (value != "99")
06.     {
07.        Telerik.Web.UI.RadComboBox.ComboBoxes[15].disable;
08.      }
09.      else
10.      {
11.        Telerik.Web.UI.RadComboBox.ComboBoxes[15].enable;
12.      }
13.}

Kalina
Telerik team
 answered on 12 Oct 2010
1 answer
64 views
I have code that loads the control that contains the radgird like this:

if (ControlToLoad == "ConCapitalDetailsPS")
           {
               Financial.ConCapitalDetails ucConCapitalDetails = Page.LoadControl("~/Grants/Phases/Financial/ConCapitalDetails.ascx") as Financial.ConCapitalDetails;
               ucConCapitalDetails.ID = "ConCapitalDetailsPS";
               PhaseContent.Controls.Clear();
               PhaseContent.Controls.Add(ucConCapitalDetails);
               ucConCapitalDetails.ActivePhase = ActivePhase;
               ucConCapitalDetails.BindData();
           }


But the problem is I need to load my data into the grid with

 

 

protected void RadGrid1_NeedDataSource(object source, GridNeedDataSourceEventArgs e)

 



So this is being called before I have the chance to load a specific data into the page

//int iGrantID = ActivePhase.GrantId;
          //int iPhaseID = ActivePhase.Id;

So what I need is somehow be able to set properties on that user control BEFORE the NeedDatasrouce so that the NeedDataSource has the parameters it needs.. How would I do that?  The cheating way is perhaps just make a session variable but that seems ugly.. here is the rest of the relevant code (The control being called )

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Thc.Gms.Services;
using Thc.Gms.Core;
using Microsoft.Practices.EnterpriseLibrary.Data;
using System.Data;
using System.Transactions;
using System.Data.Common;
using Telerik.Web.UI;
  
namespace Thc.Gms.Web.UI.Grants.Phases.Financial
{
    public partial class HistoricExpenditures : System.Web.UI.UserControl
    {
        public Thc.Gms.Core.Phase ActivePhase
        {
            get { return ViewState["Phase"] as Thc.Gms.Core.Phase; }
            set
            {
                this.ViewState.Add("Phase", value);
            }
        }
  
        protected void Page_Load(object sender, EventArgs e)
        {
  
        }
  
        protected void RadGrid1_NeedDataSource(object source, GridNeedDataSourceEventArgs e)
        {
            Thc.Gms.Core.Phase ActivePhaseSession = (Phase)Session["ActivePhase"];
            int iGrantID = 267;
            int iPhaseID = 1517;
  
            //int iGrantID = ActivePhase.GrantId;
            //int iPhaseID = ActivePhase.Id;
  
            //GrantService gService = new GrantService();
            //Grant grant = gService.FindBy(ActivePhase.GrantId);
            //City.Text = grant.Address.City;
            //State.Text = grant.Address.State.Abbreviation;
            //GrantName.Text = grant.Name;
            //PhaseNameTitle.Text = ActivePhase.Name;
  
            string sql = "[dbo].[financial_getExpendituresByFtaskId]";
            Database _database = DatabaseFactory.CreateDatabase("GMSData");
            DataSet tempDataset = new DataSet();
            DataTable DetailsData = new DataTable("Details");
            DetailsData.Columns.Add("ftaskid");
            DetailsData.Columns.Add("level2", typeof(string));
            tempDataset.Tables.Add(DetailsData);
  
            using (TransactionScope scope = new TransactionScope())
            {
                using (DbCommand command = _database.GetStoredProcCommand(sql))
                {
                    _database.AddInParameter(command, "@grantid", DbType.Int32, iGrantID);
                    _database.AddInParameter(command, "@phaseid", DbType.Int32, iPhaseID);
                    _database.LoadDataSet(command, tempDataset, "Details");
                }
                scope.Complete();
            }
            RadGrid1.DataSource = tempDataset;
           
        }
  
        public void BindData()
        {
            //int iGrantID = ActivePhase.GrantId;
            //int iPhaseID = ActivePhase.Id;
  
            //GrantService gService = new GrantService();
            //Grant grant = gService.FindBy(ActivePhase.GrantId);
            //City.Text = grant.Address.City;
            //State.Text = grant.Address.State.Abbreviation;
            //GrantName.Text = grant.Name;
            //PhaseNameTitle.Text = ActivePhase.Name;
  
            //string sql = "[dbo].[financial_getExpendituresByFtaskId]";
            //Database _database = DatabaseFactory.CreateDatabase("GMSData");
            //DataSet tempDataset = new DataSet();
            //DataTable DetailsData = new DataTable("Details");
            //DetailsData.Columns.Add("ftaskid");
            //DetailsData.Columns.Add("level2", typeof(string));
            //tempDataset.Tables.Add(DetailsData);
  
            //using (TransactionScope scope = new TransactionScope())
            //{
            //    using (DbCommand command = _database.GetStoredProcCommand(sql))
            //    {
            //        _database.AddInParameter(command, "@grantid", DbType.Int32, iGrantID);
            //        _database.AddInParameter(command, "@phaseid", DbType.Int32, iPhaseID);
            //        _database.LoadDataSet(command, tempDataset, "Details");
            //    }
            //    scope.Complete();
            //}
            //RadGrid1.DataSource = tempDataset;
            //RadGrid1.DataBind();
        }
  
  
        protected void RadGrid1_UpdateCommand(object source, GridCommandEventArgs e)
        {
            int iGrantID = ActivePhase.GrantId;
            int iPhaseID = ActivePhase.Id;
            int iUserID = SessionHelper.CurrentUser.Id;
  
            GridEditableItem editedItem = e.Item as GridEditableItem;
            int iFTaskID = Int32.Parse(editedItem.GetDataKeyValue("ftaskid").ToString());
            int iQtr = Int32.Parse((editedItem["Qtr"].Controls[0] as TextBox).Text);
            int iYear = Int32.Parse((editedItem["Year"].Controls[0] as TextBox).Text);
            decimal dHP6 = decimal.Parse((editedItem["H6_Exp"].Controls[0] as TextBox).Text);
            decimal dPH6 = decimal.Parse((editedItem["PH_Exp"].Controls[0] as TextBox).Text);
            decimal dOth6 = decimal.Parse((editedItem["Oth_Exp"].Controls[0] as TextBox).Text);
            decimal dFF6 = decimal.Parse((editedItem["FF_Exp"].Controls[0] as TextBox).Text);
  
            Dictionary<string, decimal> ExpColl = new Dictionary<string, decimal>();
            ExpColl.Add("H6", dHP6);
            ExpColl.Add("PH", dPH6);
            ExpColl.Add("Oth", dOth6);
            ExpColl.Add("FF", dFF6);
  
            foreach (KeyValuePair<string, decimal> item in ExpColl)
            {
                string sql = "[dbo].[financial_setExpendituresByYearQtr]";
                Database _database = DatabaseFactory.CreateDatabase("GMSData");
  
                using (TransactionScope scope = new TransactionScope())
                {
                    using (DbCommand command = _database.GetStoredProcCommand(sql))
                    {
                        _database.AddInParameter(command, "@grantid", DbType.Int32, iGrantID);
                        _database.AddInParameter(command, "@phaseid", DbType.Int32, iPhaseID);
                        _database.AddInParameter(command, "@ftaskId", DbType.Int32, iFTaskID);
                        _database.AddInParameter(command, "@amount", DbType.Decimal, item.Value);
                        _database.AddInParameter(command, "@fundtype ", DbType.String, item.Key);
                        _database.AddInParameter(command, "@year", DbType.Int32, iYear);
                        _database.AddInParameter(command, "@qtr", DbType.Int32, iQtr);
                        _database.AddInParameter(command, "@userid", DbType.Int32, iUserID);
                        _database.ExecuteNonQuery(command);
                    }
                    scope.Complete();
                }
            }
        }
  
        protected void RadGrid1_DetailTableDataBind(object source, Telerik.Web.UI.GridDetailTableDataBindEventArgs e)
        {
            int iGrantID = ActivePhase.GrantId;
            int iPhaseID = ActivePhase.Id;
            GridDataItem dataItem = (GridDataItem)e.DetailTableView.ParentItem;
            int iCategoryID = Int32.Parse(dataItem.GetDataKeyValue("FTaskID").ToString());
  
            string sql = "[dbo].[financial_getExpendituresOVerTime]";
            Database _database = DatabaseFactory.CreateDatabase("GMSData");
            DataSet tempDataset = new DataSet();
            DataTable DetailsData = new DataTable("Details");
            DetailsData.Columns.Add("ftaskid");
            DetailsData.Columns.Add("qtr", typeof(int));
            DetailsData.Columns.Add("year", typeof(int));
            DetailsData.Columns.Add("H6_Exp", typeof(decimal));
            DetailsData.Columns.Add("H6_Use", typeof(decimal));
            DetailsData.Columns.Add("PH_Exp", typeof(decimal));
            DetailsData.Columns.Add("PH_Use", typeof(decimal));
            DetailsData.Columns.Add("Oth_Exp", typeof(decimal));
            DetailsData.Columns.Add("Oth_Use", typeof(decimal));
            DetailsData.Columns.Add("FF_Exp", typeof(decimal));
            DetailsData.Columns.Add("FF_Use", typeof(decimal));
  
  
            tempDataset.Tables.Add(DetailsData);
  
            using (TransactionScope scope = new TransactionScope())
            {
                using (DbCommand command = _database.GetStoredProcCommand(sql))
                {
                    _database.AddInParameter(command, "@grantid", DbType.Int32, iGrantID);
                    _database.AddInParameter(command, "@phaseid", DbType.Int32, iPhaseID);
                    _database.AddInParameter(command, "@ftaskId", DbType.Int32, iCategoryID);
                    _database.LoadDataSet(command, tempDataset, "Details");
                }
                scope.Complete();
            }
  
            RadGrid1.DataSource = tempDataset;     
          //  RadGrid1.DataBind();
        }
  
        protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridEditFormItem && e.Item.IsInEditMode && e.Item.OwnerTableView.Name == "GridDetails")
            {
                GridEditFormItem editItem = (GridEditFormItem)e.Item;
                if (false)
                {
                    TextBox txt = (TextBox)editItem.FindControl("unH6_Exp");
                    txt.ReadOnly = true;
                }
            }
        }
  
        
  
    }
}


Tsvetina
Telerik team
 answered on 12 Oct 2010
2 answers
66 views
Hi,
I am using this code on page which includes masterpage for center popup edit but when i click close button on popup edit form it gives me error.

The numeric part ('159.5') of '159.5px' cannot be parsed as a numeric part of a Pixel unit.



<
telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
<
script type="text/javascript">
   
var popUp;
   function PopUpShowing(sender, eventArgs)
   {
       popUp = eventArgs.get_popUp();
       var gridWidth = sender.get_element().offsetWidth;
       var gridHeight = sender.get_element().offsetHeight;
       var popUpWidth = popUp.style.width.substr(0,popUp.style.width.indexOf("px"));
       var popUpHeight = popUp.style.height.substr(0,popUp.style.height.indexOf("px"));
       popUp.style.left = ((gridWidth - popUpWidth)/2 + sender.get_element().offsetLeft).toString() + "px";
       popUp.style.top = ((gridHeight - popUpHeight)/2 + sender.get_element().offsetTop).toString() + "px";
   }
</script>
</
telerik:RadCodeBlock>



Teoman
Top achievements
Rank 1
 answered on 12 Oct 2010
4 answers
130 views
Hello Telerik.
I am using RadSiteMap in my application. But I am not able to set the skin of it as shown in the link
http://demos.telerik.com/aspnet-ajax/sitemap/examples/nodelines/defaultcs.aspx
Here is what I did:
<telerik:RadFormDecorator ID="RadFormDecorator1" runat="server" EnableEmbeddedSkins="false" Skin="Custom" />
    <telerik:RadSiteMap ID="RadSiteMap1" runat="server" ShowNodeLines="True" EnableEmbeddedSkins="False"
        Skin="Custom">
        <Nodes>
            <telerik:RadSiteMapNode runat="server" NavigateUrl="~/Administrator/AdminHome.aspx"
                Text="Administrator Home" ToolTip="Administrator Home">
                <Nodes>
                    <telerik:RadSiteMapNode runat="server"
                        NavigateUrl="~/Administrator/DeleteRoutine.aspx" Text="Delete Class Routine"
                        ToolTip="Delete Class Routine">
                    </telerik:RadSiteMapNode>
                    <telerik:RadSiteMapNode runat="server" NavigateUrl="~/Administrator/DeleteUser.aspx"
                        Text="Delete User" ToolTip="Delete User">
                    </telerik:RadSiteMapNode>
                    <telerik:RadSiteMapNode runat="server" NavigateUrl="~/Administrator/RoutineFileUpload.aspx"
                        Text="Upload Class Routine" ToolTip="Upload Class Routine">
                    </telerik:RadSiteMapNode>
                    <telerik:RadSiteMapNode runat="server"
                        NavigateUrl="~/Administrator/UsersProfileEdit.aspx" Text="Edit Profile"
                        ToolTip="Edit Profile">
                    </telerik:RadSiteMapNode>
                    <telerik:RadSiteMapNode runat="server"
                        NavigateUrl="~/Administrator/UsersProfileView.aspx" Text="View Profile"
                        ToolTip="View Profile">
                    </telerik:RadSiteMapNode>
                </Nodes>
            </telerik:RadSiteMapNode>
        </Nodes>
    </telerik:RadSiteMap>
I am using using actually black skin as the machine where I will run my application does not have Telerik installed, so I copy and attach the skin directory to my project and call these as:
 <link href="../CustomSkin/SiteMap.Custom.css" rel="stylesheet" type="text/css" />
<link href="../CustomSkin/FormDecorator.Custom.css" rel="stylesheet" type="text/css" />
Everything is fine except the black background as shown in the above link. What else should I add to get that one.
Thank you.
And lastly Telerik is awesome.
Sebastian
Telerik team
 answered on 12 Oct 2010
13 answers
224 views
We're having an issue with IE6 and menus with a third level in them. You have the top menu, which is clicked, and another menu displays. Some of these items have other items under them which when hover over it, it displays another level of items. When we do this however, we're getting "Object doesn't support this property or method". Has anyone else run across this. It works in IE7 and 8, but not in IE 6. The items never display, we just get a JavaScript error.

Thanks,
Adam
Simon
Telerik team
 answered on 12 Oct 2010
3 answers
273 views
Hello,

I have Two questions (not related):
1) I'm wonder if I can build my radgrid control using two different edit forms and each edit form has its webusercontrol.
2) How can I change the edit form content depending on a column UniqueName , In others words, I have two

GridEditCommandColumn

 

 

's and depending on there UniqueNames I want to display different content in the edit-form. 

my radgid:

<telerik:RadGrid ID="ConcertsRadGrid" runat="server" Skin="WebBlue" AllowFilteringByColumn="false"
                    GridLines="None" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False"
                    ShowStatusBar="true"  OnPreRender="ConcertsRadGrid_PreRender" 
                    OnNeedDataSource="ConcertsRadGrid_NeedDataSource" 
                    onitemcommand="ConcertsRadGrid_ItemCommand1" >
                    <MasterTableView GridLines="None" Width="100%" Dir="RTL" CommandItemDisplay="None" DataKeyNames="CnsrtID">
                        <Columns>
                            <telerik:GridBoundColumn UniqueName="CType" HeaderText="<%$ Resources:Resource, PagesConcertsRadGridCTypeColumn %>" DataField="CType">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn UniqueName="CnsrtName" HeaderText="<%$ Resources:Resource, PagesConcertsRadGridCnsrtNameColumn %>" DataField="CnsrtName">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn UniqueName="Choirs" HeaderText="<%$ Resources:Resource, PagesConcertsRadGridChoirsColumn %>" DataField="Choirs">
                            </telerik:GridBoundColumn>
                            <telerik:GridEditCommandColumn UniqueName="EditCommandColumn1" EditText="<%$ Resources:Resource, PagesConcertsRadGridViewCnsrtColumn %>">
                            </telerik:GridEditCommandColumn>
                            <telerik:GridEditCommandColumn UniqueName="EditCommandColumn2" EditText="<%$ Resources:Resource, PagesConcertsRadGridViewCnsrtColumn %>">
                            </telerik:GridEditCommandColumn>
                        </Columns>
                        <EditFormSettings UserControlName="~/Pages/Concerts/ConcertsSubUserControl.ascx" EditFormType="WebUserControl">
                            <EditColumn UniqueName="EditCommandColumn1">
                            </EditColumn>
                        </EditFormSettings>
                    </MasterTableView>
                </telerik:RadGrid>

Please, I need your help,
It is apprecited to send me the modified code.

Regards,
Bader
Shinu
Top achievements
Rank 2
 answered on 12 Oct 2010
1 answer
105 views
Let's say I have the RadScheduler showing in week mode with each slot shown in intervals of 2 hours...

How can I (in code-behind) get all of the timeslots visible for the current week so that I can iterate through each slot and enable/disable it based on some business rules I have.

Is there a way to do this?
T. Tsonev
Telerik team
 answered on 12 Oct 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Andrey
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Andrey
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?