Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
182 views
I have dynamically added RadGrid on a RadWindow using a ITemplate. I cant get ItemInsert event to fire.
I image something with the initialization is not correct i.e. base.OnInIt(e);. Could it be the problem ?

Here is my code:

void ITemplate.InstantiateIn(Control owner)
        {
            RadGrid rg = new RadGrid();
            rg.ID = "UserManagementTemplateGrid";
            rg.Width = 600;
            rg.Skin = "Default";
            rg.NeedDataSource += new GridNeedDataSourceEventHandler(rg_NeedDataSource);
           
            rg.RegisterWithScriptManager = true;
            rg.PagerStyle.Mode = GridPagerMode.NextPrevAndNumeric;
            rg.ShowHeader = true;
            rg.AutoGenerateColumns = false;
            rg.AutoGenerateEditColumn = false;
            rg.AllowAutomaticInserts = true;
            rg.AllowAutomaticUpdates = true;
            rg.AllowAutomaticDeletes = true;
            rg.AllowSorting = true;
            rg.PageSize = 10;
            rg.AllowPaging = true;

            rg.MasterTableView.Name = "MasterTableView";
            rg.MasterTableView.EditMode = GridEditMode.InPlace;
            rg.MasterTableView.DataKeyNames = new string[] { "ID", "UserName", "Password", "Email", "UserTypeID", "Active" };

            rg.MasterTableView.Columns.Add(AddBoundColumn("ID", "ID", false));
            rg.MasterTableView.Columns.Add(AddBoundColumn("UserName", "User name", true));
            rg.MasterTableView.Columns.Add(AddBoundColumn("Password", "Password", true));
            rg.MasterTableView.Columns.Add(AddBoundColumn("Email", "Email", true));
            rg.MasterTableView.Columns.Add(
                AddTemplateDropDownListColumn("UserTypeID", ListTypes.UserType, "Type", "UserTypeName", "UserTypeID")
            );
            rg.MasterTableView.Columns.Add(
                AddTemplateDropDownListColumn("Active", ListTypes.Active, "Active", "Active", "Active")
            );

            GridEditCommandColumn gecc = new GridEditCommandColumn();
            gecc.UniqueName = "EditCommandColumn";
            gecc.ButtonType = GridButtonColumnType.ImageButton;
            gecc.EditText = "Edit";
            gecc.UpdateText = "Save";
            gecc.CancelText = "Cancel";
            gecc.InsertText = "Add new";
            rg.MasterTableView.Columns.Add(gecc);

            rg.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.Top;
            rg.MasterTableView.CommandItemSettings.AddNewRecordText = "Add new";
           
            //grid events
            rg.ItemInserted += new GridInsertedEventHandler(rg_ItemInserted);
            rg.ItemUpdated += new GridUpdatedEventHandler(rg_ItemUpdated);
            rg.ItemDeleted += new GridDeletedEventHandler(rg_ItemDeleted);
            rg.InsertCommand += new GridCommandEventHandler(rg_InsertCommand);

            //Adding RadGrid to Control
            owner.Controls.Add(rg);
        }

void rg_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
        {
            RadGrid rg = (RadGrid)sender;
            rg.DataSource = User.GetUsers;
        }

void rg_ItemInserted(object sender, GridCommandEventArgs e)
        {
            throw new NotImplementedException();
        }

Princy
Top achievements
Rank 2
 answered on 21 Jul 2011
1 answer
169 views
Hi, I would like to be able to localize the text of the buttons inside the confirmdialog when a user deletes a record from the grid. Is this possible?

 Attached is a picture of what i am talking about

Thanks
Princy
Top achievements
Rank 2
 answered on 21 Jul 2011
3 answers
121 views
Hi,

I have a RadGrid with an EditItemTemplate and a DetailTable. I would like for the detail to be displayed when I edit an item, and have the following code in my ItemCommand event:
switch (e.CommandName)
{
    case RadGrid.EditCommandName:
        e.Item.OwnerTableView.IsItemInserted = false;
        e.Item.Expanded = true;
        break;
    case RadGrid.InitInsertCommandName:
        // Cancel any edit form
        foreach (GridItem item in e.Item.OwnerTableView.Items)
        {
            if (item is GridEditableItem)
            {
                GridEditableItem ei = item as GridEditableItem;
                ei.Edit = false;
            }
        }
        break;
    default:
        break;
}

But when I click edit, the form is displayed but the item does not expand. I have checked that no other code is being executed that might do a Rebind().

Any reason this might be happening?

ROSCO
Lucania
Top achievements
Rank 1
 answered on 21 Jul 2011
1 answer
96 views
Hi Folks,

We just dropped an empty combo box on our page and it looks like the attached file:

We then created a completely new web app and new blank page and the combo box looks normal.

One thing we noticed is that intellisense isn't working in the existing page with the wonky render.

Any suggestions as to where to start looking?

Thanks!


Robert
Top achievements
Rank 1
 answered on 20 Jul 2011
1 answer
77 views
It works fine when editing an existing node, but when adding a new node and setting startEdit for that node it doesn't fire the server side NodeEdit event after entering the new text.

Adding the new node appears ok on the client side, it gives me a new node and goes into edit, but I never hit the server NodeEdit handler.  I have postback disabled on the context menu for Edit and Add specifically to handle those in NodeEdit.

Is there something else I need to specify on the client side to get that node hooked up?

Here is my client side code:

function onClientContextMenuItemClicking(sender, eventArgs)
        {
            var node = eventArgs.get_node();
            var item = eventArgs.get_menuItem();
  
            if (item.get_text() == "Edit")
                node.startEdit();
            else if (item.get_text() == "Add")
            {
                var newnode = new Telerik.Web.UI.RadTreeNode();
                newnode.set_text("New Item");
                node.get_nodes().add(newnode);
                newnode.startEdit();
            }
        }

Marbry
Top achievements
Rank 1
 answered on 20 Jul 2011
3 answers
101 views
Is there is a way (other than building static images for each specific one) to create a non-editable label on individual nodes?

So that following the pattern,

Item 1
    Property 1:  property1 value
    Property 2:  property2 value

Where the 'property1 value' is the actual text of the node, and "Property 1:" is the node 'label'.  Such that when the user elects to edit that property, they're only editing the text of "property1 value", not the label.
Marbry
Top achievements
Rank 1
 answered on 20 Jul 2011
2 answers
338 views
Hi,

I'm trying to create a SQL-style WHERE ColumnName IN('a', 'b', 'c') filter for one of my RadGrid columns.

In my RadGrid I have a GridBoundColumn using a FilterTemplate which has a RadComboBox with a number of CheckBoxes inside it.

<telerik:GridBoundColumn HeaderText="Type" DataField="Type" UniqueName="Type" AutoPostBackOnFilter="true">
    <FilterTemplate>
        <telerik:RadComboBox 
            ID="cmbType"
            runat="server"
            DataSource="<%# TypeFilterItems %>"
            DataValueField="TypeId"
            DataTextField="Title"
            EmptyMessage="All"                
            AllowCustomText="true"
            Width="130px"
            OnClientDropDownClosing="FilterOnType">
            <ItemTemplate>
 
                <div class="combo-item-template">
                    <div class="clear">
                        <asp:CheckBox runat="server" ID="chkType" Checked="true" onclick="TypeCheckBoxClick(this)" style="float:left;" />
                        <p class="floatLeft"><%# Eval("Title") %></p>
                    </div>
                </div>
 
            </ItemTemplate>
 
        </telerik:RadComboBox>
 
        <telerik:RadScriptBlock ID="RadScriptBlock3" runat="server">
            <script type="text/javascript">
                function FilterOnType(sender, args) {
                    var tableView = $find("<%# Container.OwnerTableView.ClientID %>");
                    tableView.filter("Type", text, "Custom");
                }
 
                function TypeCheckBoxClick(chk) {
                    var combo = $find('<%# Container.FindControl("cmbType").ClientID %>');
 
                    // Get the collection of all items
                    var items = combo.get_items();
 
                    text = ""; values = "";
 
                    // Enumerate all items
                    for (var i = 0; i < items.get_count(); i++) {
                        var item = items.getItem(i);
 
                        // Get the checkbox element of the current item
                        var chk1 = $get(combo.get_id() + "_i" + i + "_chkType");
                        if (chk1.checked) {
                            text += item.get_text() + ",";
                            values += item.get_value() + ",";
                        }
                    }
 
                    // Remove the last comma from the string
                    text = text.replace(/,$/, "");
                    values = values.replace(/,$/, "");
                    combo.set_text(text);
                }
            </script>
        </telerik:RadScriptBlock>
    </FilterTemplate>
</telerik:GridBoundColumn>

This part is all working fine.  What I want to do is tell the RadGrid to filter and show only the options the user has ticked in the RadComboBox's CheckBoxes.

e.g.: If the user open the ComboBoxList filter and selects A, B and D, I'd like the grid to filter and show only results in that column which are A, B or D.  Is this possible with native RadGrid filtering?  And if not, any ideas on the best was to achieve it?

Cheers,

Adam
Brian
Top achievements
Rank 1
 answered on 20 Jul 2011
1 answer
111 views
i have a rad context menu like this.(on a radGrid)

 

 

<telerik:RadContextMenu ID="OptionsRadContextMenu" runat="server" Skin="WebBlue"

 

 

 

CssClass="leftText">

 

 

 

<Targets>

 

 

 

<telerik:ContextMenuControlTarget ControlID="PopupMenuImage" />

 

 

 

</Targets>

 

 

 

<Items>

 

 

 

<telerik:RadMenuItem Text="Copy" ImageUrl="../App_Themes/GOLD Main/ToolBar/save_16x16.gif" />

 

 

 

<telerik:RadMenuItem Text="Post Results" ImageUrl="../App_Themes/GOLD Main/ToolBar/edit_16x16.gif" />

 

 

 

<telerik:RadMenuItem Text="Item Inspection Report">

 

 

 

<Items>

 

 

 

<telerik:RadMenuItem Text="Details" ImageUrl="../App_Themes/GOLD Main/ToolBar/print_16x16.gif" />

 

 

 

<telerik:RadMenuItem Text="Summary" ImageUrl="../App_Themes/GOLD Main/ToolBar/print_16x16.gif" />

 

 

 

</Items>

 

 

 

</telerik:RadMenuItem>

 

 

 

</Items>

 

 

 

</telerik:RadContextMenu>

on Databind i declare my pop up menu and bind to the first two.

 

RadMenu

 

 

RadPopupMenu = (RadMenu)e.Item.Cells[0].FindControl("OptionsRadContextMenu");

 

RadPopupMenu.Items[0].NavigateUrl =

 

String.Format("javascript:OpenCopyItem({0},{1},{2},{3},{4})", woid, detailid, wonumber, locationid, wolinenumber);

 

RadPopupMenu.Items[1].NavigateUrl =

 

String.Format("javascript:OpenPostResults({0},{1})", woid, detailid, wonumber, locationid);

 

 

 

my question is how can i get to the "sub-menus" or the item that has other items? once i try to reference past [1] to say "RadPopupMenu.Items[2]" - i get an error. any help is appreciated.
thanks again
rik


rik butcher
Top achievements
Rank 1
 answered on 20 Jul 2011
1 answer
275 views
I put customised image on the left side of the panel bar,but the default image on the radpanelbar on right side is still visible. How I can hide that Default expand Icon So that only customised image should visible on left side?
Kate
Telerik team
 answered on 20 Jul 2011
1 answer
93 views

I put customised image on the left side of the panel bar,but the default image on the radpanelbar on right side is still visible. How I can hide that Default expand Icon So that only customised image should visible on left side?

 

Kate
Telerik team
 answered on 20 Jul 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?