Telerik Forums
UI for ASP.NET AJAX Forum
6 answers
406 views
I am trying to setup a RadComboBox where the first item has a different background color than the rest of the items in the list.  For some reason the BackColor property on the item is not being passed to the generated HTML page when I do a "view source" in the browser.  Here is the control markup:

<telerik:RadComboBox ID="selShipTo" runat="server" AppendDataBoundItems="true"   
    DataTextField="OneLineDisplay" DataValueField="AddressID" style="width: 75%;">  
    <Items> 
        <telerik:RadComboBoxItem runat="server" BackColor="Blue" Text="<<< Use Billing Address >>>" Value="0" /> 
    </Items> 
</telerik:RadComboBox> 
 

I must be missing something here?

Thanks,
Kevin
Jonathan
Top achievements
Rank 1
 answered on 23 Jul 2009
4 answers
239 views
Hello,

We have an application which was already developed by previous developer.We implemented Telerik controls alot.
There is radcalendar which is taking the min value as 1980/01/01. But we need to change it some where around 1950.
I tried to set the value using RangeMinDate property like below.
 
<radCln:RadCalendar ID="sharedCalendar" EnableMultiSelect="false" RangeMinDate="1960/01/01"
            runat="server">
        </radCln:RadCalendar>


But it is not working.It is taking only as 1980/01/01. Please help me out.
Pavlina
Telerik team
 answered on 23 Jul 2009
1 answer
208 views
Hi,

i get an empty excel file on ExcelExport.
I already searched forum and found this thread:

radgrid-export-to-excel-empty-spreadsheet.aspx

I tried setting the MasterPage propertie UseAllDataFields="true", but i get an error at filling the radGrid with data. Like "The column name cant be set with <newnew>, because it wants a Int32 type.".

I also got AutoGenerateColumns="false", i guess its pretty much working like the propertie UseAllDataFields and so it dont fit my custom columns.

Q: What can i change when i not autogenerating?

aspx:

<telerik:RadGrid ID="radGrid" runat="server"  
                                            AllowPaging="True"  
                                            PageSize="30" 
                                            AllowSorting="True"  
                                            AutoGenerateColumns="False" 
                                            GridLines="Both" 
                                            OnExcelMLExportStylesCreated="RadGrid_ExcelMLExportStylesCreated" 
                                            OnExcelMLExportRowCreated="RadGrid_ExcelMLExportRowCreated" 
                                            OnItemCommand="Radgrid_GridCommand" 
                                            OnNeedDataSource="Radgrid_NeedDatasource"
                                             
                                <MasterTableView DataKeyNames="id"  
                                    CommandItemDisplay="Bottom"
                                 
                                    <CommandItemTemplate> 
                                     
                                        <div style="padding: 5px 5px; align: right;"
                                            <asp:ImageButton ID="btnExportToExcel" runat="server"  
                                                        ImageUrl="~/App_Themes/Default/Images/excelfile_icon.gif"  
                                                        OnClick="btnExportToExcel_Click" /> 
                                            <asp:Label ID="lblRelationAdd" runat="server"  
                                                        Text="exportToExcel"  
                                                        OnLoad="OnLabelLoad"></asp:Label> 
                                        </div> 
                                    </CommandItemTemplate> 
                                                                                     
                                    <Columns> 
 
                                        <telerik:GridBoundColumn DataField="id" Visible="false"></telerik:GridBoundColumn> 
                                        <telerik:GridButtonColumn ButtonType="ImageButton" ImageUrl="../App_Themes/Default/Images/file_icon.gif" CommandArgument="id"  CommandName="OpenFile"></telerik:GridButtonColumn> 
                                        <telerik:GridTemplateColumn> 
                                            <ItemTemplate> 
                                                <asp:Image runat="server" ID="imgNew" 
                                                    OnLoad="OnImageLoad" /> 
                                                <asp:TextBox ID="txbNewCreatedDate" runat="server" 
                                                    Visible ="false" 
                                                    Text='<%# DataBinder.Eval(Container.DataItem,"created_date").ToString() %>' /> 
                                            </ItemTemplate> 
                                        </telerik:GridTemplateColumn> 
                                        <telerik:GridHyperLinkColumn DataTextField="Metainformation.name" HeaderText="Profile" DataNavigateUrlFormatString="DocumentProfile.aspx?id={0}" DataNavigateUrlFields="id" ></telerik:GridHyperLinkColumn> 
                                        <telerik:GridBoundColumn DataField="Category.name" HeaderText="Kategorie"></telerik:GridBoundColumn> 
                                        <telerik:GridBoundColumn DataField="User.lastname" HeaderText="Ersteller"></telerik:GridBoundColumn> 
                                        <telerik:GridBoundColumn DataField="created_date" HeaderText="Erstellungsdatum"></telerik:GridBoundColumn> 
                                        <telerik:GridBoundColumn DataField="User1.lastname" HeaderText="letzter Bearbeiter"></telerik:GridBoundColumn> 
                                        <telerik:GridTemplateColumn HeaderText="inuse"
                                            <ItemTemplate> 
                                                <asp:Image runat="server" ID="imgInUse" 
                                                    OnLoad="OnImageLoad"/> 
                                                <asp:TextBox ID="txbInEditMode" runat="server" 
                                                    Visible ="false" 
                                                    Text='<%# DataBinder.Eval(Container.DataItem,"is_ineditmode").ToString() %>' /> 
                                                <asp:TextBox ID="txbIsCheckedout" runat="server" 
                                                    Visible ="false" 
                                                    Text='<%# DataBinder.Eval(Container.DataItem,"is_checkedout").ToString() %>' /> 
                                            </ItemTemplate> 
                                        </telerik:GridTemplateColumn> 
                                        <telerik:GridBoundColumn DataField="checkout_date" DataType="System.DateTime" HeaderText="in Verwendung seit"></telerik:GridBoundColumn> 
                                        <telerik:GridBoundColumn DataField="Folder.name" HeaderText="Ordner"></telerik:GridBoundColumn> 
                                        <telerik:GridTemplateColumn HeaderText="inuse"
                                            <ItemTemplate> 
                                                <asp:ImageButton runat="server" ID="btnDelete" 
                                                    OnLoad="OnImageButtonLoad" OnClick="btnDelete_OnClick"/> 
                                                <asp:TextBox ID="txbDeleteInEditMode" runat="server" 
                                                    Visible ="false" 
                                                    Text='<%# DataBinder.Eval(Container.DataItem,"is_ineditmode").ToString() %>' /> 
                                                <asp:TextBox ID="txbDeleteIsCheckedout" runat="server" 
                                                    Visible ="false" 
                                                    Text='<%# DataBinder.Eval(Container.DataItem,"is_checkedout").ToString() %>' /> 
                                                <asp:TextBox ID="txbDeleteId" runat="server" 
                                                    Visible ="false" 
                                                    Text='<%# DataBinder.Eval(Container.DataItem,"id").ToString() %>' /> 
                                            </ItemTemplate> 
                                        </telerik:GridTemplateColumn> 
                                         
                                    </Columns> 
                                       
                                    <RowIndicatorColumn> 
                                        <HeaderStyle Width="20px"></HeaderStyle> 
                                    </RowIndicatorColumn> 
 
                                    <ExpandCollapseColumn> 
                                        <HeaderStyle Width="20px"></HeaderStyle> 
                                    </ExpandCollapseColumn> 
                                </MasterTableView> 
                                <ClientSettings AllowColumnsReorder="True" ReorderColumnsOnClient="True"
                                    <ClientEvents OnRowContextMenu="RowContextMenu"></ClientEvents> 
                                    <Selecting AllowRowSelect="true" /> 
                                </ClientSettings> 
                            </telerik:RadGrid> 

code behind:

protected void btnExportToExcel_Click(object sender, EventArgs e) 
        { 
            // configure 
            radGrid.ExportSettings.IgnorePaging = true
            radGrid.ExportSettings.Excel.Format = GridExcelExportFormat.ExcelML; 
            radGrid.ExportSettings.ExportOnlyData = true
 
            // export 
            radGrid.MasterTableView.ExportToExcel(); 
        } 
 
        protected void RadGrid_ExcelMLExportRowCreated(object source, Telerik.Web.UI.GridExcelBuilder.GridExportExcelMLRowCreatedArgs e) 
        { 
  
        } 
 
        protected void RadGrid_ExcelMLExportStylesCreated(object source, Telerik.Web.UI.GridExcelBuilder.GridExportExcelMLStyleCreatedArgs e) 
        { 
            foreach (Telerik.Web.UI.GridExcelBuilder.StyleElement style in e.Styles) 
            { 
                if (style.Id == "headerStyle"
                { 
                    style.FontStyle.Bold = true
                    style.FontStyle.Color = System.Drawing.Color.Gainsboro; 
                    style.InteriorStyle.Color = System.Drawing.Color.Wheat; 
                    style.InteriorStyle.Pattern = Telerik.Web.UI.GridExcelBuilder.InteriorPatternType.Solid; 
                } 
                else if (style.Id == "itemStyle"
                { 
                    style.InteriorStyle.Color = System.Drawing.Color.WhiteSmoke; 
                    style.InteriorStyle.Pattern = Telerik.Web.UI.GridExcelBuilder.InteriorPatternType.Solid; 
                } 
                else if (style.Id == "alternatingItemStyle"
                { 
                    style.InteriorStyle.Color = System.Drawing.Color.LightGray; 
                    style.InteriorStyle.Pattern = Telerik.Web.UI.GridExcelBuilder.InteriorPatternType.Solid; 
                } 
            } 
 
            Telerik.Web.UI.GridExcelBuilder.StyleElement myStyle = new Telerik.Web.UI.GridExcelBuilder.StyleElement("MyCustomStyle"); 
            myStyle.FontStyle.Bold = true
            myStyle.FontStyle.Italic = true
            myStyle.InteriorStyle.Color = System.Drawing.Color.Gray; 
            myStyle.InteriorStyle.Pattern = Telerik.Web.UI.GridExcelBuilder.InteriorPatternType.Solid; 
            e.Styles.Add(myStyle); 
        } 


Or shall i fill another invisible radGrid with AutoGenerateColumns="true" and call thats ExportToExcel()

cheers mario

Daniel
Telerik team
 answered on 23 Jul 2009
2 answers
148 views
Hi,

I have a RadGrid with Hierarchy. I would like to access the DataKeyValues (parent/master table Key Values) in the DetailTables' <CommandItemTemplate>.

Here is the code snippet,

<DetailTables>
                           <telerik:GridTableView DataKeyNames="DV_Correlation_Detail_ID" DataSourceID="dsrcCorrDetail" HierarchyDefaultExpanded="true" ShowHeader="true" ShowFooter="false"
                                    Width="100%" runat="server" AllowFilteringByColumn="False" CommandItemDisplay="Top" Name="Correlation_Detail" EditMode="InPlace">
                                <ParentTableRelation>
                                    <telerik:GridRelationFields DetailKeyField="DV_Correlation_ID" MasterKeyField="DV_Correlation_ID" />
                                </ParentTableRelation>
                                <CommandItemTemplate>
                                    <a href="Javascript:showDialog(1,'derived_variable_selection.aspx?CorrID=<%# Eval("DV_Correlation_ID") %>');"><img style="border:0px" alt="Add Independent Variable" src="images/AddRecord.gif" /> Add Independent Variable </a>
                                </CommandItemTemplate>
                               
When I do "Eval()", it did not complain, and it did not return any value, either. How can I get the key value for each hierarchy detail table within CommandItemTemplate?

Any assistance will be very much appreciated.

Thanks,

Arthur W.

art
Top achievements
Rank 1
 answered on 23 Jul 2009
2 answers
114 views
Since 1 image is 1000 words, I can skip the description by providing an image:


Can anyone speculate as to why this happens on mouseover? (The yellowish border is broken between the image and the text)

Thanks!
Kostas Throumoulopoulos
Top achievements
Rank 1
 answered on 23 Jul 2009
1 answer
139 views
Hi, 
I want to make sure that filter menu of search results overlays toolbar pane. When I click at the filter, the top most menu items are getting chopped (i.e not coming at its correct position but above the filter button). I want to know, how can I reposition the filter menu to its correct position, (i.e right next to filter button when I click it).

 

<

 

Rad:BackPanel ID="bpContent" runat="server" Width="100%" Height="0px" Header="Search Results"

 

 

style="position:absolute;" OnClientLoad="OnBPLoad" OnPaneResize="OnBPResize" >div id="divContentMain" style="position:absolute; width:100%; height:50px; top:34px; left:0px;" runat="server">

 

 

 

 

 

 

<rad:RadGrid ID="RadGridResults" runat="server" Style="position: absolute; left: 0px; top: 0px;" ShowStatusBar="true"><ClientSettings>

 

 

<ClientEvents OnGridCreated="GridCreated" OnRowDblClick="OnGridRowDblClick" OnColumnResized="ColumnResize" />
</ClientSettings>
<ExportSettings IgnorePaging="true" OpenInNewWindow="true" ExportOnlyData="true" />

 

 

 

</rad:RadGrid>

 

 

 

<asp:Button ID="Button_RadGridResults_ExportToExcel" runat="server" Text="Export to Excel"

 

 

OnClientClick="ExportRadGridResultsToExcel();" />

 

 

<asp:Button ID="Button_RadGridResults_ExportToWord" runat="server" Text="Export to Word"

 

 

OnClientClick="ExportRadGridResultsToWord();" />

 

 

</div>

 

 

</Rad:BackPanel>

 

Sebastian
Telerik team
 answered on 23 Jul 2009
1 answer
96 views
Hi,
I use ajaxified grid and I want to implement Batch Updates and Insertions from code behind. I have GridDropDown columns and GridDateTime Column. But, when I try to obtain the updated values it only renders "null". It does not update with new values, old values are still displayed.

Here is my code:

 

protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e)

 

{

 

if (e.CommandName == "UpdateAll")

 

{

 

foreach (GridEditableItem editedItem in RadGrid1.EditItems)

 

{

 

Hashtable newValues = new Hashtable();

 

e.Item.OwnerTableView.ExtractValuesFromItem(newValues, editedItem);

 

int usr_id = int.Parse(newValues["usr_id"].ToString());

 

 

int sys_id = int.Parse(newValues["sys_id"].ToString());

 

 

int role_id = int.Parse((editedItem["role_id"].Controls[0] as DropDownList).SelectedItem.Value.ToString());

 

}
}
}

Please help..
Thanks,
RKS

Sebastian
Telerik team
 answered on 23 Jul 2009
3 answers
219 views
Hi

Please can you tell me the best/easiest way to  manually calculate aggregate fields in a grouped grid. I need to be able to reset the variable storing my running total when the grid group has changed. I don't know what is the easiest way to detect if a group has changed. Also the code i use should not crash if the grid is not grouped because the code will be present inside a function which will be called by grids that may or may not be grouped

This was the best i could think of

dim groupIndex as integer = 0 
dim runningTotal as integer = 0 
 
In item data bound event  
 
if e.item.OwnerTableView.groupExpressions = 0  'no grouping  
   runningTotalrunningTotal = runningTotal + column value  
else 'grid is grouped  
   if grid.groupIndex = groupIndex then 'same group as last time  
         runningTotalrunningTotal = runningTotal + column value  
    else 'group changed  
        groupIndex = grid.groupIndex
         runningTotal =  column value  
end if  
 
 
thanks
Peter
Top achievements
Rank 1
 answered on 23 Jul 2009
2 answers
79 views

Greetings:

I'm trying to figure out how I should handle a drag/drop operation.  The source will be a RadTree node and the destination will be a WebGrid. 

Can anyone suggest the way I should go about this.  I'm using VB as the code-behind.  However, I get the feeling I'll need to do this with JAVA script.  I was reading this article which talks about ASP.NET AJAX and the 'Sys.Preview.UI._DragDropManager' class:

http://msdn.microsoft.com/en-us/magazine/cc135985.aspx

The article goes on to say,  "... the ' DragDropManager ' is the glue that binds drag sources and drop targets together. Without it, you'd be writing a ton of code to make drag-and-drop user interfaces work—especially if they had to work in a variety of browsers."

Any thoughts here??

Thanks!!

John
Top achievements
Rank 1
 answered on 23 Jul 2009
4 answers
207 views
If one has a Rad Control in a User Control, is there a way of exposing the client-side evens of the RadControl, as client-side events of the user-control, and then handling these in the page that contains the user control. For instance, let's say I have a tree in a user control. Clicking on certain nodes performs one kind of client-side action (such as navigation), while clicking on others may do something else (like opening rad window dialogs) I can handle the rad tree click event in my container page (ie the page that holds the user control), however this is not a particularly good design, since then the container page must have knowledge of what the various tree nodes are and what should occur if they are clicked. A better design would be such that the tree node click is handled within the user control and then some sort of client-side event is raised within the user control which would be handled within the container page. So, in this scenario, the user control click handler decides which node does what and then raises one of two events... Navigate(sender, eventArgs) or OpenWindow(sender eventArgs). In both cases, the "sender" is the user control. In the first case, the eventArgs would have a property that specifies the url, and likely one that specifies the the target. In the second, the eventArgs would have a propety that specifies the url.

So my basic question is, how would one go about defining these client-side events within the user control that contains the Rad Control?
Albert Shenker
Top achievements
Rank 1
Veteran
Iron
 answered on 23 Jul 2009
Narrow your results
Selected tags
Tags
+? more
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?