Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
153 views
I have a grid and a commanditem template of a button. On button click I want to copy the contents of the grid to the clipboard. I have a client settings on-command call to buttonclicked and it is not firing.

I am iterating on the client side through the grid and i concatenate to one large string. I have 4 columns, so I am putting each column followed by a tab, and then at the end of each row a new line. Then I will write this string out to the clipboard. I tried doing it on the server, and the string was built, but I could not access the clipboard on the server side, so I am trying to write the code on the client. The grid I am trying to copy is a template inside a tooltip.

I have a client settings on-command and it doesnt fire the javascript when I click the button( which is a command item). I put in a clientevent on key press, and it actually works if I highlight and press a key, but not on command(which is where my button is)  Here is the aspx:
 <telerik:RadToolTip runat="server" ID="RadToolTip2" TargetControlID="Label1"
                                Skin="Inox" ShowDelay="500" AutoCloseDelay="200000" Font-Names="arial"
                                Font-Size="XX-Large" BorderStyle="Inset" HideDelay="100000" ManualClose="False"
                                Position="BottomRight" Sticky="True" Width="300">  
                                    <telerik:RadGrid ID="toolTipUsers" runat="server"  DataSourceID="ContentCentralActiveUsers"  
                                    GridLines="None" Skin="Default" AutoGenerateColumns="False"
                                       commanditemdisplay="Top">
                                      <MasterTableView  DataSourceID="ContentCentralActiveUsers"   CommandItemDisplay="Top"  NoMasterRecordsText="No users to display."   
                                                    GridLines="None"    ItemStyle-Wrap="false" >
                                      <CommandItemTemplate>
                                        <asp:Button ID="copy" runat="server" CommandName="Copy" Text="Copy to clipboard" >                               
                                        </asp:Button>
                                      </CommandItemTemplate>
                                      <ItemStyle  Font-Size="Larger"  Wrap="false"/>
                                      <AlternatingItemStyle  Font-Size="Larger" Wrap="false" />
                                        <Columns>
                                           <telerik:GridBoundColumn DataField="login_name" HeaderText="User name"  UniqueName="username"  ></telerik:GridBoundColumn>
                                           <telerik:GridBoundColumn DataField="password" HeaderText="Password"  UniqueName="password"  ></telerik:GridBoundColumn>
                                           <telerik:GridBoundColumn DataField="email" HeaderText="Email" UniqueName="email"  ></telerik:GridBoundColumn>
                                           <telerik:GridBoundColumn DataField="package_name" HeaderText="Package" UniqueName="package" ></telerik:GridBoundColumn>
                                        </Columns>
                                      </MasterTableView>
                                      <ClientSettings     ClientEvents-OnCommand="ButtonClicked"></ClientSettings>
                               </telerik:RadGrid>
                             </telerik:RadToolTip>


and here is the javascript:

   function ButtonClicked(sender, args) {

               var grid = sender;
               var MasterTable = grid.get_masterTableView();
                var rows = MasterTable.get_dataItems();
                var cell;
                var username;
                var password;
                var email;
                var spackage;
                var copyString;
                copyString = "User name \t Password \t Email \t Package  \r\n";
                for (var i = 0; i < rows.length; i++) {
                    var row = rows[i];
                    
                    cell = MasterTable.getCellByColumnUniqueName(row, "username");
                    username = cell.innerHTML;
                    cell = MasterTable.getCellByColumnUniqueName(row, "password");
                    password = cell.innerHTML;
                    cell = MasterTable.getCellByColumnUniqueName(row, "email");
                    email = cell.innerHTML;
                    cell = MasterTable.getCellByColumnUniqueName(row, "package");
                    spackage = cell.innerHTML;
                    copyString = copyString + username +"\t"+password+"\t"+email+"\t"+spackage+"\r\n";
                }
                window.clipboardData.setData('text', copyString);
       }


Laura
Top achievements
Rank 1
 answered on 27 Oct 2008
1 answer
105 views
Dear All!

I would like to know how can I create dynamically the following type of RadGrid (see the picture):
Need to choose from every group only one value if the user wants and at the end determine the value of the radiobuttons.

http://www.anda.hu/grid.jpg

thx,
alsi

Princy
Top achievements
Rank 2
 answered on 27 Oct 2008
2 answers
135 views
Hi all,

I'm running into a bit of a problem and was wondering if anyone knew a workaround to this...

I'm working on a small report program which makes use of RadEditor for people to input daily activities, except we're kinda forcing the users to use bulleted lists for the sake of storing report items into a backend for future reporting. 

The pasteHtml I am using is...

editor.pasteHtml("<p><b>" + val + "</b></p><ul><li>"); 

Now, in IE this works fine.  RadEditor does close the tags, but it sets the cursor inside the <li> and allows people to start typing report items.

In Firefox, which everyone around her prefers to use, the cursor goes to the beginning of the textbox, and you cannot click into the <li> to insert an item.  You can, however, click to html preview mode, and when you click back, it puts the cursor right where we want it.  The question is, how can I use javascript to let people enter items (after the pasteHtml) without having to click to html preview and back? :)

Any help or suggestions are welcome. ;D
Serrin
Top achievements
Rank 1
 answered on 27 Oct 2008
4 answers
191 views
I have a 3-level hierarchy radgrid as:
State name
    County name
        Township name - population
I can get subtotal for township population using Aggregate=Sum
Is that possible to get each County population total , State population, and all states population grand total?
Regards,

d-cpt


d-cpt
Top achievements
Rank 2
 answered on 27 Oct 2008
3 answers
178 views
Hi there,

From what i understand, the EditFormType property affects inserts AND updates.  Is it possible to use different methods for each approach?

For example...
 
I have a grid that displays a list of products.  I want to use a custom usercontrol for the insert so that users may "search" for a product before inserting a new one.  For updates however, i just want to use the auto-generated "update" row.

Is this possible?
Princy
Top achievements
Rank 2
 answered on 27 Oct 2008
2 answers
69 views
I have used two telerik grid using rad tab, now facing an issue (no idea either its an issue or existing feature) as below: If I select "Add New Record" or edit button of a grid for the 1st tab then it open said form....here no issue. But if I leave it as it is and click to another tab and do something with 2nd grid and later I come back to 1st tab containing 1st grid......still display the said form open (Add New record or Edit Form).

I want the auto feature through which New form or Edit form should be close automatically when I visit one tab to another tab ..

Please give me needfull suggestion.
regards

rajendra 
rajendra
Top achievements
Rank 1
 answered on 27 Oct 2008
2 answers
138 views
what is the analogue of property 'Externalcallbackpage'
in new version?
Valera
Top achievements
Rank 1
 answered on 27 Oct 2008
6 answers
171 views
hi there. I'm Stuck
wondering if a sample exists that could demonstrate how one would relate two comboboxes when in edit/insert mode within a radgrid.

I have the following source / code combo
Note the gridTemplate is where I was wanting to do my compares.. but if i could do it using the griddropdown feature, that sure would be easier.

I have looked at the demos on relating radcombos, and don't have any issue when working with these independentanly. my issues arise when trying to work with them in a radgrid or similar container. My assumption is that I am not referencing the objects correctly.

thanks for any tips oh and if there is a preferred method, please feel free to state.

my code first:
Sub updateCB2()  
       
        Dim cb2 As RadComboBox = DirectCast(RadGrid1.FindControl("RadComboBox2"), RadComboBox)  
        Dim cb1 As RadComboBox = DirectCast(RadGrid1.FindControl("RadComboBox1"), RadComboBox)  
        cb2.DataSource = functions.dt("Select SubGroup as DepartmentGroup from ATS_CareerTypes where career = '" & cb1.SelectedValue & "'")  
        cb2.DataBind()  
    End Sub  
 
      
    Protected Sub selectTems(ByVal o As Object, ByVal e As Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs)  
        updateCB2()  
 
    End Sub 

my source

 <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:PHCJobPostsConn %>" 
             SelectCommand="SELECT distinct [Career] FROM [ATS_CareerTypes]" /> 
         <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:PHCJobPostsConn %>" 
             SelectCommand="SELECT distinct [SubGroup] as DepartmentGroup FROM [ATS_CareerTypes]" /> 
              
          
          
                     <asp:SqlDataSource ID="SqlDataSource3" runat="server" ConnectionString="<%$ ConnectionStrings:PHCJobPostsConn %>" 
             SelectCommand="SELECT [Dpt_External], [Dpt_Internal], [Career], [DepartmentGroup], [Position_Type], [Department_Name], [PostingNumber] FROM [ExternalPostings]">  
         </asp:SqlDataSource> 
         <br /> 
         <telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateEditColumn="True" DataSourceID="SqlDataSource3" 
             GridLines="None">  
             <MasterTableView   AutoGenerateColumns="False" DataSourceID="SqlDataSource3">  
                 <RowIndicatorColumn> 
                     <HeaderStyle Width="20px" /> 
                 </RowIndicatorColumn> 
                 <ExpandCollapseColumn> 
                     <HeaderStyle Width="20px" /> 
                 </ExpandCollapseColumn> 
                 <Columns> 
                     <telerik:GridCheckBoxColumn DataField="Dpt_External" DataType="System.Boolean" HeaderText="Dpt_External" 
                         SortExpression="Dpt_External" UniqueName="Dpt_External">  
                     </telerik:GridCheckBoxColumn> 
                     <telerik:GridCheckBoxColumn DataField="Dpt_Internal" DataType="System.Boolean" HeaderText="Dpt_Internal" 
                         SortExpression="Dpt_Internal" UniqueName="Dpt_Internal">  
                     </telerik:GridCheckBoxColumn> 
                    <telerik:GridTemplateColumn UniqueName="TemplateColumn" > 
                    <eDITItemTemplate> 
                        &nbsp;<telerik:RadComboBox ID="RadComboBox1" AutoPostBack="true" runat="server"   
                        DataSourceID="SqlDataSource1"   DataTextField="Career" DataValueField="Career"   
                        SelectedValue='<%# bind("career") %>'   
                            OnSelectedIndexChanged="selectTems">  
                            <CollapseAnimation Duration="200" Type="OutQuint" /> 
                        </telerik:RadComboBox> 
                        <telerik:RadComboBox ID="RadComboBox2" runat="server" DataSourceID="SqlDataSource2" 
                            DataTextField="DepartmentGroup" DataValueField="DepartmentGroup"   
                            SelectedValue='<%# Bind("DepartmentGroup") %>'>  
                            <CollapseAnimation Duration="200" Type="OutQuint" /> 
                        </telerik:RadComboBox> 
                        <br /> 
                    </EDITItemTemplate> 
                    </telerik:GridTemplateColumn> 
                      
                     <telerik:GridDropDownColumn UniqueName="CareerGroup" HeaderText="Career"  ListValueField="Career" ListTextField="Career" DataField="Career" DataSourceID="SQLDataSource1" DropDownControlType="DropDownList" /> 
                     <telerik:GridDropDownColumn  HeaderText="SubGroup"  ListValueField="DepartmentGroup" ListTextField="DepartmentGroup" DataField="DepartmentGroup" DataSourceID="SQLDataSource2" DropDownControlType="DropDownList" UniqueName="DepartmentGroup" /> 
                      
                     <telerik:GridBoundColumn DataField="Position_Type" HeaderText="Position_Type" SortExpression="Position_Type" 
                         UniqueName="Position_Type">  
                     </telerik:GridBoundColumn> 
                     <telerik:GridBoundColumn DataField="Department_Name" HeaderText="Department_Name" 
                         SortExpression="Department_Name" UniqueName="Department_Name">  
                     </telerik:GridBoundColumn> 
                     <telerik:GridBoundColumn DataField="PostingNumber" HeaderText="PostingNumber" SortExpression="PostingNumber" 
                         UniqueName="PostingNumber">  
                     </telerik:GridBoundColumn> 
                 </Columns> 
                  
             </MasterTableView> 
                 <FilterMenu EnableTheming="True">  
                 <CollapseAnimation Duration="200" Type="OutQuint" /> 
             </FilterMenu> 
         </telerik:RadGrid><br /> 
         <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">  
             <AjaxSettings> 
                 <telerik:AjaxSetting AjaxControlID="RadComboBox1">  
                     <UpdatedControls> 
                         <telerik:AjaxUpdatedControl ControlID="RadComboBox1" /> 
                         <telerik:AjaxUpdatedControl ControlID="RadComboBox2" /> 
                     </UpdatedControls> 
                 </telerik:AjaxSetting> 
             </AjaxSettings> 
         </telerik:RadAjaxManager> 



Yavor
Telerik team
 answered on 27 Oct 2008
1 answer
182 views
Hi,

 In RadGrid control how to cheked the Chebox exist in the HeaderTemplate in ItemDataBound event, Please solve my problem how to checked the CheckBox exist in the Header option of the colulmn in ItemDataBound Event of RadGrid control.

Thanks
Pankaj Tyagi

Princy
Top achievements
Rank 2
 answered on 27 Oct 2008
3 answers
140 views
Hi I'm having a bit of troubles with radprompt.

I set the default value but everything after the first space is ignored.

Is this a known issue?

Thanks

Guido Tapia
Georgi Tunev
Telerik team
 answered on 27 Oct 2008
Narrow your results
Selected tags
Tags
+? more
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?