Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
348 views
I am creating a grid control through code-behind. I am looping through a list to crerate the columns dynamically. Some of the columns are of type GridCalculatedColumn. For example, my columns are "Total", "Passed" and "PassedPct". The third is the calculated column. When I create this column, I specify its DataFields with...

pctCol.DataFields = New String() {"Passed", "Total"}

and its expression with...

pctCol.Expression = "{0}/{1}"

I am getting an error in the grid databind event and the stack trace (shown below) points to the column experession bind event. It is telling me that:

Cannot find column [Passed].

I commented out the setting of the column expression and the grid was binded, but obviously the calculated column didn't work. I checked to make sure the source columns for the calculated column existed at the point of settting the expression by checking grid.mastertableview.Columns.FindByUniqueName("Passed") and this column exists. So, why is the exprssion not working. Does the expression use some other property (other than UniqueName) to find its component columns?

Or could there be something going on in the Databinding. I create the grid dynamically, set it's mastertableview properties, add dynamic columns,  addthe grid to a panel control on the page, add a handler for the grid's ItemDataBound Event, set the datasource of the grid and call databind, all in that order. All of this occurs within the page load event. Is there something I am missing about binding a dynamically created grid that could be causing the issue?

Stack Trace:
 
[EvaluateException: Cannot find column [Passed].]  
 
   
System.Data.NameNode.Bind(DataTable table, List`1 list) +1186845  
   System.Data.DataExpression.Bind(DataTable table) +59  
   System.Data.DataColumn.SetTable(DataTable table) +4826220  
   System.Data.DataColumnCollection.BaseAdd(DataColumn column) +272  
   System.Data.DataColumnCollection.AddAt(Int32 index, DataColumn column) +78  
   System.Data.DataColumnCollection.Add(DataColumn column) +8  
   Telerik.Web.UI.GridDataTableFromEnumerable.GetColumnsToUse() +1020  
   Telerik.Web.UI.GridDataTableFromEnumerable.FillData() +68  
   Telerik.Web.UI.GridResolveEnumerable.Initialize() +32  
   Telerik.Web.UI.GridResolveEnumerable.EnsureInitialized() +20  
   Telerik.Web.UI.GridEnumerableFromDataView..ctor(GridTableView owner, IEnumerable enumerable, Boolean CaseSensitive, Boolean autoGenerateColumns, GridColumnCollection presentColumns, String[] additionalField, Boolean retrieveAllFields) +158  
   Telerik.Web.UI.GridDataSourceHelper.CreateGridEnumerable(GridTableView owner, IEnumerable enumerable, Boolean caseSensitive, Boolean autoGenerateColumns, GridColumnCollection presentColumns, String[] additionalField, Boolean retrieveAllFields) +129  
   Telerik.Web.UI.GridDataSourceHelper.GetResolvedDataSource(GridTableView owner, Object dataSource, String dataMember, Boolean caseSensitive, Boolean autoGenerateColumns, GridColumnCollection presentColumns, String[] additionalField, Boolean retrieveAllFields) +383  
   Telerik.Web.UI.GridTableView.get_ResolvedDataSource() +140  
   Telerik.Web.UI.GridTableView.CreateChildControls(IEnumerable dataSource, Boolean useDataSource) +33  
   System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data) +57  
   System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data) +114  
   System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +31  
   System.Web.UI.WebControls.DataBoundControl.PerformSelect() +142  
   Telerik.Web.UI.GridTableView.PerformSelect() +4  
   System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +73  
   Telerik.Web.UI.GridTableView.DataBind() +239  
   Telerik.Web.UI.RadGrid.DataBind() +80  
 
Bhaskar
Top achievements
Rank 1
 answered on 20 Nov 2015
1 answer
129 views

I have a lookup feature I am trying to create on a RadGrid when user clicks for a new item.

Currently I have a Textbox and a Button, when the button is clicked I can find the textbox control just fine and I can even give it text in the code behind which will then display said text. However, on the Clickevent I can not see any of the text the user put into the textbox.

 

How can find this textbox on page load or any other event for that matter so that I can grab the users imputed  text to start my search.

 

Thanks

Eyup
Telerik team
 answered on 20 Nov 2015
2 answers
195 views
Hellow, 

Im a computer programmer(asp.net )and im using telerik.

I ve been trying to use one of your controls and im currently stuck with radWizard.

The problem im facing is: the progress bar.(NavigationBarPosition="Top" ProgressBarPosition="Top").

When we start the program at run time, the progress bar current position is not starting at the beginning of the progressBar but it aways starts in center of the element ,even thought the progressbar current position changes .

Progress bar percentaGe looks fine to me.
If you could please give me some advise, it would be greatly appreciated.


Loic
Top achievements
Rank 1
 answered on 20 Nov 2015
5 answers
641 views

I am trying to build a Simple (one level) header colspan in which one header should span two columns.

I should I configure MultiColumnHeader to do this?

 

Marc

Kostadin
Telerik team
 answered on 20 Nov 2015
2 answers
130 views

I need to change the background color of the text box based on the value the user enters.  For instance if the value is less than 10 then I want the background to be blue, if it greater than 20 I want it to be red.  Between 10 and 20 the background should remain white.  I have tried changing the style.background property in the onBlur client event, but have not had any success.  Any help would be appriciated.

 

Eyup
Telerik team
 answered on 20 Nov 2015
5 answers
630 views

I have a RadGrid with 3 levels of hierarchy declared as below (some markup left out for readability)

<telerik:RadGrid    ID="RadGrid1"   
                    runat="server"   
                    AllowSorting="True"   
                    Skin="Office2007"   
                    ShowStatusBar="True"   
                    GridLines="None"   
                    DataSourceID="SQLDataSource1"   
                    AutoGenerateColumns="False" 
                    EnableViewState="true">  
 
    <MasterTableView    HierarchyLoadMode="ServerBind"   
                        EnableNoRecordsTemplate="true"   
                        DataKeyNames="PartGroupID,PartGroupParentID"   
                        Width="100%"   
                        ShowHeader="true"   
                        AllowPaging="false">  
                            <SelfHierarchySettings  ParentKeyName="PartGroupParentID"   
                                                    KeyName="PartGroupID"   
                                                    MaximumDepth="10" /> 

Users will expand/collapse and collapse the structure, but will also modify the data in the grid. When the data is modified, the RadGrid needs to rebind.

RadGrid1.Rebind(); 

Unfortunately when this happens the grid either collapses fully or expands fully depending on whether the

<MasterTableView HierarchyDefaultExpanded="true" 

is set or not.

What I want is for the grid to maintain its expanded/collapsed state after rebinding, otherwise the user has to expand collapse the grid again to navigate back to node they were editing before the ReBind() was called.

Is there any way to preserve the state, short of rolling my own code?


Thanks,

Malcolm
Mousumi
Top achievements
Rank 1
 answered on 20 Nov 2015
1 answer
94 views

I have radcontextmenu where some items have custom attribute "ConfirmationMessage" with a value like "Are you sure you want to delete?"  These attributes are set on the server code-behind on load.

On the client in javascript - the OnClientItemClicking event checks that attribute and presents a radconfirm first. 

It works on the first load of the page, but the attributes are lost after ajax/postback. 

Please advise a fix or workaround.  I am already using the Text, Value properties.  Is there some clever way to use the NavigateURL field without causing it to try to navigate to a page?

Thanks

Sean

Compass
Top achievements
Rank 1
 answered on 19 Nov 2015
0 answers
120 views
Is it possible to add rad combo box to file upload window of rad file explorer ?
pavan
Top achievements
Rank 1
 asked on 19 Nov 2015
1 answer
161 views

Hi,

I am currently using rad file explorer in my project. Is it possible to get a popup window onclick of file upload in rad file explorer. And that popup window should consist of two rad combo boxes. once we make selection in rad combo boxes on the rad popup window then user should be able to click on the fie upload popup window. Is it possible in telerik ?

pavan
Top achievements
Rank 1
 answered on 19 Nov 2015
1 answer
111 views

I'm currently changing background colors of days using the following code:

 

Protected Sub calendar_TimeSlotCreated(sender As Object, e As TimeSlotCreatedEventArgs) Handles calendar.TimeSlotCreated
        If ScheduleDates.Contains(e.TimeSlot.Start) Then
            e.TimeSlot.CssClass = "lightSalmon"
        End If
    End Sub

 

Everything works fine except for weekend days. I know for a fact that my ScheduleDates contains weekend dates because I've debugged it. Every day color is being changed but the weekend days remain unaffected. Any ideas?

Nencho
Telerik team
 answered on 19 Nov 2015
Narrow your results
Selected tags
Tags
+? more
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?