Telerik Forums
UI for ASP.NET AJAX Forum
5 answers
287 views

I have a telerik RadGrid. I have applied Manual CRUD operations in it. I am using In-Place editing mode. The problem is, when I am trying to Insert or Update the records, i am getting null values by this method 

e.Item.OwnerTableView.ExtractValuesFromItem(newValues, editedItem);

Same thing happening in both RadGrid_UpdateCommand and ​RadGrid_​InsertCommand. 

Following is my ASPX code

<telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
                    <telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="true" />
                    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
                        <AjaxSettings>
                            <telerik:AjaxSetting AjaxControlID="rGrid">
                                <UpdatedControls>
                                    <telerik:AjaxUpdatedControl ControlID="rGrid" LoadingPanelID="RadAjaxLoadingPanel1" />
                                </UpdatedControls>
                            </telerik:AjaxSetting>
                        </AjaxSettings>
                    </telerik:RadAjaxManager>
                    <telerik:RadAjaxLoadingPanel runat="server" ID="RadAjaxLoadingPanel1" />
                    <telerik:RadFormDecorator ID="RadFormDecorator1" runat="server" DecorationZoneID="demo" EnableRoundedCorners="false" DecoratedControls="All" />
 
                    <telerik:RadGrid ID="rGrid" runat="server" AllowPaging="True" PageSize="10"
                    AllowSorting="True" AutoGenerateColumns="false"
                    AllowFilteringByColumn="True" CellSpacing="0" GridLines="None"
                    OnNeedDataSource="rGrid_NeedDataSource" OnItemCreated="rGrid_ItemCreated"
                    OnPreRender="rGrid_PreRender" OnInsertCommand="rGrid_InsertCommand"
                    OnUpdateCommand="rGrid_UpdateCommand" ondeletecommand="rGrid_DeleteCommand">
                    <PagerStyle Mode="NextPrevAndNumeric" />
                    <GroupingSettings CaseSensitive="false" />
                    <MasterTableView DataKeyNames="ID" EditMode="InPlace" CommandItemDisplay="Top" InsertItemPageIndexAction="ShowItemOnCurrentPage">
                        <Columns>
                            <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn" HeaderText="Edit">
                            </telerik:GridEditCommandColumn>
                            <telerik:GridBoundColumn DataField="ID" UniqueName="ID" HeaderText="ID" ColumnEditorID="GridTextBoxEditor1" ReadOnly="true">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="Name" UniqueName="Name" HeaderText="Name" ColumnEditorID="GridTextBoxEditor1">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="ContactPerson" UniqueName="ContactPerson" HeaderText="Contact Person" ColumnEditorID="GridTextBoxEditor2">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="Address" UniqueName="Address" HeaderText="Address" ColumnEditorID="GridTextBoxEditor3">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="Country" UniqueName="Country" HeaderText="Country" ColumnEditorID="GridTextBoxEditor4">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="City" UniqueName="City" HeaderText="City" ColumnEditorID="GridTextBoxEditor5">
                            </telerik:GridBoundColumn> 
                            <telerik:GridBoundColumn DataField="Phone" UniqueName="Phone" HeaderText="Phone" ColumnEditorID="GridTextBoxEditor6">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="Email" UniqueName="Email" HeaderText="Email" ColumnEditorID="GridTextBoxEditor7">
                            </telerik:GridBoundColumn>
                            <telerik:GridClientDeleteColumn HeaderText="Delete" ButtonType="ImageButton">
                            <%--<telerik:GridButtonColumn ConfirmText="Delete this product?" ConfirmDialogType="RadWindow"
                            ConfirmTitle="Delete" ButtonType="ImageButton" CommandName="Delete" />--%>
                            <HeaderStyle Width="70px" />
                        </telerik:GridClientDeleteColumn>
                        </Columns>
                        <EditFormSettings>
                            <EditColumn ButtonType="ImageButton" />
                        </EditFormSettings>
                    </MasterTableView>
                <ClientSettings>
                    <ClientEvents OnUserAction="UserAction" />
                </ClientSettings>
                </telerik:RadGrid>

Following is Code behind

public partial class Suppliers : System.Web.UI.Page
   {
       protected void Page_Load(object sender, EventArgs e)
       {
           if (!IsPostBack)
           {
                
           }
       }
 
       protected void rGrid_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
       {
           Code.BLL.Suppliers objSuppliers = new Code.BLL.Suppliers();
           List<Code.BLL.Suppliers> lstSupplier = objSuppliers.Load();
 
           rGrid.DataSource = lstSupplier;
       }
 
       protected void rGrid_ItemCreated(object sender, Telerik.Web.UI.GridItemEventArgs e)
       {
 
       }​
 
       protected void rGrid_PreRender(object sender, EventArgs e)
       {
       }
 
       protected void rGrid_InsertCommand(object sender, GridCommandEventArgs e)
       {
           GridEditableItem editedItem = e.Item as GridEditableItem;
 
           Hashtable newValues = new Hashtable();
           e.Item.OwnerTableView.ExtractValuesFromItem(newValues, editedItem);
           //editedItem.ExtractValues(newValues); I have tried both methods, but got null values from both
       }
 
       protected void rGrid_UpdateCommand(object sender, GridCommandEventArgs e)
       {
           GridEditableItem editedItem = e.Item as GridEditableItem;
 
           //Prepare new dictionary object
           Hashtable newValues = new Hashtable();
           e.Item.OwnerTableView.ExtractValuesFromItem(newValues, editedItem);
           editedItem.ExtractValues(newValues);I have tried both methods, but got null values from both
 
       }
 
       protected void rGrid_DeleteCommand(object sender, GridCommandEventArgs e)
       {
 
       }
   }

Dimo
Telerik team
 answered on 23 Nov 2016
3 answers
376 views

Hi,

I have a rad button in a rad window, with both client click and on server event. the page in which the rad window is there has a radajaxmanager and a rad grid. The server event handles the export of radgrid data to an excel, this is an ajax request. I do not want to use the gridexporting. The following code exports the file:

 using (ClosedXML.Excel.XLWorkbook wb = new ClosedXML.Excel.XLWorkbook())
        {
            var worksheet = wb.Worksheets.Add(datatable, fileName);
            worksheet.Tables.First().ShowAutoFilter = false;
            worksheet.Tables.First().Theme = ClosedXML.Excel.XLTableTheme.None;

httpContext.Response.Clear();
            httpContext.Response.Buffer = true;
            httpContext.Response.Charset = Encoding.UTF8.WebName;
            httpContext.Response.AddHeader("content-disposition", string.Format("{0}{1}", "attachment;filename=", fileName));
            httpContext.Response.ContentType = contentType;

using (System.IO.MemoryStream memoryStream = new System.IO.MemoryStream())

            {
                workbook.SaveAs(memoryStream);
                memoryStream.WriteTo(httpContext.Response.OutputStream);
                httpContext.Response.Flush();
                httpContext.Response.End();
            }

}

After exporting the file, the ClientEvents-OnResponseEnd of radajaxmanager is not firing in Safari browser on MAC, I want this event to be fired to hide an image. It is firing in IE and Chrome on both MAC and windows but not in Safari. Please suggest.

Thanks in advance.

Saravana

 

Konstantin Dikov
Telerik team
 answered on 23 Nov 2016
4 answers
405 views

I have an asp.net application hosted on IIS and while the site works perfectly on my local dev machine once I upload it to a web server running IIS, all the controls look wrong.

The runtime DLLs have been installed on the server also.

Not exactly sure why this is happening but I suspect it is some config issue.

See below for how it behaves.

Any idea on a fix?

 

Rumen
Telerik team
 answered on 23 Nov 2016
2 answers
201 views
When inserting an image via the Image Manager, the css for the height, width, border attributes that are chosen is properly generated.  However, for better compatibility with some email rendering clients, I also need to have these attributes exist as html image tag attributes (for example:  <img width="100" height="100" border="2" .)  When I manually add these attributes to the image tag, I find that the editor deletes the border attribute.  How can I prevent this deletion from occurring?  I have uploaded examples to show what I manually add and what the editor keeps/deletes.  Thank you.
Laurie
Top achievements
Rank 1
 answered on 22 Nov 2016
0 answers
118 views

Hello,

 

We are using Telerik windows control in our code and recently we upgraded to windows 10 anniversary version after the upgrade Telerik windows control grid is not working as expected (Grouping and drag and drop) feature, and we are able to use the same feature in other operating systems. could anybody please help me here, recently all our agents upgraded to windows 10 anniversary version so we have to find a way to fix this problem.

 

When i am researching about this issue i found some answers if we upgrade .1 Net Framework to another we have upgarde the Telerik Windows Control too, So i wanted to know same issue causing problems in our upgarde to Windows 10 just need your expertise. 

Thanks in Advance

Regards,

Mannava

mannava
Top achievements
Rank 1
 asked on 22 Nov 2016
2 answers
119 views

I am unable to exclude ajax enabled control (Button2) that resides inside panel (PanelButtons) as shown below. I tried to use the following code, I don't get any errors, but the button click is not working. I tried by using RadScriptManager's RegisterPostBackControl method. I also tried to disable AJAX via the OnRequestStart event as well as InitializeRequest event. None of them seems to work. So, is there any better solution for this scenario? Thanks.

  <asp:Content runat="server" ContentPlaceHolderID="Content1">
   <telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy1" runat="server">
   <AjaxSettings>
    <telerik:AjaxSetting AjaxControlID="RadGrid1">
     <UpdatedControls>             
      <telerik:AjaxUpdatedControl ControlID="RadWindow1" />    
      <telerik:AjaxUpdatedControl ControlID="PanelButtons" />
     </UpdatedControls>
    </telerik:AjaxSetting>
    </AjaxSettings>
 </telerik:RadAjaxManagerProxy>
  <telerik:RadGrid ID="RadGrid1" runat="server" OnNeedDataSource="RadGrid1_NeedDataSource">
    <MasterTableView>
     <Columns>                  
     </Columns>
    </MasterTableView>
    <ClientSettings EnablePostBackOnRowClick="false" >
     <Selecting AllowRowSelect="true" />
     <ClientEvents OnRowClick="openRadWindow" OnRowSelected="RadGrid1_RowSelect" />
    </ClientSettings>       
 </telerik:RadGrid>
  <telerik:RadWindow ID="RadWindow1" runat="server" >
   <ContentTemplate>
   <div>...</div>
      <asp:Panel ID="PanelButtons" runat="server">
     <telerik:RadButton ID="Button1" Text="Save" runat="server">
     <telerik:RadButton ID="Button2" Text="Save" runat="server" OnClientClicking="Button2_Click"
        OnClick="Button2_Click" AutoPostBack="false">
     <telerik:RadButton ID="Button3" Text="Save" runat="server">
     <telerik:RadButton ID="Button4" Text="Save" runat="server">
    </asp:Panel>
   </ContentTemplate>
 </telerik:RadWindow>
</asp:Content>
 <telerik:RadCodeBlock runat="server">       
 <script type="text/javascript">
  
 function pageLoad()
 {
  win = $find("<%= RadWindow1.ClientID %>");
 }
 function openRadWindow() {
  win.show(); 
 }
 
 function Button2_Click()
 {
  __doPostBack("<%= Button2.ClientID %>", "");
 }
 </script>
</telerik:RadCodeBlock>

Server side:

protected void Page_Load(object sender, EventArgs e)
{

   var mngr = RadScriptManager.GetCurrent(this.Page);   

     mngr.RegisterPostBackControl(Button2);

}

 

kevin
Top achievements
Rank 1
 answered on 22 Nov 2016
1 answer
124 views

Hi,

 

How can I have the dependent drop down n Grid filter, for example a grid contains Country , City , Train stations.and User select country,the filter is applied on grid but the city should also need to rebind with the country filter value.

This is my first time to use Telerik controls.

 

Regards,

 

 

 

Pavlina
Telerik team
 answered on 22 Nov 2016
1 answer
138 views

Hello,

I have a hiearchal radgrid with a parent level that has 2 key columns.

For example:

ID, Sequence, first_name, last_name

This can result in data that looks like the following:

1, 1, John, Doe
1, 2, Adrian, Shepard
2, 1, Mary, Jane

That child level has:

ID, Sequence, Data

So you can have data that looks like the following:

1, 1, 0.256
1, 2, 0.944
2, 1, 0.109

How can I code the grid so that the child level uses both ID and Sequence as a composite key when the radgrid is built entirely in code?

At the moment I use:

relationFields = New GridRelationFields()
relationFields.MasterKeyField = "ID"
relationFields.DetailKeyField = "ID"
tableView.ParentTableRelation.Add(relationFields)

How do I code it so that it references both ID and Sequence as the relationship so that the grid looks like:

John, Doe
     0.256
Adrian, Shepard
     0.944
Mary, Jane
    0.109

instead of:

John, Doe
     0.256
     0.944
Adrian, Shepard
     0.256
     0.944
Mary, Jane
    0.109

which is wrong, since it is repeating the values on 2 rows because they share the first part of the relationship instead of also considering the second column.

I've looked in the documentation but the only information I've found on creating a composite key relationship involved doing so in the HTML, which is not an option for me as the radgrid is 100% generated in VB code on the server side.

Thanks for any assistance.

Viktor Tachev
Telerik team
 answered on 22 Nov 2016
2 answers
288 views

Hi, im trying everything to create some space (or margin) between Legend´s markers, but i can´t do that...

I attach a picture of my problem. I have a green and red legend Markers. They are too close from each other...how can i have some space between them ??

There´s any way to do that? Javascript? jQuery ?

Thanks!

 

 

Metallica
Top achievements
Rank 1
 answered on 22 Nov 2016
1 answer
190 views
How do I keep the new order of reordered columns when exporting to excel? It keeps reverting back to the original column order when I export.
Eyup
Telerik team
 answered on 22 Nov 2016
Narrow your results
Selected tags
Tags
+? more
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?