Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
191 views
Hello,
I never used DataKeyNames and dont know the importance of these datakeyNames.


Can anyone explain how it works and what is GroupLoadMode="Client" in the below code.

 <MasterTableView CellPadding="4" DataKeyNames="IsSelected" AutoGenerateColumns="False" Width="100%" GroupLoadMode="Client"> 

Shinu
Top achievements
Rank 2
 answered on 09 May 2012
1 answer
191 views
This has been baffling (and infuriating me) for hours now.  I have a textbox wrapped inside a panel named:

<asp:Panel ID="panelTest" runat="server">


The textbox calls a javascript event when the user hits enter:
function CatchTab(e) {
               var keycode;
               if (window.event) {
                   keycode = window.event.keyCode;
               } else if (e) {
                   keycode = e.which || e.keyCode;
               } else {
                   return true;
               }
 
               if (keycode == 13) {
                   //alert("User Hit Enter");
                   var empid = document.getElementById('<%= tbTmid.ClientID %>').value;
                   InitiateAjaxRequest(empid);
               }
           }


function InitiateAjaxRequest(arguments) {
               var ajaxManager = $find("<%= ram2.ClientID %>");
               alert("Initiating Request");
               ajaxManager.ajaxRequest(arguments);
           }

<telerik:RadAjaxManager ID="ram2" runat="server" Skin="Web20" OnRequestStart="InitiateAjaxRequest">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="ram2">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="panelTest" LoadingPanelID="loader1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="rgSc">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="panelTest" LoadingPanelID="loader1" />
                    <telerik:AjaxUpdatedControl ControlID="rwm1" LoadingPanelID="loader1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
 
    <telerik:RadAjaxLoadingPanel ID="loader1" runat="server" Skin="Web20" IsSticky="false"
            EnableViewState="true" Enabled="true">
    </telerik:RadAjaxLoadingPanel>


For some reason the darn loading panel only wants to show up on the first ajax request.  Everything is ajaxd on subsequent requests, I just don't see any loading panel.  The textbox fills a grid within the panel.  What's even stranger is that if the value entered into the textbox does not return any grid rows, the loading panel shows up everytime!!!

Also, I get the "Initiating Request" alert every time as well and the ajax manager object is always populated (not null).

If anyone could please help that would be great.

Thanks
Maria Ilieva
Telerik team
 answered on 09 May 2012
1 answer
81 views
Hello all! I have a newbie question... When my RadGrid with 150 rows renders, it does so at about 1/2 size in the middle of the page; then it re-renders full size. How do I get the grid to not render until the full grid is ready?
My page setup is like this:
<telerik:RadAjaxPanel >
    <telerik:RadWindowManager >
        <div align="center" style="z-index: 1;">
            <telerik:RadTabStrip >
                <Tabs/>
                <Tabs/>
                <Tabs/>
            <telerik:RadTabStrip />
            <telerik:RadMultiPage />
                <telerik:RadPageView />
                    <telerik:RadGrid ID="gridLoans" runat="server"  AllowAutomaticDeletes="true" AllowAutomaticUpdates="false"
                AllowAutomaticInserts="true" AllowFilteringByColumn="false" AllowPaging="false"
                AllowSorting="true" AllowMultiRowSelection="true" CellSpacing="2"
                PageSize="500" ShowGroupPanel="false"
                EnableLinqExpressions="false" GridLines="Both" CellPadding="0" HeaderStyle-Wrap="false"
                AutoGenerateColumns="false" BorderColor="Black" BorderStyle="Solid" BorderWidth="1px"
                                 
                OnItemDataBound="grid_ItemDataBound" OnPageIndexChanged="grid_PageIndexChanged"
                OnPageSizeChanged="grid_PageSizeChanged" OnNeedDataSource="grid_NeedDataSource"
                OnInsertCommand="gridLoans_InsertCommmand" OnUpdateCommand="gridLoans_UpdateCommand"
                OnDeleteCommand="gridLoans_DeleteCommand" OnPreRender="gridLoans_PreRender"
                OnGridExporting="gridLoans_GridExporting" AllowCustomPaging="true"
                            >
                            <ClientSettings allowautoscrollondragdrop="false" allowexpandcollapse="false" allowgroupexpandcollapse="false">
                                <Selecting AllowRowSelect="true" UseClientSelectColumnOnly="true" />
                                <Scrolling AllowScroll="false" UseStaticHeaders="false" />
                                <ClientEvents OnGridCreated="grid_GridCreated" OnRowDblClick="RowDblClick" />
                                <Resizing AllowResizeToFit="true" EnableRealTimeResize="true" />
                            </ClientSettings>
                            <ExportSettings IgnorePaging="true" ExportOnlyData="true" Excel-Format="ExcelML" />
                            <AlternatingItemStyle BorderColor="Black" BorderStyle="Solid" BorderWidth="1px" />
                        <MasterTableView EditMode="InPlace" CommandItemDisplay="TopAndBottom" DataKeyNames="LoanID" ClientDataKeyNames="LoanID" GridLines="Both">
                            <CommandItemSettings ExportToPdfText="Export to PDF" />
                            <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column"><HeaderStyle Width="20px" /></RowIndicatorColumn>
                            <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column"><HeaderStyle Width="20px" /></ExpandCollapseColumn>
                            <Columns>
                                <telerik:GridClientSelectColumn UniqueName="ClientSelectColumn"  />
                                ...
                            </Columns>
                            <EditFormSettings>
                                <EditColumn FilterControlAltText="Filter EditCommandColumn1 column" UniqueName="EditCommandColumn1"></EditColumn>
                            </EditFormSettings>
                        </MasterTableView>
                        <FilterMenu EnableImageSprites="false" />
                        <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default" />
                        <ActiveItemStyle BorderColor="Black" BorderStyle="Solid" BorderWidth="1px" />
                        <FilterMenu EnableImageSprites="false" />
                        <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default"></HeaderContextMenu>
                    </telerik:RadGrid>
               </telerik:RadPageView>
           </telerik:RadMultiPage>
        </telerik:RadAjaxPanel>
    </div>
<telerik:RadAjaxPanel />
<telerik:RadWindowManager />

Thanks,
Miles
Andrey
Telerik team
 answered on 09 May 2012
8 answers
434 views
I am have a RadGrid and use EditForms with a template.  I allow inserts and edits and I am having a problem with clearning the EditForm when a user clicks to edit a row.  When I click on the Add New link it shows an empty template and that is perfect but If I then choose to then click Edit on an existing row it creates another edit form in edit mode.  So now I have 2 edit forms 1 for a new record and 1 an edit to a record.  Since I have validation on my edit forms submitting either form causes validation to fire on both. 

I know that I can clear edit items when I click the add new link such as:

Protected Sub RadGrid1_ItemCommand(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles RadGrid1.ItemCommand
  Select Case e.CommandName
    Case RadGrid.InitInsertCommandName
      ' cancel any previous edits
      RadGrid1.MasterTableView.ClearEditItems()
    Case RadGrid.EditCommandName
  End Select
End Sub

This works fine clearing out edits but not inserts.  How can I clear the insert items when I choose to edit a row in the grid since there seems to be no .ClearInsertItems() method?
Robert
Top achievements
Rank 1
 answered on 09 May 2012
6 answers
710 views
Hi -- We have a RadTabStrip control with few tabs.  Under most tabs there are sub-tabs.  We want to dynamically select a tab when the page loads.  Based on this selected tab, the sub-tab should be selected.  I know how to set the tab as selected on the main tab but not having much luck with setting the child tab. 

So, for our example, I am setting the third tab on main tab strip as selected when the page loads.  This part works.
Now I want to set the 5th child tab of this selected tab as highlighted. Can't figure out how to do it. 

What's happening is that the third tab on main shows up as highlighted.  However it is showing the child tabs of first tab below it.



Can someone please help?

Thanks

Raka
Top achievements
Rank 1
 answered on 09 May 2012
1 answer
240 views
I've been scouring the threads for an example like mine and I've found bits and pieces, but haven't been able to put everything together to get what I want to work.  What I have is a grid with a checkbox in the first column that I want to perform an action on check changed.  I also have a button in the last column that puts the grid into edit mode.  Around everything I have an UpdatePanel. 

My problem is setting my triggers for only the checkbox on checkchanged.  I can set children as triggers, but that will cause the other button to trigger which I don't want.  I tried trying to programaitcally add the trigger in the ItemCreated event, but to no avail.

Relevant code as followed.

<asp:UpdatePanel ID="UpdatePanel1" runat="server">     
            <ContentTemplate>      
                   <rad:RadGrid ID="rg" OnUpdateCommand="Update" OnNeedDataSource="BindItems"  OnItemDataBound="rg_ItemDataBound" OnPreRender="rg_PreRender" runat="server"  >            
                    <PagerStyle Position="Top" />                
                    <MasterTableView DataKeyNames="ID" CommandItemDisplay="None">               
                        <CommandItemTemplate>
                            <asp:ImageButton ID="ImageButton1" ImageUrl="/admin/images/add-record.jpg" CommandName="InitInsert" runat="server" /> Add New
                        </CommandItemTemplate>      
                        <Columns>
                            <rad:GridTemplateColumn HeaderStyle-Width="40px" HeaderText="Email">
                                <ItemTemplate>
                                    <asp:CheckBox id="cbEmail" AutoPostBack="true" OnCheckedChanged="AddToEmailList" runat="server" />                                                      
                                </ItemTemplate>
                            </rad:GridTemplateColumn>
                                          // a handful of other columns
                             <rad:GridEditCommandColumn EditText="More" HeaderStyle-Width="30" />
                     </Columns>
                    </MasterTableView>
                </rad:RadGrid>
            </ContentTemplate>       
        </asp:UpdatePanel>

Again, I want to only asynchronously postback when that checkbox is checked. Thanks for any help in advance.
Pavlina
Telerik team
 answered on 09 May 2012
1 answer
88 views
Hi,

I am using combobox with checkbox for multiple selection. I am showing the selected text on checkbox selection and saving the selections next time that will be auto select. this is working fine in IE7,IE8 and mozila. But not working in Chrome. It showing error that "Uncaught TypeError: Cannot call method 'set_text' of null".

The code is as below when i am showing the selected text on the basis of previous selection

javascript:setTimeout("$(document).ready(function() { SetHeaderComboText('ucSearchBuilder_grdFilter_ctl00_ctl06_ddlFilterHeaderwithTreeView','Conflict Resolution');});",100);


Although i had tried $(document).ready() but it also not works with chrome.

comboIds
is redcombobox id and values are text to be display in radcomdobox
function SetHeaderComboText(comboIds, values) {
var arrcomboId = comboIds.toString().split('<');
var arrvalue = values.toString().split('<');
for (var j = 0; j < arrcomboId.length; j++) {
var comboId = arrcomboId[j];
var text = arrvalue[j];
var comboBox = $find(comboId);

//set the text of combobox
if (text.length > 0) {
//set the text of the combobox
comboBox.set_text(text);
}
else {
//all checkboxes are unchecked so reset the controls
comboBox.set_text("");
}
}
}
Dimitar Terziev
Telerik team
 answered on 09 May 2012
4 answers
145 views
 am creating an itemtemplate all dynamic and adding text box ...i also looked to this link: http://www.telerik.com/help/aspnet-ajax/grid-programmatic-creation.html but the coding is too dense ..  

please help me with my code 

  int colCnt = ds.Tables[0].Columns.Count;
            int rowCnt = ds.Tables[0].Rows.Count;

 GridBoundColumn boundColumn;
   boundColumn = new GridBoundColumn();
           

 RadGrid1.MasterTableView.Columns.Add(boundColumn);
            boundColumn.DataField = ds.Tables[0].Columns[0].ColumnName ;
            boundColumn.HeaderText = ds.Tables[0].Columns[0].ColumnName;
            GridTemplateColumn templateColumn;
            for (int i = 1; i < colCnt; i++)
            {
             
                templateColumn = new GridTemplateColumn();
                templateColumn . --> am clueless over here ....can u guyz me ! 

                RadGrid1.MasterTableView.Columns.Add(templateColumn);
                boundColumn.DataField = ds.Tables[0].Columns[i].ColumnName;
                boundColumn.HeaderText = ds.Tables[0].Columns[i].ColumnName;
            }

Kshitiz
Top achievements
Rank 1
 answered on 09 May 2012
1 answer
102 views
Why doesn't sorting work when you bind an IEnumerable<T> collection that uses the yield keyword?  Do I have to implement a custom paging solution?  I am using 2012 Q1 SP1 controls.

<telerik:RadGrid ID="RadGrid1" runat="server" OnNeedDataSource="RadGrid1_NeedDataSource">
    <MasterTableView AllowSorting="true" AllowPaging="true" PageSize="20" AllowFilteringByColumn="true" />
</telerik:RadGrid>

using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Data.Linq;
using System.Linq;
 
using Telerik.Web.UI;
 
public class Class1
{
    public Class1(int i)
    {
        this.Column1 = i.ToString();
        this.Column2 = (200 - i).ToString();
        this.Column3 = System.Text.Encoding.Default.GetString(new[] { System.Convert.ToByte(65 + (i % 26)) });
    }
 
    public string Column1 { get; set; }
    public string Column2 { get; set; }
    public string Column3 { get; set; }
 
    public static IEnumerable<Class1> GetData()
    {
        List<Class1> data = new List<Class1>();
 
        for (int i = 0; i < 200; i++)
        {
            yield return new Class1(i);
        }
    }
}
 
public partial class Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
    }
 
    protected void RadGrid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
    {
        //RadGrid1.DataSource = Class1.GetData().ToArray();  //works
        RadGrid1.DataSource = Class1.GetData();  //doesn't work
    }
}
Tsvetina
Telerik team
 answered on 09 May 2012
1 answer
92 views
Hello,

I am trying to embed a RadMenu inside a RadComboBox. Everything works fine until I try to configure the combobox to request items only after at least three characters have been entered into the filter. Once I set the EnableAutomaticLoadOnDemand to "true" I get the error attached.

My code is below. Please advise on possible steps to resolve this issue.
<telerik:RadComboBox ID="RadComboBox4" runat="server" Width="590px" Height="140px"
    Filter="Contains" ShowToggleImage="False" EmptyMessage="Fund..." MinFilterLength="3" EnableAutomaticLoadOnDemand="True"
    DataSourceID="SqlDataSource1" DataTextField="Name" DataValueField="FundID"
    OnItemDataBound="RadComboBox4_ItemDataBound" >
    <ItemTemplate>
        <div style="float: left">
            <asp:Label ID="Label1" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Name") %>'></asp:Label>
        </div>
        <div style="float: right">
            <telerik:RadMenu ID="RadMenu1" runat="server" EnableRoundedCorners="true" EnableShadows="true" >
                <Items>
                    <telerik:RadMenuItem Text="Fund ID">
                        <GroupSettings ExpandDirection="Right"></GroupSettings>
                        <Items>
                            <telerik:RadMenuItem Text="About US">
                            </telerik:RadMenuItem>
                            <telerik:RadMenuItem Text="Strategic Plan">
                            </telerik:RadMenuItem>
                            <telerik:RadMenuItem Text="Executive Bios">
                            </telerik:RadMenuItem>
                            <telerik:RadMenuItem Text="Contact Us">
                            </telerik:RadMenuItem>
                        </Items>
                    </telerik:RadMenuItem>
                </Items>
            </telerik:RadMenu>
        </div>
        <br /><br />
    </ItemTemplate>
</telerik:RadComboBox>

Dimitar Terziev
Telerik team
 answered on 09 May 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?