Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
157 views
Hi there  i need help on binding enum to a radgrid.

I have enum below:
<div>&nbsp;<i>public enum UserType</i></div><div><i>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;{</i></div><div><i>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Default = 1, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</i></div><div><i>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Parameters = 2,</i></div><div><i>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Students = 3,</i></div><div><i>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Marks = 4,</i></div><div><i>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}</i></div> 
and my radgrid defined as follows:
 
<div><i>&lt;telerik:RadGrid id="userGrid" runat="server" AllowFilteringByColumn="false" Width="100%" &nbsp;</i></div><div><i>&nbsp;&nbsp; &nbsp; AutoGenerateColumns="false" PageSize="30" AllowPaging="true"&gt;</i></div><div><i>&nbsp;&nbsp; &nbsp;&lt;MasterTableView&gt;</i></div><div><i>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;Columns&gt;</i></div><div><i>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;telerik:GridTemplateColumn AllowFiltering="false" Resizable="true" UniqueName="value" HeaderText="Pages"&gt;</i></div><div><i>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;ItemTemplate&gt;</i></div><div><i>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;asp:Label ID="asplabelValue" runat="server" ForeColor="Black" Text='&lt;% #Bind("enumValue") %&gt;' Font-Size="Medium"&gt;&lt;/asp:Label&gt;</i></div><div><i>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;/ItemTemplate&gt;</i></div><div><i>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/telerik:GridTemplateColumn&gt;</i></div><div><i>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;telerik:GridTemplateColumn AllowFiltering="false" Resizable="true" UniqueName="pages" HeaderText="Pages"&gt;</i></div><div><i>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;ItemTemplate&gt;</i></div><div><i>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;asp:Label ID="aspPgesLabel" runat="server" ForeColor="Black" Font-Size="Medium" Text='&lt;% #Bind("enumText") %&gt;'&gt;&lt;/asp:Label&gt;</i></div><div><i>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;/ItemTemplate&gt;</i></div><div><i>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/telerik:GridTemplateColumn&gt;</i></div><div><i>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;/Columns&gt;</i></div><div><i>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/MasterTableView&gt;</i></div><div><i>&nbsp;&nbsp; &nbsp;&lt;/telerik:RadGrid&gt;</i></div> 
I need to set the datasource of the grid to the enum, and bind the enum name (text) and enum value as shown int he radgrid definition.

Please, someone help me with code snippets that can achieve this.

thanks.


Yavor
Telerik team
 answered on 13 May 2010
2 answers
238 views
hi,
      I have a requirement of multi column sorting like -  Default Sorting on Columns ,first "Priority", followed by "TargetDate" and then the "Status" on Load of Grid . Right now I am able to apply Sorting on Single column like -

GridSortExpression

 

expression = new GridSortExpression();

 

expression.FieldName =

"Status";

 

expression.SetSortOrder(

"Descending");

 

 

this.RadGrid1.MasterTableView.SortExpressions.AddSortExpression(expression);

 


But How to apply it on Multiple no of columns.Please any body suggest me regarding this.

Regards,
Dheeraj
Dheeraj
Top achievements
Rank 1
 answered on 13 May 2010
1 answer
173 views
 <ItemTemplate>
<telerik:RadTimePicker ClientEvents-OnDateSelected="OnDateSelected"  ID="txt_InD1" runat="server" Width="86"  SelectedDate='<%# Eval("InDay1") %>'    ></telerik:RadTimePicker>
</ItemTemplate>

When I run the project, I get an error on the line above saying "Specific cast is not valid" .  Some values coming from the db are empty strings and I am guessing thats causing this issue.  How can I fix empty strings and null values.  my db field is a char(5) and I am only storing the time values such as 3:31, or 4:30 or 12:58 etc.

Shinu
Top achievements
Rank 2
 answered on 13 May 2010
4 answers
92 views
Hi Admin.
The same Ex: http://demos.telerik.com/aspnet-ajax/controls/examples/integration/gridandmenu/defaultcs.aspx
But i want to use RadMenu with RadMenuItems  the same Ex: http://demos.telerik.com/aspnet-ajax/menu/examples/functionality/templates/defaultcs.aspx
not use RadContextMenu. Can you help me?.
Thanks!

peter huynh
Top achievements
Rank 1
 answered on 13 May 2010
5 answers
295 views
So, I'm trying to set up my grid with keyboard shortcuts.  The following shortcuts work well: grid focus (ctrl-Y), item navigation (up/down keys), insert new item (ctrl-I), edit active item (enter key), and cancel insert/edit (esc key).  However, when an item is in insert/edit mode and I want to save the changes, I should be able to hit the enter key -- but, the grid sorts and I lose all my changes when I hit the enter key.  Why is the grid sorting???  I imagine that if I can solve the sorting issue, then the changes will be saved appropriately -- I hope.

Below is my grid markup...

            <telerik:RadGrid ID="grdCodeLists" runat="server" 
                GridLines="None" AllowPaging="true" PageSize="10" 
                AllowSorting="true" AllowFilteringByColumn="false" 
                AutoGenerateColumns="false" ShowGroupPanel="false" 
                AllowMultiRowEdit="false" AllowAutomaticDeletes="false" 
                AllowAutomaticInserts="false" AllowAutomaticUpdates="false" 
                OnNeedDataSource="grdCodeLists_NeedDataSource" 
                OnInsertCommand="grdCodeLists_InsertCommand" 
                OnUpdateCommand="grdCodeLists_UpdateCommand" 
                OnDeleteCommand="grdCodeLists_DeleteCommand"> 
                 
                <ClientSettings 
                    EnableRowHoverStyle="true" 
                    AllowKeyboardNavigation="true"> 
                    <Selecting AllowRowSelect="true" /> 
                    <KeyboardNavigationSettings 
                        EnableKeyboardShortcuts="true" 
                        AllowActiveRowCycle="true" 
                        FocusKey="Y" RebindKey="R" InitInsertKey="I" /> 
                    <ClientEvents OnRowSelected="RowSelected" /> 
                </ClientSettings> 
                 
                <SortingSettings 
                    SortedAscToolTip="Click to sort descending..." 
                    SortedDescToolTip="Click to sort ascending..." 
                    EnableSkinSortStyles="true" /> 
                     
                <PagerStyle 
                    AlwaysVisible="true" 
                    Mode="NextPrevAndNumeric" 
                    Position="Bottom" /> 
                                    
                <MasterTableView 
                    TableLayout="Fixed" 
                    EditMode="InPlace" 
                    CommandItemDisplay="None" 
                    DataKeyNames="CodeListID" 
                    AllowNaturalSort="false"> 
                    <SortExpressions> 
                        <telerik:GridSortExpression FieldName="CodeListName" SortOrder="Ascending" /> 
                    </SortExpressions> 
                    <Columns> 
                        <telerik:GridBoundColumn HeaderText="Code List ID" DataField="CodeListID" MaxLength="4" UniqueName="colID" /> 
                        <telerik:GridBoundColumn HeaderText="Code List Name" DataField="CodeListName" SortExpression="CodeListName" 
                            SortDescImageUrl="~/Images/icon_arrowDown.gif" SortAscImageUrl="~/Images/icon_arrowUp.gif" 
                            MaxLength="8" UniqueName="colName" /> 
                        <telerik:GridBoundColumn HeaderText="Code List Description" DataField="CodeListDescription" MaxLength="16" UniqueName="colDescription" /> 
                        <telerik:GridEditCommandColumn HeaderText="Edit" HeaderStyle-HorizontalAlign="Center" 
                            HeaderStyle-Width="65" ButtonType="ImageButton" EditImageUrl="~/Images/icon_edit.gif" 
                            UniqueName="colEdit" ItemStyle-HorizontalAlign="Center" /> 
                        <telerik:GridButtonColumn HeaderText="Delete" HeaderStyle-HorizontalAlign="Center" 
                            HeaderStyle-Width="65" ConfirmText="Delete Code List?" ConfirmDialogType="RadWindow" 
                            ConfirmTitle="Delete Code List" ButtonType="ImageButton" CommandName="Delete" 
                            UniqueName="colDelete" ImageUrl="~/Images/icon_delete.gif" ItemStyle-HorizontalAlign="Center" /> 
                    </Columns> 
                </MasterTableView>    
                              
            </telerik:RadGrid> 

momentum
Top achievements
Rank 1
 answered on 13 May 2010
5 answers
133 views
Since I'm developing my user interface elements as WebParts (class libraries) in MOSS 2007, I don't have the luxury of an .aspx page. And without an aspx page, i have to try and convert the declarative examples found on this site to work programmatically. I'm having a difficult time trying to create a custom form in a RadGrid using my own controls instead of using the auto-generated form provided by the RadGrid itself. One way I've seen this is through the use of Templates where you provide your own form to the "MasterTableView.EditFormSettings.FormTemplate". I can't find an example where this is all handled programmatically. In this situation, is it preferred that I just use the RadGrid to display a list and redirect the user to another page where the form will reside, passing the primary key as part of the query string? Or should I write my form as a class that inherits from "System.Web.UI.ITemplate" and set my RadGrid's "FormTemplate" to this class? I like the template route but I can't seem to find any good examples.

A basic example would be a RadGrid with a few rows of data... the user clicks the "Edit" button and my custom form will display itself as a "GridEditMode.PopUp". 
Michael Malone
Top achievements
Rank 1
 answered on 12 May 2010
3 answers
63 views
Team,

I just want to export my RadGrid data into MS Word.
It works fine. But my requirement is I want to export data into particular Word. Is there any option for that?
Your suggestions are welcome.

Thanks
Rajesh N.
Daniel
Telerik team
 answered on 12 May 2010
4 answers
480 views
I receive the error "'Telerik.Web.UI.RadGrid' does not contain a definition for 'Rows' and no extension method 'Rows' accepting a first argument of type 'Telerik.Web.UI.RadGrid' could be found (are you missing a using directive or an assembly reference?)" when trying to iterate through the rows of a radgrid and get the values of a specific column. 

Essentially what I am trying to do is get all values for a specific column and put those values in a comma delimited list - this is done while the rad grid is being created...any help with that would be greatly appreciated.

Here is an example I used for a regular gridview prior to switching to a radgrid...

 

foreach (GridViewRow gvr in gvCustomerList.Rows)

 

{

sIen += gvr.Cells[0].Text +

",";

 

}


That seemed to work but since I have switched to using the RadGrid it doesn't.

Thanks!

Wayne Christopherson
Wayne Christopherson
Top achievements
Rank 1
 answered on 12 May 2010
2 answers
256 views
Hi I have an enum method as follows
 public enum UserType
        {
            Default = 1,             
            Parameters = 2,
            Students = 3,
            Marks = 4,
            
  }
I need to bind enum values to a radgrid so that i have a display as follows

NAME             VALUES
Default              1
Parameters       2
Students           3
Marks               4

Please someone help me with the code snippets.

thanks.

Robert Jakech
Top achievements
Rank 1
 answered on 12 May 2010
4 answers
222 views
Hi,

I have a page which contains a drop down list and a control from Atalasoft which is essentially an image viewer.

The Atalasoft control has its own AJAX and when it renders it'll render with iFrames in it. The control is also in an ASP.NET panel.

I've set the AJAX Manager to update the panel whenever the drop down list selection changes.

Unfortunately, the content within the Atalasoft control's iFrames is not rendered.

Any help on this would be greatly appreciated.

Thanks,
Darren
Darren
Top achievements
Rank 1
 answered on 12 May 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?