Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
1.5K+ views
I have this RadGrid
<telerik:RadGrid ID="gvMembers" runat="server"
            AutoGenerateColumns="false"
            OnNeedDataSource="gvMembers_NeedDataSource"
            AllowSorting="true"
            AllowPaging="true"
            PageSize="10"
            AllowAutomaticUpdates="true"
            AllowAutomaticInserts="true"
            AllowAutomaticDeletes="true"
            OnItemCreated="gvMembers_ItemCreated"
            OnItemInserted="gvMembers_ItemInserted"
            OnPreRender="gvMembers_PreRender"
            OnInsertCommand="gvMembers_InsertCommand"
            OnItemDataBound="gvMembers_ItemDataBound"
            OnUpdateCommand="gvMembers_UpdateCommand"
            OnDeleteCommand="gvMembers_DeleteCommand"
 
            >
            <HeaderStyle CssClass="GridHeader" />
            <PagerStyle Mode="NextPrevNumericAndAdvanced" />
            <MasterTableView AutoGenerateColumns="false" DataKeyNames="UserID" CommandItemDisplay="Top" InsertItemPageIndexAction="ShowItemOnCurrentPage">
                <Columns>
                    <telerik:GridEditCommandColumn></telerik:GridEditCommandColumn>
                    <telerik:GridBoundColumn DataField="UserID" HeaderText="UserID" ReadOnly="true" UniqueName="UserID"></telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="FirstName" HeaderText="First Name" SortExpression="FirstName" UniqueName="firstname"></telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="FirstName" HeaderText="Last Name" SortExpression="LastName" UniqueName="lastname"></telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="UserName" HeaderText="User Name" SortExpression="UserName" UniqueName="username"></telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="EmailAddress" HeaderText="Email" SortExpression="EmailAddress" UniqueName="email"></telerik:GridBoundColumn>
 
                    <telerik:GridTemplateColumn UniqueName="TemplateColumn" HeaderText="Role">
                        <ItemTemplate>
                            <asp:Label ID="Label1" runat="server"
                                Text='<%# DataBinder.Eval(Container.DataItem, "Role") %>'>
                            </asp:Label>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:DropDownList ID="ddlRole" runat="server" DataTextField="Role1" DataValueField="RoleID"></asp:DropDownList>
                        </EditItemTemplate>
                    </telerik:GridTemplateColumn>
                    <telerik:GridButtonColumn ConfirmText="Delete this Member?" ConfirmDialogType="RadWindow"
                        ConfirmTitle="Delete" ButtonType="PushButton" Text="Delete" CommandName="Delete" />
                </Columns>
            </MasterTableView>
        </telerik:RadGrid>

 

I am using  astored procedure to handle my updates this is My C# code

protected void gvMembers_UpdateCommand(object sender, GridCommandEventArgs e)
        {
            var editableItem = ((GridEditableItem)e.Item);
            var memberId = (int)editableItem.GetDataKeyValue("UserID");
            int Role = 1;
            CheckBox active = (CheckBox)editableItem["valid"].Controls[0];
            Boolean bactive = Convert.ToBoolean(active);
            string str = active.Text;
            string strFirstName = (editableItem["firstname"].Controls[0] as TextBox).Text;
            string strLastName = (editableItem["lastname"].Controls[0] as TextBox).Text;
            string strUserName = (editableItem["username"].Controls[0] as TextBox).Text;
            string strEmail = (editableItem["firstname"].Controls[0] as TextBox).Text;
 
 
 
            try
                {
                //save chanages to Db
DbContext.AAHomicideLogMembersUpdate(memberId, Role, strFirstName, strLastName, strUserName, strEmail, active);
                }
                catch (System.Exception)
                {
                   string srtt="Dosomething";
                }
            }

 

I am getting an error message on the conversion attempt what am I doing wrong here and what is the proper way to get those values from the checkbox

Perry
Top achievements
Rank 1
 answered on 14 Sep 2017
0 answers
176 views

I have this RAD Grid

 

<telerik:RadGrid ID="gvMembers" runat="server"
            AutoGenerateColumns="false"
            OnNeedDataSource="gvMembers_NeedDataSource"
            AllowSorting="true"
            AllowPaging="true"
            PageSize="10"
            AllowAutomaticUpdates="true"
            AllowAutomaticInserts="true"
            AllowAutomaticDeletes="true"
            OnItemCreated="gvMembers_ItemCreated"
            OnItemInserted="gvMembers_ItemInserted"
            OnPreRender="gvMembers_PreRender"
            OnInsertCommand="gvMembers_InsertCommand"
            OnItemDataBound="gvMembers_ItemDataBound"
            OnUpdateCommand="gvMembers_UpdateCommand"
            OnDeleteCommand="gvMembers_DeleteCommand"
 
            >
            <HeaderStyle CssClass="GridHeader" />
            <PagerStyle Mode="NextPrevNumericAndAdvanced" />
            <MasterTableView AutoGenerateColumns="false" DataKeyNames="UserID" CommandItemDisplay="Top" InsertItemPageIndexAction="ShowItemOnCurrentPage">
                <Columns>
                    <telerik:GridEditCommandColumn></telerik:GridEditCommandColumn>
                    <telerik:GridBoundColumn DataField="UserID" HeaderText="UserID" ReadOnly="true" UniqueName="UserID"></telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="FirstName" HeaderText="First Name" SortExpression="FirstName" UniqueName="firstname"></telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="FirstName" HeaderText="Last Name" SortExpression="LastName" UniqueName="lastname"></telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="UserName" HeaderText="User Name" SortExpression="UserName" UniqueName="username"></telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="EmailAddress" HeaderText="Email" SortExpression="EmailAddress" UniqueName="email"></telerik:GridBoundColumn>
 
                    <telerik:GridTemplateColumn UniqueName="TemplateColumn" HeaderText="Role">
                        <ItemTemplate>
                            <asp:Label ID="Label1" runat="server"
                                Text='<%# DataBinder.Eval(Container.DataItem, "Role") %>'>
                            </asp:Label>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:DropDownList ID="ddlRole" runat="server" DataTextField="Role1" DataValueField="RoleID"></asp:DropDownList>
                        </EditItemTemplate>
                    </telerik:GridTemplateColumn>
                    <telerik:GridButtonColumn ConfirmText="Delete this Member?" ConfirmDialogType="RadWindow"
                        ConfirmTitle="Delete" ButtonType="PushButton" Text="Delete" CommandName="Delete" />
                </Columns>
            </MasterTableView>
        </telerik:RadGrid>

 

I need to bind the asp dropdown list for my Update and Insert.

I tried this C# code:

protected void gvMembers_ItemDataBound(object sender, GridItemEventArgs e)
        {
 
            DropDownList ddl = (DropDownList)e.Item.FindControl("ddlRole");
            ddl.SelectedValue = (string)DataBinder.Eval(e.Item.DataItem, "Role1").ToString();
 
        }

 

But it gets an error message {"Object reference not set to an instance of an object."} when I try to view the web page.

 

What is the proper procedure to accomplish this?

Perry
Top achievements
Rank 1
 asked on 14 Sep 2017
0 answers
181 views

I am using RadGrid Control.

I have created the columns for RadGrid dynamically with two textbox, one dropdown and 1 date picker.

I have created controls dynamically using GridTemplateColumn by assigning UniqueName for ItemTemplate, getting ID for each control(TextBox, Dropdown, DatePicker).

User Inputs the value in dynamically created grid.

While clicking on Save button, the value from each row of the grid should be retrieved. But I am not able to retrieve the values since I created the grid with controls dynamically.

Attached the sample for reference.

 

 

 

 

 

 

Govindon
Top achievements
Rank 1
 asked on 14 Sep 2017
1 answer
203 views

Requirements

Telerik Product and Version


Supported Browsers and Platforms


Components/Widgets used (JS frameworks, etc.)



PROJECT DESCRIPTION 
Hi, I am new to the Telerik and i want to integrate RadGrid control in to ASP.NET. after i download and installed "TelerikUIForAspNetAjaxSetup_a_2017_3_0913_1.exe", I couldn't find Live Demo folder in my installed path. Kindly suggest me how to integrate this telerik grid to my asp.net application?
Vessy
Telerik team
 answered on 14 Sep 2017
7 answers
93 views

Hi,

We have a custom tool in the editor to remove "comments", this works when I simulate IE 7 and works great in Chrome. When I click the button in IE 10 the browser crashes without any details. 

If I debug the code it seems like it is working, the crash seems to happen in RadEditor.js when the checkElementsRecursively() is done. 

Do you have any clue whats happend? I guess it has to do with the removed element.

sb.Append("Telerik.Web.UI.Editor.CommandList[\"StripOneSpan\"] = function(commandName, editor, args){");
sb.Append("var theSelectedElement = editor.getSelectedElement();");
sb.Append("checkElementsRecursively(theSelectedElement)");
sb.Append("};");

 

And the JS-code: 

        function checkElementsRecursively(selElement) {

            if ((selElement.tagName == "FONT" || selElement.tagName == "font" || selElement.tagName == "SPAN" || selElement.tagName == "span") && selElement.attributes["id"] != null && selElement.attributes["id"].value.substring(7, 0) == "abccom_" && selElement.parentNode != null) {
                selElement.parentNode.removeChild(selElement);
            }
        }

Rumen
Telerik team
 answered on 14 Sep 2017
3 answers
119 views

Hi ,

My scenario is as follows,

I have 3 user controls each of which contains Rad Map with some data.

This is displaying correctly. However my problem is that I am using these user controls in 3 different tabs using Rad Tab same as the 'Load On demand' demo of the RadTab in Telerik site. On the initial tab change the map displays correctly. But if keep changing the tabs the maps are shifting its position to the left.

Why is this happening?

Thanks

Rumen
Telerik team
 answered on 14 Sep 2017
5 answers
1.1K+ views

hi there,

Please help me to setup my RadGrid.

My scenario is : I click on a linkbutton with a navigateUrl which contains parameters I need to Load the RadGrid. With that parameter, I can load my list of Entities.

But the visual representation of theses datas, is not a classical RadGrid with properties columns binding.

In fact, I need to Bind each Entity into a Cell of my RadGrid. How can I realise it ?

I am trying this code :

public void Loading()

{

            List<T> entities = getFromDb(); // T is my complex Object

            // Determine what will be the rows
            List<string> rows = entities.Select(e => e.X_MyProperty).Distinct().ToList();

              // Determine what will be the columns
            List<string> columns = entities.Select(e => e.Y_MyProperty).Distinct().ToList();
            
            DataTable table = new DataTable();

            table.Columns.Add("FirstColumn");

            foreach (string columnsName in columns)
            {
                   table.Columns.Add(columnsName);
            }

            foreach (var row in rows)
            {
                TableRow r = new TableRow();
                table.Rows.Add(r);
                r.Cells.Add(new TableCell {Text = row });

                for (int i = 0; i < columns.Count; i++)
                {
                    var c = new TableCell();
                    r.Cells.Add(c);

                    c.Controls.Add(new Label { Text = "A Property of T to display" });
                }
            }

            GridDetailEmplacements.DataSource = table;
            GridDetailEmplacements.DataBind();

}

 

Inside the ASPX file : 

 <telerik:RadGrid runat="server" ID="GridDetailEmplacements" AutoGenerateColumns="False">
                        <ClientSettings ReorderColumnsOnClient="false" AllowColumnsReorder="false">
                            <Selecting AllowRowSelect="false" EnableDragToSelectRows="false" />
                            <Resizing AllowColumnResize="false" ResizeGridOnColumnResize="false" AllowResizeToFit="false" />
                        </ClientSettings>

                        <HeaderStyle HorizontalAlign="Center" Font-Size="14px"></HeaderStyle>
                        <ItemStyle HorizontalAlign="Left" Font-Names="Arial Unicode MS" Font-Size="12px" />
                        <AlternatingItemStyle HorizontalAlign="Left" Font-Names="Arial Unicode MS" Font-Size="12px" />

                    </telerik:RadGrid>

How can I Bing different properties of my Object of T inside each cells ?

I would like render acell with a simple asp:Table which contains 3 rows with 3 properties of my Object

 

Thank's for helping 

 

Best regards

jeremie
Top achievements
Rank 1
 answered on 14 Sep 2017
1 answer
317 views

Hi,
I recently updated the version 2011 to 2017, but the radComboBox object I have on my pages has been unconfigured, as I show in the attached image.

Please help me on this issue.

Thank you.

 

Html:
<div id="ctl00_ctl00_placeHolderMain_mainWebCad_frmMoeda_cmbPais" class="RadComboBox RadComboBox_Default" style="width:160px;white-space:normal;">
<table summary="combobox" style="border-width:0;border-collapse:collapse;width:100%">
<tbody><tr class="rcbReadOnly">
<td class="rcbInputCell rcbInputCellLeft" style="width:100%;"><input name="ctl00$ctl00$placeHolderMain$mainWebCad$frmMoeda$cmbPais" type="text" class="rcbInput radPreventDecorate" id="ctl00_ctl00_placeHolderMain_mainWebCad_frmMoeda_cmbPais_Input" value="-Selecione uma opção-" readonly="readonly" autocomplete="off"></td><td class="rcbArrowCell rcbArrowCellRight"><a id="ctl00_ctl00_placeHolderMain_mainWebCad_frmMoeda_cmbPais_Arrow" style="overflow: hidden;display: block;position: relative;outline: none;">select</a></td>
</tr>
</tbody></table><input id="ctl00_ctl00_placeHolderMain_mainWebCad_frmMoeda_cmbPais_ClientState" name="ctl00_ctl00_placeHolderMain_mainWebCad_frmMoeda_cmbPais_ClientState" type="hidden" autocomplete="off">
</div>

 

 

CSS:

.RadComboBox_Default .rcbInputCellLeft {
    background-image: url("/Hotsite/Content/Images/forms/telerikComboCMFlex.png") !important;
}

.RadComboBox_Default .rcbInputCellRight {
    background-image: url("/Hotsite/Content/Images/forms/telerikComboCMFlex.png") !important;
}

.RadComboBox_Default .rcbArrowCellLeft {
    background-image: url("/Hotsite/Content/Images/forms/telerikComboCMFlex.png") !important;
}

.RadComboBox_Default .rcbArrowCellRight {
    background-image: url("/Hotsite/Content/Images/forms/telerikComboCMFlex.png") !important;
}

.RadComboBox table td.rcbInputCell {
    height: 29px !important;
}

.RadComboBox table td.rcbInputCell {
    width: 100% !important;
    padding-left: 2px !important;
}

.RadComboBox .rcbInputCell .rcbInput {
    width: 100% !important;
    padding-left: 2px !important;
}

.radComboBox .rcbInputCell .rcbInputCell {
    width: 100%;
}

.RadComboBox .rcbHovered .rcbInput {
    width: 95% !important;
}

.RadComboBox .rcbFocused .rcbInput {
    width: 95% !important;
}

.RadComboBox .rcbDisabled .rcbInput {
    width: 95% !important;
}

.RadComboBox_Default .rcbHovered .rcbReadOnly td.rcbInputCellLeft {
    background-position: 0px -32px !important;
}

.RadComboBox_Default .rcbFocused .rcbReadOnly td.rcbInputCellLeft {
    background-position: 0px -64px !important;
}

.RadComboBox_Default .rcbDisabled .rcbReadOnly td.rcbInputCellLeft {
    background-position: 0px -64px !important;
}

.RadComboBox_Default .rcbReadOnly td.rcbArrowCellRight {
    background-position: -4px -96px !important;
}

.RadComboBox_Default .rcbHovered .rcbReadOnly .rcbArrowCellRight {
    background-position: -64px -96px !important;
}

.RadComboBox_Default .rcbFocused .rcbReadOnly .rcbArrowCellRight {
    background-position: -125px -96px !important;
}

.RadComboBox_Default .rcbDisabled .rcbReadOnly td.rcbArrowCellRight {
    background-position: -125px -96px !important;
}

.RadComboBox .rcbReadOnly td.rcbArrowCell a {
    width: 18px !important;
}

.RadComboBox .rcbReadOnly td.rcbArrowCell {
    width: 18px !important;
}

.RadComboBox_Default td.rcbArrowCellRight {
    background-position: -2px -108px !important;
}

Vessy
Telerik team
 answered on 14 Sep 2017
1 answer
50 views

I have a RadGrid with a .Resx for switching Cultures. the UI is switched from global.asax with a button in MasterPage. All labels an titles are switched correcly but the grid and other telerik controls are not working properly. they stay with the previous culture.

Vessy
Telerik team
 answered on 14 Sep 2017
2 answers
97 views

I tried to apply my own gif to the "expanded" arrow but when clicking it shows nothing at all.  I tried setting background-color as a control test and that worked fine.

The gif is currently just a plain colored square so it'd be pretty obvious to see that it's working.

Attachment shows how it looks on the page (no icons).

Where am I going wrong?

Here's my CSS:

.RadTreeView_MetroTouch .rtMinus {
    background-image: url('../Images/Test.gif') !important;   
}
Kenyon
Top achievements
Rank 1
 answered on 13 Sep 2017
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?