Telerik Forums
UI for ASP.NET AJAX Forum
7 answers
417 views
Hi, I hope I can explain my problem clearly.

I have RadGrid with two GridDropDownColumns and some other RadNumericTextBox columns.

One of the GridDropDownColumn is filtered based on the selected value from the other GridDropDownColumn.

I was able to fire SelectedIndexChange event at this point. The event stop firing after I applies RequiredFieldValidator on one of my RadNumericTextBox. 

When the grid is in edit mode, everything is fine if I just select the combobox to filter the other one, However, once I try to update and it failed because of RequiredFiedValidator. The combobox' selectIndexChange event can not be fired anymore.

My code are following
ASCX
<Columns>
    <telerik:GridDropDownColumn UniqueName="Combo1" DropDownControlType="RadComboBox" DataField="Combo1data" DataSourceID="odcCombo1" ListValueField="Description1" ListTextField="Description1" ColumnEditorID="edtCombo1"  HeaderText="Main" HeaderStyle-Width="120px" ItemStyle-Width="120px"></telerik:GridDropDownColumn>
    <telerik:GridDropDownColumn UniqueName="Combo2" DropDownControlType="RadComboBox" DataField="Combo2data" DataSourceID="odcCombo2" ListValueField="Description2" ListTextField="Description2" ColumnEditorID="edtCombo2" HeaderText="Depend" HeaderStyle-Width="100px" ItemStyle-Width="100px"></telerik:GridDropDownColumn>
    <telerik:GridTemplateColumn UniqueName="NumData1" DataField="Data1" ItemStyle-ForeColor="Black" HeaderText="NumData" ItemStyle-Width="55px" HeaderStyle-Width="55px" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center" >
    <ItemTemplate>
        <asp:Label runat="server" ID="lblData1" Text='<%# Eval("Data1", "{0:C}") %>'></asp:Label>
    </ItemTemplate>
    <EditItemTemplate>
    <span><telerik:RadNumericTextBox runat="server" ID="tbData1" Width="55px" DbValue='<%# Bind("Data1") %>' MinValue="10000000" MaxValue="99999999" MaxLength="8"><NumberFormat DecimalDigits="0" GroupSeparator="" />
        </telerik:RadNumericTextBox><span style="color: Red"><asp:RequiredFieldValidator ID="RequiredFieldValidator1" ControlToValidate="tbData1" ErrorMessage="*" runat="server"></asp:RequiredFieldValidator>
    </span>
    </EditItemTemplate>
ASCX.CS
        protected void grdTimeCard_ItemCreated(object sender, GridItemEventArgs e)
        {
            //create fire event when it's in edit mode
            if (e.Item is GridEditableItem && e.Item.IsInEditMode)
            {
                GridEditableItem editItem = (GridEditableItem)e.Item;
                GridDropDownListColumnEditor editor = (GridDropDownListColumnEditor)editItem.EditManager.GetColumnEditor("Entry");
                editor.ComboBoxControl.AutoPostBack = true;
                editor.ComboBoxControl.SelectedIndexChanged += new RadComboBoxSelectedIndexChangedEventHandler(list_SelectedIndexChanged);
            }
        }
  
        private void list_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
{
}

protected void grdTimeCard_ItemDataBound(object sender, GridItemEventArgs e)
{
    if (e.Item is GridEditableItem && e.Item.IsInEditMode)
    {
        string defaultCombo1 = "";
        GridDataItem dataItem = e.Item as GridDataItem;
        GridEditableItem editItem = (GridEditableItem)e.Item;
        //do nothing if it's insert itme
        if (e.Item is GridDataInsertItem)
        {
        }
        else
        {
            // if it's edit mode
            defaultCombo1 = ((DataRowView)e.Item.DataItem)["Combo1"].ToString();
            try
            {
                RequiredFieldValidator validator1 = (RequiredFieldValidator)editItem.FindControl("RequiredFieldValidator1");
                if (defaultCombo1 == "Regular" )
                    validator1.Enabled = true;
                else
                    validator1.Enabled = false;


Any suggestions?
Tsvetina
Telerik team
 answered on 28 Sep 2012
2 answers
50 views
I'm the first to admit I'm not as experienced as many but still, I can't believe it's so hard to get the tab strip / multi page setup working properly.  Can anyone give me am "Idiot's Guide" to common mistakes?  I have what should be simple enough:  3 tabs, 3 page views.  Initially the problem was that when you first loaded the page, although the correct tab was selected, it showed the wrong page view until your first tab change which I assume fired a post back that got everything "sync'd up".  I tried various settings for things like index and moved the tab hierarchy around.  Now the correct tab and it's correct pageview show when the page is loaded but one tab will not show it's corresponding pageview at all.  I've checked everything I can think of... all the page views are registered with their corresponding tabs, the tabs show and seem to select properly but one page view has "vanished". 


Arghhhhhhhhhhhhhhhhhh....

Kate
Telerik team
 answered on 28 Sep 2012
1 answer
112 views
Hello,
We are in need of our grid to allow for navigating up to move up a row and to the textbox above current, down to move down a row and to the textbox below current , right to move to the next textbox in the grid right of current, and left to move to next textbox left of current.  
Is this possible with the grid and if so how would i accomplish this?  

Here is our grid currently:
<telerik:RadGrid ID="rgridChemValues" runat="server"
                    CssClass="gridview-custom" Skin="Transparent" OnPreRender="rgridChemValues_PreRender"
                    AllowMultiRowEdit="True" EnableViewState="true"
                    oncolumncreated="rgridChemValues_ColumnCreated" ShowFooter="True">
                    <MasterTableView AutoGenerateColumns="true" EditMode="InPlace" CommandItemDisplay="TopAndBottom">
                        <EditFormSettings>
                            <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                            </EditColumn>
                        </EditFormSettings>
                    <HeaderStyle Width="100px" />
                        <CommandItemTemplate>
                        </CommandItemTemplate>
                        <CommandItemSettings ExportToPdfText="Export to PDF" />
                        <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column"
                            Visible="True">
                        </RowIndicatorColumn>
                        <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column"
                            Visible="True">
                        </ExpandCollapseColumn>
                        <Columns>
                            <telerik:GridBoundColumn HeaderText="FieldApplicationKeyVS" Display="false" DataField="FieldApplicationKey"
                                UniqueName="FieldApplicationKeyVisible">
                            </telerik:GridBoundColumn>
                        </Columns>
                    </MasterTableView>
                    <ClientSettings>
                        <ClientEvents OnRowContextMenu="RowContextMenu"></ClientEvents>
                        <Selecting AllowRowSelect="true" />
                    </ClientSettings>
                    <FilterMenu EnableImageSprites="False">
                    </FilterMenu>
                </telerik:RadGrid>
Marin
Telerik team
 answered on 28 Sep 2012
3 answers
132 views
Hi,

i am facing one issue using RadDataPager Control . i want set Last record getting with focus and selected. i am using RadListView template to fill the information. For paging am using RadDataPager Control. My Query is By Defect Last record of the paging index must be focus and selected record can be displayed.
for me this is high priority
Thanks for advance.

Please see the below picture .




Regards
Raj
Princy
Top achievements
Rank 2
 answered on 28 Sep 2012
2 answers
79 views
Hi !

I need to set the focus in the end of the radeditor content. The content is already in the editor when the editor loads and need to set the focus after this content..

Please help..
Nick
Top achievements
Rank 1
 answered on 28 Sep 2012
1 answer
81 views
Hello. Telerik admin.

Is there a way to kee file uploading work from the postback ?
if I upload any file using by RadAsyncupload control, upload control will be begin uploading data to server.
I raised postback from other control while uploading ajax work.
then ajax uploading work was broken. 

please see the below link your RasAsyncUpload demo.
http://demos.telerik.com/aspnet-ajax/upload/examples/async/persistuploadedfiles/defaultcs.aspx?product=asyncupload

1.upload big file for watching the working progress.
2.while uploading file, Select 'country' combobox item.
3.finally uploading data and asyncupload control was initialized.

I would like to keep ajax work even though i raise the postback.
Plamen
Telerik team
 answered on 28 Sep 2012
1 answer
133 views
I've added the "ALL" option to the PageSizeComboBox in RadGrid.
Very similar to this option: http://www.telerik.com/community/forums/aspnet/grid/how-to-add-show-all-option-in-radgrid-paging.aspx#1697877 

Everything works fine, but when I select 'ALL', the navigation buttons are there. 
Unfortunately, when I click on them, they crash my website.

Is it possible to disable or hide the navigation button in RADGrid Paging when the 'ALL' option is selected?
How can I access the navigation buttons in the server side code. 
I tried using this as somebody in some other thread had mentioned in Item_Created Event:
if (e.Item is GridPagerItem) Button prev = ((Button)e.Item.FindControl("Button1")) 
But it doesnt work. Please help.
Eyup
Telerik team
 answered on 28 Sep 2012
1 answer
73 views
Sir ,
I have a radgrid for selfhierarchy. All child items are displayed.
 BUt the child item is also repeated as parent item.
How ican avoid the repeation in radgrid.
Pls help.
ex.

    Empid
      1    parent item
       ------2     child item
       ------3    child item
  5   parent item
  6   parent item
  2    parent item( it is a child item repeated)
  3  parent item( it is a child item repeated)

By jessy

Andrey
Telerik team
 answered on 28 Sep 2012
1 answer
46 views
Sir,

 I have a radtreelist.i try to bind the treelist by my dataset.  But i cannot  bind in a hieracical mode.
child record is existing .


Pls help me.


by Jessy
Andrey
Telerik team
 answered on 28 Sep 2012
2 answers
138 views
I am having a problem with the TreeList.  I am able to populate the list with parent and children elements.  I can update and delete just fine.  I can also Insert a new child element just fine.  However when I try to insert a root level element with debugging enabled I have not been able to get the InsertCommand to fire.  I am also using a user control for the editor.  Here is my code as it is. 

.aspx Page:

<div id="DropUnderWrapper">
    <asp:CheckBox ID="IsUnder" runat="server" Text=" Drop Under Parent" />
</div>
<telerik:RadTreeList ID="MenuManager" runat="server">
    <Columns>
        <telerik:TreeListBoundColumn DataField="MenuText" HeaderText="Menu Name" UniqueName="Name" />
        <telerik:TreeListHyperLinkColumn DataNavigateUrlFields="SitePageID" DataNavigateUrlFormatString="/admin/pageManager/?CID={0}" DataTextField="PageTitle" HeaderText="Url Title" UniqueName="PageTitle"  />
        <telerik:TreeListBoundColumn DataField="MenuUrl" HeaderText="Url" UniqueName="MenuUrl" />
        <telerik:TreeListBoundColumn DataField="MenuTarget" HeaderText="Target" UniqueName="MenuTarget" HeaderStyle-Width="60px" />
        <telerik:TreeListBoundColumn DataField="IsEnabled" HeaderText="Status" UniqueName="MenuItemEnabled" HeaderStyle-Width="60px" />
        <telerik:TreeListEditCommandColumn ButtonType="ImageButton" HeaderStyle-Width="60px" AddRecordText="Add Menu Item" Reorderable="false" />
        <telerik:TreeListButtonColumn ButtonType="ImageButton" ButtonCssClass="deleteConfirm" CommandName="Delete" HeaderStyle-Width="30px" />
    </Columns>
    <EditFormSettings UserControlPath="~/includes/userControls/MenuForm.ascx" EditFormType="WebUserControl">
    </EditFormSettings>
    <ClientSettings AllowItemsDragDrop="true">
        <Selecting AllowItemSelection="True" />
    </ClientSettings>
</telerik:RadTreeList>

Code Behind:

private string[] DataKey = { "MenuID" };
private string[] ParentKey = { "ParentID" };
private List<SiteMenu> MenuList = new List<SiteMenu>();
 
protected override void OnInit(EventArgs e)
{
    base.OnInit(e);
    MenuManager.Skin = "Default";
    MenuManager.AllowPaging = false;
    MenuManager.AutoGenerateColumns = false;
    MenuManager.GridLines = TreeListGridLines.Both;
    MenuManager.ShowTreeLines = false;
    MenuManager.NeedDataSource += MenuManager_NeedDataSource;
    MenuManager.InsertCommand += MenuManager_InsertCommand;
    MenuManager.UpdateCommand += MenuManager_UpdateCommand;
    MenuManager.DeleteCommand += MenuManager_DeleteCommand;
    MenuManager.ItemDataBound += MenuManager_ItemDataBound;
    MenuManager.ItemCommand += MenuManager_ItemCommand;
    MenuManager.ClientSettings.AllowItemsDragDrop = true;
    MenuManager.ClientSettings.Selecting.AllowItemSelection = true;
    MenuManager.AllowMultiItemSelection = true;
    MenuManager.DataKeyNames = DataKey;
    MenuManager.ParentDataKeyNames = ParentKey;
    MenuManager.ItemDrop += MenuManager_RowDrop;
 
    MenuList = new SiteMenu().SelectAllPublicMenuItemsBySiteIDNotDeleted(ThisSiteID);
}
 
protected override void OnLoad(EventArgs e)
{
    base.OnLoad(e);
    if (!IsPostBack)
    {
        MenuManager.ExpandToLevel(1);
    }
}
 
protected void MenuManager_NeedDataSource(object sender, TreeListNeedDataSourceEventArgs e)
{
    MenuManager.DataSource = MenuList;
}
 
protected void MenuManager_ItemCommand(object sender, TreeListCommandEventArgs e)
{
    if (e.CommandName == RadTreeList.InitInsertCommandName)
    {
        MenuManager.ClientSettings.Reordering.AllowColumnsReorder = false;
    }
    if (e.CommandName == RadTreeList.CancelCommandName)
    {
        MenuManager.ClientSettings.Reordering.AllowColumnsReorder = true;
    }
}
 
protected void MenuManager_ItemDataBound(object sender, TreeListItemDataBoundEventArgs e)
{
   //irrelevant
}
 
protected void MenuManager_InsertCommand(object sender, TreeListCommandEventArgs e)
{
    TreeListEditFormItem item = e.Item as TreeListEditFormItem;
    UserControl MenuForm = (UserControl)e.Item.FindControl(TreeListEditFormItem.EditFormUserControlID);
 
    int parentID = (int)item.ParentItem.GetDataKeyValue("MenuID");
 
    RadComboBox menuType = (RadComboBox)MenuForm.FindControl("MenuSelectList");
    RadTextBox menuText = (RadTextBox)MenuForm.FindControl("MenuText");
    switch (menuType.SelectedItem.Text)
    {
        case "Editable Content":
            RadTextBox pageTitle = (RadTextBox)MenuForm.FindControl("PageTitle");
            CheckBox defaultHomepage = (CheckBox)MenuForm.FindControl("DefaultHomepage");
            if (new SiteMenu().InsertNewMenuItem(parentID, menuText.Text, pageTitle.Text, defaultHomepage.Checked))
            {
                Response.Redirect("/admin/menuManager/");
            }
            break;
        case "Document Link":
            UploadedFile uploadedFile = null;
            RadUpload docUpload = (RadUpload)MenuForm.FindControl("DocumentLink");
            if (docUpload.UploadedFiles.Count > 0)
            {
                uploadedFile = docUpload.UploadedFiles[0];
            }
            if (new SiteMenu().InsertNewDocumentLink(parentID, menuText.Text, uploadedFile.GetName()))
            {
                Response.Redirect("/admin/menuManager/");
            }
            break;
        case "External / Custom Link":
            RadTextBox linkUrl = (RadTextBox)MenuForm.FindControl("LinkUrl");
            RadComboBox target = (RadComboBox)MenuForm.FindControl("LinkTarget");
            if (new SiteMenu().InsertExternalLink(parentID, menuText.Text, linkUrl.Text, target.Text))
            {
                Response.Redirect("/admin/menuManager/");
            }
            break;
        case "Chamber Modules":
            RadComboBox moduleType = (RadComboBox)MenuForm.FindControl("ModulePageType");
            if (new SiteMenu().InsertNewModuleMenuItem(parentID, menuText.Text, moduleType.SelectedValue))
            {
                Response.Redirect("/admin/menuManager/");
            }
            break;
    }
}
 
protected void MenuManager_UpdateCommand(object sender, TreeListCommandEventArgs e)
{
      //irrelevant
}
 
protected void MenuManager_DeleteCommand(object sender, TreeListCommandEventArgs e)
{
      //irrelevant
}
 
protected void MenuManager_RowDrop(object sender, TreeListItemDragDropEventArgs e)
{
    int key = (int)e.DraggedItems[0].GetDataKeyValue("MenuID");
 
    int destinationId = 0;
    int sortOrder = 0;
 
    if (IsUnder.Checked)
    {
        destinationId = (int)e.DestinationDataItem.GetDataKeyValue("MenuID");
        sortOrder = 1;
    }
    else
    {
        destinationId = (int)e.DestinationDataItem.GetParentDataKeyValue("ParentID");
        sortOrder = new SiteMenu().SelectThisMenuItem((int)e.DestinationDataItem.GetDataKeyValue("MenuID"), ThisSiteID).SortOrder + 1;
    }
 
    if (destinationId == 0)
    {
        if (key != destinationId)
        {
            MenuList.FirstOrDefault(i => i.MenuID == key).ParentID = destinationId;
            MenuList.FirstOrDefault(i => i.MenuID == key).SortOrder = sortOrder;
 
            foreach (SiteMenu menuItem in MenuList.Where(i => i.ParentID == destinationId))
            {
                if (menuItem.SortOrder >= sortOrder && menuItem.MenuID != key)
                {
                    menuItem.SortOrder += 1;
                }
            }
 
            if (new SiteMenu().UpdateMenuListByParentID(destinationId, MenuList.Where(i => i.ParentID == destinationId).ToList()))
            {
                Response.Redirect("/admin/menuManager/");
            }
        }
    }
    else
    {
        if (key != destinationId && key != MenuList.FirstOrDefault(i => i.MenuID == destinationId).ParentID)
        {
            MenuList.FirstOrDefault(i => i.MenuID == key).ParentID = destinationId;
            MenuList.FirstOrDefault(i => i.MenuID == key).SortOrder = sortOrder;
 
            foreach (SiteMenu menuItem in MenuList.Where(i => i.ParentID == destinationId))
            {
                if (menuItem.SortOrder >= sortOrder && menuItem.MenuID != key)
                {
                    menuItem.SortOrder += 1;
                }
            }
 
            if (new SiteMenu().UpdateMenuListByParentID(destinationId, MenuList.Where(i => i.ParentID == destinationId).ToList()))
            {
                Response.Redirect("/admin/menuManager/");
            }
        }
    }
}
Kevin
Top achievements
Rank 1
 answered on 28 Sep 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?