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

Hi,

I want to save data in database using inline editor but i am facing a problem.How can i get the Id of current content in the editor so can i save data.

Please help me on this issue.

Eyup
Telerik team
 answered on 23 Apr 2015
1 answer
119 views

 

When we upgraded to 2015 Q1 release our itemCommand for a linkbutton inside a NesterViewTemplate stopped working. after reading the latest release notes it stated something which we thought would fix this but it did not, the note said,

The ItemCommand event is not fired when row was clicked and the grid is placed in NestedViewTemplate of another RadGrid.

But we don't have a grid relation between separate grids, or row click, but our issue is the ItemCommand event inside the first grid is not fired. our linkbutton (ID "lbDeletePart" below) should fire but does not..

<telerik:RadGrid ID="grArtList" runat="server" AllowSorting="true" onneeddatasource="grArtList_NeedDataSource" AutoGenerateColumns="False" CellSpacing="0" GridLines="None"
        BorderStyle="None" Width="100%" AllowPaging="True" PageSize="20" onitemdatabound="grArtList_ItemDataBound" onitemcreated="grArtList_ItemCreated" EnableLinqExpressions="false"
        onitemcommand="grArtList_ItemCommand" onprerender="grArtList_PreRender" EnableEmbeddedSkins="false" Skin="SLP" RegisterWithScriptManager="true"
        AllowMultiRowSelection="true" OnColumnCreated="grArtList_ColumnCreated">
        <ClientSettings DataBinding-ShowEmptyRowsOnLoad="false">
            <ClientEvents OnRowMouseOver="rowExpand" OnRowSelected="rowExpand" OnRowCreated="checkBlocked" />
            <Selecting AllowRowSelect="true" />
        </ClientSettings>
    <MasterTableView ShowHeadersWhenNoRecords="true" ShowGroupFooter="true" DataKeyNames="art_artnr, art_id, koppl_id, CartQuantity" ClientDataKeyNames="art_artnr, art_id, koppl_id, CartQuantity" HierarchyLoadMode="Client" CommandItemDisplay="Top">
        <ExpandCollapseColumn Visible="false"></ExpandCollapseColumn>
        <CommandItemTemplate>
            <div style="padding: 5px 5px;">
                  
                <asp:LinkButton ID="lbAddPart" runat="server"><img src="Images/icons/24x24/Add.png" title="Add Part to Vehicle"/></asp:LinkButton>  
                <asp:LinkButton ID="lbCopyParts" runat="server" CommandName="CopySelected" Visible="True"><img src="Images/icons/24x24/copy.png" title="Copy selected parts to another Vehicle" /></asp:LinkButton>  
            </div>
        </CommandItemTemplate>
 
        <GroupByExpressions>
          <telerik:GridGroupByExpression>
            <SelectFields>
              <telerik:GridGroupByField FieldName="category" HeaderText="category" />
            </SelectFields>
            <GroupByFields>
              <telerik:GridGroupByField FieldName="category" SortOrder="Descending" />
            </GroupByFields>
          </telerik:GridGroupByExpression>
        </GroupByExpressions>
 
        <GroupHeaderTemplate>
            <table style="border:none;">
                <tr>
                    <td>
                        <asp:Label runat="server" ID="Label1" CssClass="txtGridGroupHeader" Text='<%# Eval("category") %>'>
                        </asp:Label>
                    </td>
                    <td>
                        <asp:Label runat="server" ID="labGroupCatCode" Visible="false" Text='<%# Eval("artkod") %>'></asp:Label>
                        <asp:LinkButton ID="lbAddPartByKat" runat="server" Visible="false"><img style="border:0; vertical-align:middle;" alt="" src="Images/icons/16x16/Add.png"/>Add new part to category</asp:LinkButton>
                        <asp:LinkButton ID="lbAddDrawing" runat="server" Visible="false"><img style="border:0; vertical-align:middle;" alt="" src="Images/icons/16x16/Add.png"/>Add new drawing to category</asp:LinkButton>
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <telerik:RadListView runat="server" ID="liDrawingMiniatures" ItemPlaceholderID="miniaturesContainer">
                            <LayoutTemplate>
                                <div style="width:100%;" id="list">
                                    <asp:Panel ID="miniaturesContainer" runat="server">
 
                                    </asp:Panel>
                                </div>
                            </LayoutTemplate>
 
                            <ItemTemplate>
                                <div id="miniatureItem" class="drawingMiniatureContainer" style="float:left; text-align:center;">
                                    <a href='<%# "drawing.aspx?drawingID=" + Eval("abd_id") %>'><img id="imgMiniature" src='<%# Eval("abd_path")%>' height="125" alt="" /><br />
                                    <asp:Label runat="server" ID="labDrawingName" Text='<%# Eval("Name")%>'></asp:Label></a><br /><br />
                                </div>
                            </ItemTemplate>
                        </telerik:RadListView>
                    </td>
                </tr>
            </table>
        </GroupHeaderTemplate>
 
        <Columns>
            <telerik:GridBoundColumn DataField="art_artnr" UniqueName="art_artnr" Display="false" HeaderText="art_artnr" CurrentFilterFunction="NoFilter" FilterListOptions="VaryByDataType" ForceExtractValue="None" ReadOnly="true">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="art_id" FilterControlAltText="Filter art_id column" UniqueName="art_id" HeaderText="art_id">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="blocked" UniqueName="blocked" HeaderText="" HeaderStyle-Width="2px" ItemStyle-Width="2px" CurrentFilterFunction="NoFilter" FilterListOptions="VaryByDataType" ForceExtractValue="None" ReadOnly="true">
            </telerik:GridBoundColumn>
            <telerik:GridTemplateColumn UniqueName="chkOrdersvar" ItemStyle-Width="8px" HeaderStyle-Width="8px">
            <ItemTemplate>
                <asp:CheckBox id="chkCopy" runat="server" Text=" "></asp:CheckBox>
            </ItemTemplate>
            <HeaderTemplate>
                <input id="chkCheckAll" onchange="for (var i = 0; i < document.all.length; i++){ if (document.all(i).id.indexOf('chkCopy') > 0) { document.all(i).checked = chkCheckAll.checked; }}" type="checkbox" value="ChangeMe" />
            </HeaderTemplate>
            </telerik:GridTemplateColumn>
            <telerik:GridTemplateColumn HeaderText="Art No." SortExpression="art_artnr" DataField="art_artnr" UniqueName="art" ItemStyle-Width="115px" >
                <ItemTemplate>
                    <asp:HyperLink ID="hlArtnr" runat="server" NavigateUrl="#" Text='<%# Eval("art_artnr") %>'></asp:HyperLink>
                    <div id="container">
                       <div id="box"> </div>
                    </div>
                </ItemTemplate>
            </telerik:GridTemplateColumn>
            <telerik:GridTemplateColumn HeaderText="Name" SortExpression="ben" DataField="ben" >
                <ItemTemplate>
                    <asp:HyperLink ID="hlArtben" runat="server" NavigateUrl="#" Text='<%# Eval("ben") %>'></asp:HyperLink>
                    <asp:Label ID="labNews" CssClass="labNews" runat="server" Visible="false"> (New)</asp:Label>
                </ItemTemplate>
            </telerik:GridTemplateColumn>
            <telerik:GridBoundColumn DataField="refnr" FilterControlAltText="Filter ritning column" UniqueName="ritning" HeaderText="Volvo ref.">
            </telerik:GridBoundColumn>
            <telerik:GridNumericColumn DataField="display_price" DecimalDigits="2" FilterControlAltText="Filter Price column" UniqueName="price" HeaderText="Price" DataFormatString="{0:N}" DataType="System.Decimal">
                <HeaderStyle HorizontalAlign="Right" />
                <ItemStyle HorizontalAlign="Right" />
            </telerik:GridNumericColumn>
             <telerik:GridBoundColumn DataField="test" FilterControlAltText="Filter InStock column" UniqueName="test" HeaderText="test">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="category" FilterControlAltText="Filter category column" UniqueName="category" HeaderText="category">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="koppl_id" UniqueName="koppl_id" HeaderText="koppl_id">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="nyhet" UniqueName="nyhet" HeaderText="News">
            </telerik:GridBoundColumn>
        </Columns>
 
        <NestedViewSettings>
          <ParentTableRelation>
            <telerik:GridRelationFields DetailKeyField="art_id" MasterKeyField="art_id" />
          </ParentTableRelation>
        </NestedViewSettings>
        <NestedViewTemplate>
          <asp:Panel ID="NestedViewPanel" runat="server" CssClass="divArtDetailsView">
            <div class="contactWrap">
                <table width="100%" cellpadding="0" cellspacing="0">
                    <tr>
                        <td width="130px">
                            <asp:image runat="server" ID="imgArt" src="" />
                        </td>
                        <td style="vertical-align:top;">
                            <asp:LinkButton ID="lbEditPart" runat="server" style="display:none;"><img style="border:0px;vertical-align:middle;" alt="" src="Images/icons/16x16/edit.png"/>Edit attributes</asp:LinkButton>
                            <asp:LinkButton ID="lbDeletePart" runat="server" style="display:none;" CommandName="deletePart"><img style="border:0px;vertical-align:middle;" alt="" src="Images/icons/16x16/delete.png"/>Delete part</asp:LinkButton>
                            <asp:Label runat="server" ID="labAttribut" Text=""></asp:Label>
                        </td>
                        <td style="vertical-align:top; text-align:right; padding-right:5px;">
                            <telerik:RadButton runat="server" ID="btnPinRow" AutoPostBack="false" ButtonType="ToggleButton" ToggleType="CheckBox" Checked="false" OnClientCheckedChanged="pinChanged">
                                <ToggleStates>
                                    <telerik:RadButtonToggleState Width="16px" IsBackgroundImage="true" ImageUrl="images/pinned.png" />
                                    <telerik:RadButtonToggleState Width="16px" IsBackgroundImage="true" ImageUrl="images/unpinned.png" HoveredImageUrl="images/pinned.png" Selected="false" />
                                </ToggleStates>
                            </telerik:RadButton>
                            <br /><br />
                            <telerik:RadNumericTextBox runat="server" ID="txtAnt" Width="45px" NumberFormat-DecimalDigits="0" Value="1" MinValue="0"></telerik:RadNumericTextBox>
                            <telerik:RadButton runat="server" ID="btnAddToCart" Text="Add" Skin="Telerik" AutoPostBack="False" OnClientClicked="btnAddToCart_clicked"></telerik:RadButton>
                            <br />
                            <asp:Label runat="server" ID="labAvailability" Text="Availability:"></asp:Label>
                            <asp:Label runat="server" ID="labStock" Text=""></asp:Label>
                        </td>
                    </tr>
                </table>
            </div>
          </asp:Panel>
        </NestedViewTemplate>
    </MasterTableView>
 
    <FilterMenu EnableImageSprites="False"></FilterMenu>
 

 

    </telerik:RadGrid

 

 

protected void grArtList_ItemCommand(object sender, GridCommandEventArgs e)
    {
        #region Copy
        if (e.CommandName == "CopySelected")
        {
            mService = new monService.SrvCoreClient();
 
            List<int> idList = new List<int>();
 
            foreach (GridDataItem item in grArtList.Items)
            { //GÃ¥r igenom varje rad i dgOrdersvar
                CheckBox chk = (CheckBox)item.FindControl("chkCopy");
                if (chk.Checked) //Känner av om Checkboxen är ikryssad (den ska med)
                {
                    int rowID = int.Parse(item.GetDataKeyValue("koppl_id").ToString());
                    idList.Add(rowID);
                }
            }
            Session.Remove("copyIDList");
            Session.Add("copyIDList", idList);
 
            string CopyUrl = "'admCopyPopup.aspx?type=" + Request.QueryString["type"].ToString() + "'";
 
            RadAjaxManager.GetCurrent(Page).ResponseScripts.Add(String.Format("OpenWindow(" + CopyUrl + ", " + "'winCopy'); return false;"));
 
        }
        #endregion
 
        #region delete
        if (e.CommandName == "deletePart")
        {
            GridNestedViewItem nestedRow = (GridNestedViewItem)e.Item;
            GridDataItem row = (GridDataItem)nestedRow.ParentItem;
 
            mService = new monService.SrvCoreClient();
            DataTable dtSend = mService.GetEmptyMonodbcTable(common.getSession(Session).id, "anp_bw_artkoppling");
 
            dtSend.Clear();
            DataRow rowToDelete = dtSend.NewRow();
            rowToDelete["id"] = Convert.ToInt32(row.GetDataKeyValue("koppl_id").ToString());
 
            try
            {
                dtSend.Rows.Add(rowToDelete);
                mService.ExecuteDbRequest(common.getSession(Session).id, "anp_bw_artkoppling", dtSend, monService.DbHandlerdb_request_type.Delete, "EN", 0);
                grArtList.Rebind();
            }
            catch (Exception ex)
            {
                Label lblError = new Label();
                lblError.Text = "Unable to delete record. Reason: " + ex.Message;
                lblError.ForeColor = System.Drawing.Color.Red;
                grArtList.Controls.Add(lblError);
                e.Canceled = true;
            }
        }
        #endregion
    }

Viktor Tachev
Telerik team
 answered on 23 Apr 2015
1 answer
150 views

How to get user control defined by EditFormSettings  when edit command button clicked?

I'm using a user control to update  data, and setting EditFormSettings like this :

when "Edit" button clicked, the area defined in my webusercontrol is toggled, but the data was not loaded into the edit area, and just like this:

I used  OnDataBound method to look for the usercontrol, but it does not work. and the code is like this:

In the function, the value of userControl is null

how to solve this problem? 

Eyup
Telerik team
 answered on 23 Apr 2015
1 answer
140 views

hi,

i'm using control RadHtmlChart wich i bind it programaticly 

this is part of my code and in the pic the data don't display i dont know why plz help me i'm using gridview to make sure if i have data in datatable and it works  

 

string req = " select time_tag,[ain_sebou|niveau] from QTSW_DATA1 where time_tag between '15/01/2015 10:49:59' AND '15/02/2015 10:49:59'";
            Connecter();
            if (DS.Tables.Contains("TRChart"))
            {
                DS.Tables.Remove("TRChart");
            }
            SqlDataAdapter da = new SqlDataAdapter(req, con);
            da.Fill(DS, "TRChart");
            Deconnecter();
            RChart.DataSource = DS.Tables["TRChart"];
            RChart.DataBind();

            ScatterLineSeries SL = new ScatterLineSeries();
            SL.DataFieldX = "time_tag";
            SL.DataFieldY = "ain_sebou|niveau";
            RChart.PlotArea.Series.Add(SL);
            RChart.PlotArea.XAxis.TitleAppearance.Text = "Date Time";
            RChart.PlotArea.YAxis.TitleAppearance.Text = "Value Of AIn Sebou"; 

// here i bind Gridview

           Gridview1.DataSource = DS.Tables["TRChart"];
           Gridview1.DataBind();

 

plzz i need help 

Danail Vasilev
Telerik team
 answered on 23 Apr 2015
1 answer
82 views

Hi there,

We're using Org Chart with enable drill down and load on demand and data bind in code behind file.

Org Chart also have zooming feature ON.

When exporting char to pdf it only show NODES but there in not links/lines between nodes.

But if we disabled zooming it work well.

Any idea please?

Ivan Danchev
Telerik team
 answered on 23 Apr 2015
1 answer
136 views

Hi,

 

Im having an issue trying to bind to a linq anonymous type. I can bind find as long as i don't specify a 'DataFieldParentID', if i specify that DataFieldParentID then the dropdowntree control just displays no items.

So if i comment out the line below: rdt.DataFieldParentID = "ParentID"; then the control loads fine with the options i expect and i am able to select and use them fine, it simply seems to be an issue when trying to create a hierarchy. 

My drop down tree control is inside a RadListView and i am binding on the ItemDataBound event, my code for binding if the following:             

var x = from y in services select new { ID = y.ID, ParentID = y.PrimaryWorkType.ID, myText = y.Description};
 
RadDropDownTree rdt = (RadDropDownTree)e.Item.FindControl("ddlAffectedServices");
 
rdt.DataTextField = "myText";
rdt.DataValueField = "ID";
rdt.DataFieldID = "ID";
rdt.DataFieldParentID = "ParentID";
rdt.DataSource = x;
rdt.DataBind();

 

Plamen
Telerik team
 answered on 23 Apr 2015
2 answers
75 views

Good Day

Please help,

How can i format the date when exporting treelist data to excel, using Telerik version 2013.3.1324.40.

Tshwanelo
Top achievements
Rank 1
 answered on 23 Apr 2015
6 answers
221 views
I have a RadScheduler that's showing meetings using the timeline view. Meetings that overlap the edge of the view gets an arrow that you can click to move the view and see the rest of that meeting. A great feature, but right now I need to disable it. How do I accomplish that? I wouldn't mind keeping the arrows and just disabling the action that gets performed.

Thanks
Plamen
Telerik team
 answered on 23 Apr 2015
10 answers
5.2K+ views
Hi Telerik-Team,

I make my first experience with RadButton.
Simple Question - hao can I  set enable property from client side? 
javascript  not working and RadButton still remain disabled:

function

 

EnableDisable() {
    button2 = document.getElementById(
"RadButton2_input");
    button2.disabled =
false;
}

 

Thanks in advance!
Peter
Top achievements
Rank 1
 answered on 23 Apr 2015
3 answers
219 views
Hi all,

I want to set a column to ReadOnly=True at EditMode, but at InsertMode ReadOnly=False. Please advise how to do it.
I did as below but it didn't work. Please help.

Private Sub RadGrid1_ItemCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles RadGrid1.ItemCommand
If e.CommandName = RadGrid.EditCommandName Then
            Dim editItem As GridEditableItem = CType(RadGrid1.MasterTableView.GetItems(GridItemType.EditItem)(0), GridEditableItem)
            For Each column As GridColumn In RadGrid1.MasterTableView.Columns
                If column.UniqueName = "POL" Then
                    Dim txtbox As TextBox = CType(editItem (column.UniqueName).Controls(0), TextBox)
                    txtbox.ReadOnly = True
                End If
            Next
End If
End Sub

But I got error  "Index was outside the bounds of the array." at the below code ..
If e.CommandName = RadGrid.EditCommandName Then
            Dim editItem As GridEditableItem = CType(RadGrid1.MasterTableView.GetItems(GridItemType.EditItem)(0), GridEditableItem)

Many Thanks
umesh
Top achievements
Rank 1
 answered on 22 Apr 2015
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?