Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
536 views

I have a grid that is in edit mode an update delete command in grid.

I have some textboxes (for name, surname etc) and and a radgrid on my web page.(for products for example). all radgrid's rows are in "inplace" edit mode

I want to use the 'Add new Record' on the RadGrid and then with an external button want to save it to database.

Used the link as reference : https://www.telerik.com/forums/update-radgrid-with-external-button-(all-rows-in-edit-mode)

Marin Bratanov
Telerik team
 answered on 05 Sep 2018
4 answers
188 views

hi,

I'm trying to figure out how to add a clickable hyperlink to a cell, currently I receive the contents from a SQL backend, check if the value contains a link and add it as a cell.Link, it currently shows them as links but they are not clickable, what pony trick am i missing? thanks for you advise. ps: this is in C#

 

if (cellValue.Contains("http://")) {
    cell.Link = cellValue;
}

 

kind regards, iwan

Iwan
Top achievements
Rank 2
 answered on 05 Sep 2018
1 answer
839 views

I have a Grid where I select a row.  When I select a row I want to capture the email address that's displayed in the Grid.  I typically use a SqlDataSource as the data source for my Grids and don't have any trouble getting the value from a cell on a selected row, but this time I had to use a DataTable.  Please help me modify my code so that I may capture the email address from the selected row on the Grid.

 

Here is the Grid markup:

<telerik:RadGrid ID="rgAdUsrs" runat="server" AutoGenerateColumns="false" AllowPaging="true" AllowSorting="true" AllowFilteringByColumn="true" ShowGroupPanel="true" Skin="Office2010Black" OnSelectedIndexChanged="rgAdUsrs_SelectedIndexChanged" GroupingSettings-CaseSensitive="false">
            <ClientSettings AllowDragToGroup="true" AllowColumnsReorder="true" ReorderColumnsOnClient="true"></ClientSettings>
            <MasterTableView>               
                <PagerStyle PageSizes="10, 25, 50, 100, 250, 400" AlwaysVisible="true" />               
                <Columns>
                    <telerik:GridButtonColumn ButtonType="LinkButton" Text="Select" CommandName="Select"></telerik:GridButtonColumn>
                    <telerik:GridBoundColumn DataField="givenName" HeaderText="First Name" SortExpression="givenName" UniqueName="givenName" FilterControlAltText="Filter givenName column" HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center"></telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="sn" HeaderText="Last Name" SortExpression="sn" UniqueName="sn" FilterControlAltText="Filter sn column" HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center"></telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="mail" HeaderText="Email" SortExpression="mail" UniqueName="mail" FilterControlAltText="Filter mail column" HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center"></telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="department" HeaderText="Department" SortExpression="department" UniqueName="department" FilterControlAltText="Filter department column" HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center"></telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="manager" HeaderText="Manager" SortExpression="manager" UniqueName="manager" FilterControlAltText="Filter manager column" HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center"></telerik:GridBoundColumn>                   
                </Columns>
            </MasterTableView>
        </telerik:RadGrid>

 

Here is the code behind for the SelectedIndexChanged event:

protected void rgAdUsrs_SelectedIndexChanged(object sender, EventArgs e)
        {
            foreach (GridDataItem item in rgAdUsrs.SelectedItems)
            {
                repidtxttest.Text = item["mail"].Text;
                hdnRepId.Value = item["mail"].Text;
                hdnRepGivenName.Value = item["givenName"].Text;
                hdnRepSn.Value = item["sn"].Text;
                hdnRepDept.Value = item["department"].Text;
                hdnRepsMgr.Value = item["manager"].Text;
            }
        }

 

Here is the code from the data table:

DataTable dt = new DataTable();
 
            dt.Columns.AddRange(new DataColumn[5]
            {
                new DataColumn("givenName", typeof (string)),
                new DataColumn("sn", typeof (string)),
                new DataColumn("mail", typeof (string)),
                new DataColumn("department", typeof (string)),
                new DataColumn("manager", typeof (string))
            });
 
            using (var context = new PrincipalContext(ContextType.Domain, null))
            {
                using (var group = (GroupPrincipal.FindByIdentity(context, "Group1")))
                {
                    var users = group.GetMembers(true);
                    foreach (UserPrincipal user in users)
                    {
                        DirectoryEntry de = user.GetUnderlyingObject() as DirectoryEntry;
                        dt.Rows.Add
                        (
                            Convert.ToString(de.Properties["givenName"].Value),
                            Convert.ToString(de.Properties["sn"].Value),
                            Convert.ToString(de.Properties["mail"].Value),
                            Convert.ToString(de.Properties["department"].Value),
                            Regex.Replace((Convert.ToString(de.Properties["manager"].Value)), @"CN=([^,]*),.*$", "$1")
                        );
                    }
                    rgAdUsrs.DataSource = dt;
                    rgAdUsrs.DataBind();
                }
            }

 

Eyup
Telerik team
 answered on 05 Sep 2018
7 answers
894 views
  No matter what i try i cant get the edit/insert form to close when i use forms or popup.

 

//this throws and error : Insert item is available only when grid is in insert mode.
protected void RadGrid1_InsertCommand(object source, Telerik.Web.UI.GridCommandEventArgs e) {   
 
e.Item.OwnerTableView.IsItemInserted = false;   
 
RadGrid1.Rebind();  
 
}  
 
//this had no effect   
 
protected void RadGrid1_InsertCommand(object source, Telerik.Web.UI.GridCommandEventArgs e) {   
 
e.Cancelled = true;  
 
RadGrid1.Rebind();  
 
}  
 
// nothing on edit either   
 
protected void RadGrid1_UpdateCommand(object source, Telerik.Web.UI.GridCommandEventArgse) {   
 
RadGrid1.MasterTableView.ClearEditItems();   
 
RadGrid1.Rebind();  
 
}  
 

// some additional background info:

I have tried it in forms & popup and with a user control and not

 

 

 

<telerik:RadGrid ID="RadGrid1" runat="server"   
 
GridLines="None"   
 
AllowPaging="True"   
 
PageSize="10"   
 
AllowAutomaticDeletes="True"   
 
AllowAutomaticInserts="True"   
 
AllowAutomaticUpdates="True"   
 
AutoGenerateColumns="False"   
 
OnItemDataBound="RadGrid1_ItemDataBound"   
 
OnInsertCommand="RadGrid1_InsertCommand"   
 
OnUpdateCommand="RadGrid1_UpdateCommand"   
 
OnDeleteCommand="RadGrid1_DeleteCommand"   
 
OnNeedDataSource="RadGrid1_NeedDataSource">   
 
<PagerStyle Mode="NextPrevAndNumeric" />   
 
<MasterTableView Width="950" CommandItemDisplay="TopAndBottom" DataKeyNames="PromoCode" EditMode="EditForms" >   
 
<Columns>   
 
<telerik:GridTemplateColumn>   
 
<ItemTemplate>   
 
<asp:ImageButton ID="Button1" runat="server" ImageUrl="~/App_Themes/Default/Images/EditButton.gif"   
 
Text="Edit" CommandName="Edit" />   
 
</ItemTemplate>   
 
</telerik:GridTemplateColumn>   
 
<telerik:GridTemplateColumn HeaderText="PromoCode" SortExpression="PromoCode" UniqueName="PromoCode">  
 
<ItemTemplate>   
 
<asp:Label runat="server" ID="lblPromoCode" Text='<%# Eval("PromoCode") %>'></asp:Label>   
 
</ItemTemplate>   
 
<EditItemTemplate>   
 
<asp:TextBox runat="server" ID="tbxPromoCode" EnableViewState="true" ></asp:TextBox>   
 
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" ControlToValidate="tbxPromoCode"   
 
ErrorMessage="*" runat="server">   
 
</asp:RequiredFieldValidator>   
 
</EditItemTemplate>   
 
</telerik:GridTemplateColumn> 
 
<telerik:GridButtonColumn ConfirmText="Delete this Item?" ConfirmDialogType="RadWindow"   
 
ConfirmTitle="Delete" ButtonType="ImageButton" CommandName="Delete" Text="Delete"   
 
UniqueName="DeleteColumn">   
 
</telerik:GridButtonColumn>   
 
</Columns>   
 
</MasterTableView>   
 
</telerik:RadGrid>   
 
 

 

 Page.Response.Redirect does work but it is not an option. lol

 

Raoul
Top achievements
Rank 1
 answered on 04 Sep 2018
1 answer
267 views

I am having a hard time getting the Legend label values to equal the pie series NameField values.

 

<telerik:RadHtmlChart ID="rhcDiscountReasons" runat="server" DataSourceID="sqlDRRAlt" ChartTitle-Text="Discount Reasons">
<ChartTitle Text="Discount Reasons">
<Appearance Visible="True">
</Appearance>
</ChartTitle>
<Legend>
<Appearance Visible="True" BackgroundColor="WindowFrame" Align="Center" Position="Bottom" Orientation="Horizontal">
    <TextStyle Color="White" FontSize="18" />
</Appearance>
<Item Visual="legendItemVisual" />
</Legend>
  <PlotArea>
                <Series>
                    <telerik:PieSeries DataFieldY="dtypecount" Name="Discount Reasons" VisibleInLegend="true" NameField="dtype">
                        <LabelsAppearance DataField="dtype">
                        </LabelsAppearance>
                    </telerik:PieSeries>
                </Series>
 </PlotArea>
</telerik:RadHtmlChart>

 

If I use the below code, It fills all the legend labels with "Discount Reasons", I want them to have the NameField values.  I have tried everything I could think of to access those values but cannot.  If I replace e.series.name with e.series.categoryField the legend lables all say "dtype", this is close but I want the dtype value.

var label = new drawing.Text(e.series.name, [0, 0], {
        fill: {
            color: legendLabelsColor
        }
    })

Can someone point me in the right direction?

 

 

Vessy
Telerik team
 answered on 04 Sep 2018
3 answers
223 views

Hi,

 

My DevCraft Complete expired on Jan/2018 and I use WPF controls and Reporting Services. I do not want to renew the subscription but my Visual Studio keeps popping up a Subscription Expired Notice! How do I stop that?

 

Thank you.

Rumen
Telerik team
 answered on 04 Sep 2018
3 answers
58 views

Documentation for Telerik UI for ASP.NET AJAX  are not available anymore

https://docs.telerik.com/devtools/aspnet-ajax/introduction

Could you please fix it quiclky.

José

 

 

José
Top achievements
Rank 1
 answered on 04 Sep 2018
3 answers
106 views

Hello

I'd like to be able to change the color of a ScatterSeriesItem point upon clicking. I have tried the following in Javascript; However, it didn't work. I'd appreciate for the help.

 

function seriesClick(e) {

  // change the color of the point to red

   e.point.color = "#ff0000"; 

  // redraw the chart

  var chart = $find("chart").get_kendoWidget();
  chart.redraw();

}

 

In C#, I am able to change a point's color by ScatterSeriesItem.BackgroundColor property, however I need to be able to do it in Javascript.

Thanks.

 

Eyup
Telerik team
 answered on 04 Sep 2018
2 answers
100 views

Hi,

I have a radgrid which contains a template column.  Within the Edit template is a dropdown control.

I have the edit mode to set to batch.  I then have the client method:

<ClientEvents OnBatchEditCellValueChanged="BatchEditCellValueChanged" />

 

This triggers the following method:

function BatchEditCellValueChanged(sender, parameters) {     sender.get_batchEditingManager().saveAllChanges();}

 

The problem I have is that when a user makes a change to the dropdown list the page freezes and then it crashes.

If I remove the template column, the editing works fine.

What do I need to do in order for this to work?

Thanks.

Eyup
Telerik team
 answered on 04 Sep 2018
4 answers
1.1K+ views
hi there,
I have some textboxes (for name, surname etc) and and a radgrid on my web page.(for products for example). all radgrid's rows are in "inplace" edit mode.. When I press to external button, form postbacks. meanwhile All information user entered in ragrid get lost. I think I have to update radgrid first but I don't know how ? because there's no update command column in grid. all rows in edit mode and while postingback I need to update all of them at once. How can achieve this ?
best



    Protected Sub radGridProducts_NeedDataSource(sender As Object, e As GridNeedDataSourceEventArgs) Handles radGridProducts.NeedDataSource
        Dim dt As New DataTable
        dt = DirectCast(Session("RequestMonetDataTable"), DataTable)
        radGridProducts.DataSource = dt
    End Sub
 
    Protected Sub radGridProducts_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles radGridProducts.PreRender
        If Not IsPostBack Then
            For Each item As GridItem In radGridProducts.MasterTableView.Items
                If TypeOf item Is GridEditableItem Then
                    Dim editableItem As GridEditableItem = CType(item, GridDataItem)
                    editableItem.Edit = True
                End If
            Next
            radGridProducts.Rebind()
        End If
    End Sub
 
    Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
        If IsPostBack = False Then
            CreateDataSource()
   end If
 
    Protected Sub CreateDataSource()
        Dim dt As New DataTable
        Dim dr As DataRow
 
        dt.Columns.Add(New Data.DataColumn("ID", GetType(String)))
        dt.Columns.Add(New Data.DataColumn("product", GetType(String)))
        dt.Columns.Add(New Data.DataColumn("quantity", GetType(Integer)))
        dt.Columns.Add(New Data.DataColumn("price", GetType(Decimal)))
 
 
        dr = dt.NewRow
        dr("ID") = 1
        dr("product") = "aaa"
        dr("quantity") = 0
        dr("price") = 0
        dt.Rows.Add(dr)
       
        ' here I add some more rows.....
 
        Session("RequestMonetDataTable") = dt
  
    End Sub
Marin Bratanov
Telerik team
 answered on 03 Sep 2018
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?