Telerik Forums
UI for ASP.NET AJAX Forum
8 answers
170 views
hi there, is that possible to display full 24hrs (remove option to display anything else) and display with the default start position to 8:00am? (the auto scroll to 8am)
Peter Milchev
Telerik team
 answered on 19 May 2020
1 answer
294 views
I want to set ShowFullTime="true" and ShowFooter="false" for RadScheduler, then display it with the default start position to 8:00am (auto scroll to 8am).
Peter Milchev
Telerik team
 answered on 19 May 2020
1 answer
864 views

Hi!

I am using Telerik's Radgrid in EditMode="Batch" and with EditType="Cell" settings. The Grid contains both GridBoundColumn(s) and GridTemplateColumn(s) with DropDownLists.

What i want to achieve (on client side) is when a user changes the value in a dropdown list (contained in an GridTemplateColumn), i will be able and update some session variables depending on the values of multiple other column values of the grid.

Up to know i was able to do everything i wanted using the code behind event handlers but this scenario requires handling some of the event on the client side, so i am struggling with javascript :) which is not really my expertise.

I am using the OnBatchEditOpen & OnBatchEditClosed client events off the grid.

What i am trying to achieve is when a cell (Columns that expose dropdown lists are: Segment, Basis, Side) is clicked for editting (OnBatchEditOpen) to be able and also fetch the values of some other columns on the same row.

Here is my grid code:

<telerik:RadGrid
    RenderMode="Lightweight"
    runat="server"
    ID="RadGridLesions"
    AllowPaging="True"
    AllowSorting="True"
    AutoGenerateColumns="False"
    Skin="BlackMetroTouch"
    CssClass="dark-grey"
    OnNeedDataSource="RadGridLesions_NeedDataSource"
 
    ShowStatusBar="True"
 
    AllowAutomaticInserts="False"
    AllowAutomaticDeletes="True"
    AllowAutomaticUpdates="True"
    OnItemUpdated="RadGridLesions_ItemUpdated"
    OnItemDeleted="RadGridLesions_ItemDeleted"
    OnBatchEditCommand="RadGridLesions_BatchEditCommand"
    >
        <MasterTableView
            CommandItemDisplay="Top"
            EditMode="Batch">
                <PagerStyle />
 
                <BatchEditingSettings
                    SaveAllHierarchyLevels="false"
                    HighlightDeletedRows="false"
                    EditType="Cell"
                    OpenEditingEvent="Click" />
 
                        <Columns>
 
                                <telerik:GridBoundColumn
                                    DataField="Segment"
                                    UniqueName="Segment"
                                    HeaderText="Segment"
                                    DataType="System.String"
                                    HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center"
                                    Visible="true"
                                    ReadOnly="true">
                                </telerik:GridBoundColumn>
 
                                <telerik:GridBoundColumn
                                    DataField="Level"
                                    UniqueName="Level"
                                    HeaderText="Level"
                                    DataType="System.String"
                                    HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center"
                                    Visible="true"
                                    ReadOnly="true">
                                </telerik:GridBoundColumn>
 
                                <telerik:GridBoundColumn
                                    DataField="Side"
                                    UniqueName="Side"
                                    HeaderText="Side"
                                    DataType="System.String"
                                    HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center"
                                    Visible="true"
                                    ReadOnly="true">
                                </telerik:GridBoundColumn>
 
                                <telerik:GridBoundColumn
                                    DataField="T2Grade"
                                    UniqueName="T2Grade"
                                    HeaderText="T2"
                                    DataType="System.Int32"
                                    HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center"
                                    Visible="false"
                                    ReadOnly="false">
                                </telerik:GridBoundColumn>
 
                                <telerik:GridTemplateColumn
                                    HeaderText="T2"
                                    HeaderStyle-Width="70px"
                                    UniqueName="T2Grade"
                                    DataField="T2Grade">
                                    <ItemTemplate>
                                        <%# Eval("T2Grade") %>
                                    </ItemTemplate>
                                    <EditItemTemplate>
                                        <telerik:RadDropDownList
                                            RenderMode="Lightweight"
                                            runat="server"
                                            ID="T2GradeDropDownList"
 
                                            AutoPostBack="false"
                                            OnSelectedIndexChanged="T2GradeDropDownList_SelectedIndexChanged"
 
                                            OnClientItemSelected="T2GradeDropDownList_OnClientItemSelected"
 
                                            Skin="BlackMetroTouch"
                                            SelectedValue='<%# Eval("T2Grade") %>'>
                                            <Items>
                                                <telerik:DropDownListItem Text="X" Value="0" />
                                                <telerik:DropDownListItem Text="1" Value="1" />
                                                <telerik:DropDownListItem Text="2" Value="2" />
                                                <telerik:DropDownListItem Text="3" Value="3" />
                                                <telerik:DropDownListItem Text="4" Value="4" />
                                                <telerik:DropDownListItem Text="5" Value="5" />
                                            </Items>
                                        </telerik:RadDropDownList>
                                    </EditItemTemplate>
                                </telerik:GridTemplateColumn>
 
                                <telerik:GridBoundColumn
                                    DataField="DWIGrade"
                                    UniqueName="DWIGrade"
                                    HeaderText="DWI"
                                    DataType="System.String"
                                    HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center"
                                    Visible="false"
                                    ReadOnly="false" >
                                </telerik:GridBoundColumn>
 
                                <telerik:GridTemplateColumn
                                    HeaderText="DWI"
                                    HeaderStyle-Width="70px"
                                    UniqueName="DWIGrade"
                                    DataField="DWIGrade">
                                    <ItemTemplate>
                                        <%# Eval("DWIGrade") %>
                                    </ItemTemplate>
                                    <EditItemTemplate>
                                        <telerik:RadDropDownList
                                            RenderMode="Lightweight"
                                            runat="server"
                                            ID="DWIGradeDropDownList"
                                            Skin="BlackMetroTouch"
                                            SelectedValue='<%# Bind("DWIGrade") %>'>
                                            <Items>
                                                <telerik:DropDownListItem Text="X" Value="0" />
                                                <telerik:DropDownListItem Text="1" Value="1" />
                                                <telerik:DropDownListItem Text="2" Value="2" />
                                                <telerik:DropDownListItem Text="3" Value="3" />
                                                <telerik:DropDownListItem Text="4" Value="4" />
                                                <telerik:DropDownListItem Text="5" Value="5" />
                                            </Items>
                                        </telerik:RadDropDownList>
                                    </EditItemTemplate>
                                </telerik:GridTemplateColumn>
 
                                <telerik:GridBoundColumn
                                    DataField="DCEGrade"
                                    UniqueName="DCEGrade"
                                    HeaderText="DCE"
                                    DataType="System.Int32"
                                    HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center"
                                    Visible="false"
                                    ReadOnly="false" >
                                </telerik:GridBoundColumn>
 
                                <telerik:GridTemplateColumn
                                    HeaderText="DCE"
                                    HeaderStyle-Width="70px"
                                    UniqueName="DCEGrade"
                                    DataField="DCEGrade">
                                    <ItemTemplate>
                                        <%# Eval("DCEGrade") %>
                                    </ItemTemplate>
                                    <EditItemTemplate>
                                        <telerik:RadDropDownList
                                            RenderMode="Lightweight"
                                            runat="server"
                                            ID="DCEGradeDropDownList"
                                            Skin="BlackMetroTouch"
                                            SelectedValue='<%# Bind("DCEGrade") %>'>
                                            <Items>
                                                <telerik:DropDownListItem Text="X" Value="0" />
                                                <telerik:DropDownListItem Text="+" Value="1" />
                                                <telerik:DropDownListItem Text="-" Value="2" />
                                            </Items>
                                        </telerik:RadDropDownList>
                                    </EditItemTemplate>
                                </telerik:GridTemplateColumn>
 
                                <telerik:GridBoundColumn
                                    DataField="PiradGrade"
                                    UniqueName="PiradGrade"
                                    HeaderText="Pirad"
                                    DataType="System.Int32"
                                    HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center"
                                    Visible="true"
                                    ReadOnly="true">
                                </telerik:GridBoundColumn>
 
                                <telerik:GridBoundColumn
                                    DataField="Width"
                                    UniqueName="Width"
                                    HeaderText="Width"
                                    DataType="System.Double"
                                    Visible="true"
                                    ReadOnly="false">
                                </telerik:GridBoundColumn>
 
                                <telerik:GridBoundColumn
                                    DataField="Height"
                                    UniqueName="Height"
                                    HeaderText="Height"
                                    DataType="System.Double"
                                    Visible="true"
                                    ReadOnly="false" >
                                </telerik:GridBoundColumn>
 
                                <telerik:GridBoundColumn
                                    DataField="Comments"
                                    UniqueName="Comments"
                                    HeaderText="Comments"
                                    DataType="System.String"
                                    Visible="true"
                                    ReadOnly="false" >
                                </telerik:GridBoundColumn>
 
                                <telerik:GridButtonColumn
                                    ConfirmText="Delete this Row?"
                                    ConfirmDialogType="Classic"
                                    ConfirmTitle="Delete"
                                    HeaderText="Delete" HeaderStyle-Width="70px"
                                    HeaderStyle-CssClass="studies-header delete" ItemStyle-CssClass="studies-items delete"
                                    CommandName="Delete"
                                    Text="Delete"
                                    UniqueName="DeleteStudy">
                                </telerik:GridButtonColumn>
 
                </Columns>
 
        </MasterTableView>
 
    <ClientSettings>
        <ClientEvents OnBatchEditOpened="BatchEditOpened" OnBatchEditClosed="BatchEditClosed" />
    </ClientSettings>
 
</telerik:RadGrid>

 

So what in particular i am trying to achive is that if the user clicks on the "T2Grade" dropdown list depending on the values of "Segment", "Side", "Basis" columns i will make some additional actions. So in the event i need a way to fetch clicked cell's row, other column values.

My issue is how to fetch the values of the clicked cell's row column values for "Segment", "Side" and "Basis":

function BatchEditOpened(sender, args) {
 
    var tableView = sender.get_masterTableView();
    var batchEditingManager = sender.get_batchEditingManager();
    var items = tableView.get_dataItems();
 
    if (args.get_columnUniqueName() === "T2Grade") {
 
            _currentDropDownCell = args.get_cell("T2Grade");
            var _currentDropDownCellValue = batchEditingManager.getCellValue(_currentDropDownCell);
            //this is the value of the selected dropdown list
            alert('T2Grade: ' + _currentDropDownCellValue);
 
            // how am i going to fetch the ROW index AND/OR ROW data for the other columns of the grid
            // tried with args.get_row() but this is not working
            // most probably because i work with: EditType="Cell"
            ....
}

 

Anybody has an idea of how to do it?

Eyup
Telerik team
 answered on 19 May 2020
1 answer
500 views

Just upgraded to Q2 2020 and RadMultiColumnComboBox's dropdown background is transparent when you haven't selected an item

Looking at the differences between Q1 2020 and Q2 2020 it looks like it is tied to the CSS class .k-reset

This also happens on Telerik's demo site if you take off the Styling added from DropdownGrid.Silk.css or the class of RadMultiColumnComboBox_Silk from the RadMultiColumnComboBox.

https://demos.telerik.com/aspnet-ajax/multicolumncombobox/overview/defaultcs.aspx

/*Q1 2020*/
.k-reset {
margin: 0;
padding: 0;
border: 0;
outline: 0;
text-decoration: none;
font-size: 100%;
list-style: none;
}
/*Q2 2020*/
.k-reset {
margin: 0;
padding: 0;
border: 0;
background: 0; /*Issue overridding background*/
list-style: none;
}
/*Solution for other Developers to get around issue*/
.k-dropdowngrid-popup {
    background-color: #fff !important;
}
Peter Milchev
Telerik team
 answered on 18 May 2020
1 answer
107 views

When the color picker is on a tab that is not active when the page loads the cursor (crosshair) is not in the right location.  The color is correct, the cursor is not.  I tried a few things I saw in this forum, repainting clientside when the tab becomes active, and adding this script to the bottom of the page.  But no luck.  Any Ideas?  Thank you.  Telerik version = 2017.3.913.45

function OnClientActiveTabChanged()
{
    $find("<%=colorBackGround.ClientID %>").repaint();
}
Telerik.Web.UI.RadColorPicker.prototype._updateHslSliderBackground = function (hsl, isCustomColor)
        {
            var color = this._hslToRgb(hsl.h, hsl.s, 0.5);
            var slider = isCustomColor ? this.get_millionCustomColorsSlider() : this.get_millionColorsSlider();
            if (slider._trackElement)
            {
                slider._trackElement.style.backgroundColor = this._rgbValuesToHex(color.r, color.g, color.b);
            }
        }

 

Vessy
Telerik team
 answered on 18 May 2020
1 answer
143 views

Hi,

 

Is there a simple way in the server side  to get all items in the ListBox after they have been reorder by the user (either by the up down arrows or drag and drop)?

I have a save button which when the user click on it i need to get the items in the ListBox so i can update the indexes of the items in my model.

currently i tired that:

 

001.
//this is the clas model
 public class Publication : DataContractClass
002.    {
003.        public enum LanguageName
004.        {
005.            Hebrew,
006.            English
007.        }
008.  
009.        [DataMember]
010.        private long id;
011.        public long Id
012.        {
013.            get { return id; }
014.            set { id = value; }
015.        }
016. 
017.        [DataMember]
018.        private LanguageName language;
019.        public LanguageName Language
020.        {
021.            get { return language; }
022.            set { language = value; }
023.        }
024. 
025.        [DataMember]
026.        private string text;
027.        public string Text
028.        {
029.            get { return text; }
030.            set { text = value; }
031.        }
032. 
033.        [DataMember]
034.        private int index;
035.        public int Index
036.        {
037.            get { return index; }
038.            set { index = value; }
039.        }
040. 
041.        [DataMember]
042.        private string link;
043.        public string Link
044.        {
045.            get { return link; }
046.            set { link = value; }
047.        }
048. 
049.        [DataMember]
050.        private long fileId;
051.        public long FileId
052.        {
053.            get { return fileId; }
054.            set { fileId = value; }
055.        }
056. 
057.        [DataMember]
058.        private byte[] publicationBlob;
059.        public byte[] PublicationBlob
060.        {
061.            get { return publicationBlob;  }
062.            set { publicationBlob = value; }
063.        }
064. 
065.        [DataMember]
066.        private bool isDeleted;
067.        public bool IsDeleted
068.        {
069.            get { return isDeleted; }
070.            set { isDeleted = value; }
071.        }
072. 
073.        [DataMember]
074.        private bool isSelected;
075.        /// <summary>
076.        /// Gets or sets a value indicating whether this publication is selected publication.
077.        /// </summary>
078.        /// <value>
079.        ///     <c>true</c> if this publication is selected; otherwise, <c>false</c>.
080.        /// </value>
081.        public bool IsSelected
082.        {
083.            get { return isSelected; }
084.            set { isSelected = value; }
085.        }
086. 
087.        [DataMember]
088.        private bool hasPublication;
089.        public bool HasPublication
090.        {
091.            get { return hasPublication; }
092.            set { hasPublication = value; }
093.        }
094.    }
095.

//this is my property in my webform

096.static List<Publication> FacultyPublications
097.        {
098.            get
099.            {
100.                string sessionKey = $"FacultyPublications_{FacultyUserName}";
101.                if (HttpContext.Current.Session[sessionKey] != null)
102.                {
103.                    return (List<Publication>)HttpContext.Current.Session[sessionKey];
104.                }
105.                else
106.                {
107.                    return null;
108.                }
109.            }
110.            set
111.            {
112.                string sessionKey = $"FacultyPublications_{FacultyUserName}";
113.                HttpContext.Current.Session[sessionKey] = value;
114.            }
115.        }
116.//this is my save button event
117.protected void RadButtonSavePublicationsOrder_Click(object sender, EventArgs e)
118.        {
119.            foreach (Publication pub in FacultyPublications)
120.            {
121.                pub.Index = RadListBoxPublications.FindItemIndexByValue(pub.Id.ToString());
122.            }
123.            XDocument document = new XDocument(new XElement("Root",
124.                from pub in FacultyPublications
125.                select
126.                new XElement("Publication",
127.                    new XElement("PublicationID", pub.Id),
128.                    new XElement("SortIndex", pub.Index))
129.                ));
130. 
131.            if (appDal.UpdatePublicationsIndexes(FacultyUserName, CurrentUserName, document.ToString()))
132.            {
133.                BindPublications();
134.                RadWindowManagerPublications.RadAlert(GetLocalString("msgSuccessAction"), 600, 200, string.Empty, string.Empty);
135.            }
136.            else
137.            {
138.                //failed
139.                RadWindowManagerPublications.RadAlert(GetLocalString("msgNotSuccessAction"), 600, 200, string.Empty, string.Empty);
140.                return;
141.            }
142.        }
143.    }

 

and here is the radlistbox declaration

01.<telerik:RadListBox ID="RadListBoxPublications" runat="server" AllowReorder="True" EnableDragAndDrop="True" Width="98%" Height="700px" AutoPostBackOnReorder="true">
02.            <HeaderTemplate>
03.                <div class="row">
04.                    <div class="col-md-9">
05.                        <h4>
06.                            <asp:Literal runat="server" Text="<%$ Resources:FacultySites, PublicationsTitle%>"></asp:Literal>
07.                        </h4>
08.                    </div>                   
09.                    <div class="col-md-2">
10.                        <div class="row">
11.                            <div class="col-md-5">
12.                                <%--<asp:Literal runat="server" Text="<%$ Resources:FacultySites, Edit%>"></asp:Literal>--%>
13.                                <telerik:RadButton ID="RadButtonAddNewPublication" runat="server" RenderMode="Lightweight" ToolTip="<%$ Resources:FacultySites, AddNewPublication%>" OnClick="RadButtonAddNewPublication_Click">
14.                                    <ContentTemplate>
15.                                        <span class="glyphicon glyphicon-edit"></span> <asp:Literal runat="server" Text="<%$ Resources:FacultySites, AddNewPublication%>"></asp:Literal>
16.                                    </ContentTemplate>
17.                                </telerik:RadButton>
18.                            </div>                           
19.                            <div class="col-md-7">
20.                                                                 
21.                                <telerik:RadButton ID="RadButtonSavePublicationsOrder" runat="server" RenderMode="Lightweight" ToolTip="<%$ Resources:FacultySites, SavePublicationsOrder%>" OnClick="RadButtonSavePublicationsOrder_Click">
22.                                    <ContentTemplate>
23.                                        <span class="glyphicon glyphicon-save"></span> <asp:Literal runat="server" Text="<%$ Resources:FacultySites, SavePublicationsOrder%>"></asp:Literal>
24.                                    </ContentTemplate>
25.                                </telerik:RadButton>                                                               
26.                            </div>
27.                        </div>
28.                    </div>
29.                    <div class="col-md-1"> </div>
30.                </div>
31.            </HeaderTemplate>
32.            <ItemTemplate>
33.                <div class="row">
34.                    <div class="col-md-9">
35.                        <div dir="<%# (DataBinder.GetDataItem(Container) as Idc.FacultySites.Models.Publication).Language == Idc.FacultySites.Models.Publication.LanguageName.Hebrew? "rtl" : "ltr" %>"
36.                            class="<%# (DataBinder.GetDataItem(Container) as Idc.FacultySites.Models.Publication).Language == Idc.FacultySites.Models.Publication.LanguageName.Hebrew? "text-right-fix" : "text-left-fix" %>">
37.                            <a id="PublicationLink" runat="server">
38.                                <%# (DataBinder.GetDataItem(Container) as Idc.FacultySites.Models.Publication).Text %>
39.                            </a>
40.                        </div>
41.                    </div>
42.                    <div class="col-md-1"> </div>
43.                    <div class="col-md-2">
44.                        <div class="row">
45.                            <div class="col-md-2">
46.                                <telerik:RadButton ID="RadButtonEditPublication" runat="server" RenderMode="Lightweight" ToolTip="<%$ Resources:FacultySites, Edit%>" CommandArgument="<%# (DataBinder.GetDataItem(Container) as Idc.FacultySites.Models.Publication).Id %>" OnCommand="RadButtonEditPublication_Command">
47.                                    <ContentTemplate>
48.                                        <span class="glyphicon glyphicon-edit"></span>
49.                                    </ContentTemplate>
50.                                </telerik:RadButton>
51.                            </div>
52.                            <div class="col-md-2">
53.                                <telerik:RadButton ID="RadButtonDeletePublication" runat="server" RenderMode="Lightweight" ToolTip="<%$ Resources:FacultySites, Delete%>" OnClick="RadButtonDeletePublication_Click" CommandArgument="<%# (DataBinder.GetDataItem(Container) as Idc.FacultySites.Models.Publication).Id %>" OnCommand="RadButtonDeletePublication_Command">
54.                                    <ContentTemplate>
55.                                        <span class="glyphicon glyphicon-remove"></span>
56.                                    </ContentTemplate>
57.                                    <ConfirmSettings ConfirmText="<%$ Resources:FacultySites, GeneralActionConfirmMessage%>" />
58.                                </telerik:RadButton>
59.                            </div>
60.                            <div class="col-md-8"> </div>
61.                        </div>
62.                    </div>
63.                </div>
64.                <div class="row">
65.                    <div class="col-md-12"> </div>
66.                </div>
67.            </ItemTemplate>
68.        </telerik:RadListBox>

 

but it's not working and I keep getting the ListBox items as they have been in the first time I load them from the db.

 

Looking forward to an earliest reply and help

Thanks.

Peter Milchev
Telerik team
 answered on 18 May 2020
1 answer
63 views
I am using the default template to update or insert an appointment. To add a combo I use the ResourceType but now i want to add a ComboBox  with filter  (radComboBox ) and I do not know how to do it without creating a new AdvancedEditTemplate
Peter Milchev
Telerik team
 answered on 18 May 2020
3 answers
503 views
Hi,

I have a unique problem.

I have two grids, I planned to populate them the same way using ObjectDataSource.
The first one populates fine. And for the second one I am using another ObjectDataSource which takes the parameter from the first RadGrid. Till here it works fine. It goes to the DB and gets the data based on the selected datakey from the first RadGrid.

Now the problem is that data does not show up in the second RadGrid. I can see the data in break mode, it just does not render on the page.

Any help would be much appreciated.
Below is the whole Aspx page.

Thank you,
-Sam


<%@ Page Title="" Language="C#" MasterPageFile="~/KIDMaster.Master" AutoEventWireup="false"
    CodeBehind="RadGrid.aspx.cs" Inherits="KID_Admin_CSharp.RadGrid" %>


<%@ Register TagPrefix="tk" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:ObjectDataSource ID="InterviewLocationObjectDataSource" runat="server" TypeName="KID_Admin_CSharp.DAL.KIDDAL"
        SelectMethod="getInterviewMainData">
        <SelectParameters>
            <asp:FormParameter Name="viewIndicator" FormField="valueIndicator" DefaultValue="1" />
        </SelectParameters>
    </asp:ObjectDataSource>
    <tk:RadAjaxManager ID="RadAjaxManager1" runat="server" EnableAJAX="true">
        <AjaxSettings>
            <tk:AjaxSetting AjaxControlID="grid">
                <UpdatedControls>
                    <tk:AjaxUpdatedControl ControlID="grid" />
                </UpdatedControls>
            </tk:AjaxSetting>
        </AjaxSettings>
    </tk:RadAjaxManager>
    <tk:RadGrid ID="grid" runat="server" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False"
        CellSpacing="0" GridLines="None" Skin="Transparent" DataSourceID="InterviewLocationObjectDataSource"
        AlternatingItemStyle-BackColor="ControlLight" AllowAutomaticUpdates="true" AllowAutomaticDeletes="true"
        OnSelectedIndexChanged="grid_SelectedIndexChanged">
        <ClientSettings EnablePostBackOnRowClick="true" EnableRowHoverStyle="true">
            <Selecting AllowRowSelect="true" />
        </ClientSettings>
        <MasterTableView DataKeyNames="intvw_seqno" ClientDataKeyNames="intvw_seqno, loc_seqno">
            <RowIndicatorColumn>
                <HeaderStyle Width="20px"></HeaderStyle>
            </RowIndicatorColumn>
            <Columns>
                <tk:GridButtonColumn CommandName="Select" Text="Select" UniqueName="Select">
                </tk:GridButtonColumn>
                <tk:GridTemplateColumn HeaderText="Location Name">
                    <ItemTemplate>
                        <%# Eval("loc_location") %>
                    </ItemTemplate>
                    <HeaderStyle Font-Bold="true" HorizontalAlign="Center" />
                </tk:GridTemplateColumn>
                <tk:GridTemplateColumn HeaderText="Date">
                    <ItemTemplate>
                        <%# Eval("intvw_dt_end")%>
                    </ItemTemplate>
                    <HeaderStyle Font-Bold="true" HorizontalAlign="Center" />
                </tk:GridTemplateColumn>
                <tk:GridTemplateColumn HeaderText="Time">
                    <ItemTemplate>
                        <%# Eval("StartTime") %>
                        -
                        <%# Eval("EndTime") %>
                    </ItemTemplate>
                    <HeaderStyle Font-Bold="true" HorizontalAlign="Center" />
                </tk:GridTemplateColumn>
            </Columns>
        </MasterTableView>
    </tk:RadGrid>
    <asp:ObjectDataSource ID="InterviewObjectDataSource" runat="server" TypeName="KID_Admin_CSharp.BLL.KIDBLL"
        SelectMethod="getInterviewData" UpdateMethod="updateInterviewData" DeleteMethod="deleteInterviewData">
        <SelectParameters>
         <asp:ControlParameter ControlID="grid" DbType="String" Name="intvw_seqno" PropertyName="SelectedValues['intvw_seqno']"/>
        </SelectParameters>
        <UpdateParameters>
            <asp:Parameter Type="Object" Name="UpdateValues" />
        </UpdateParameters>
        <UpdateParameters>
            <asp:Parameter Type="String" Name="netID" />
        </UpdateParameters>
        <DeleteParameters>
            <asp:Parameter Name="intvw_seqno" Type="String" />
        </DeleteParameters>
    </asp:ObjectDataSource>
    
    <asp:HiddenField ID="interviewSeqNo" runat="server" />




<tk:RadGrid ID="DetailRadgrid" runat="server" AllowPaging="True" AllowSorting="True"
        AutoGenerateColumns="False" CellSpacing="0" GridLines="None" Skin="Transparent"
        DataSourceID="InterviewObjectDataSource" AlternatingItemStyle-BackColor="ControlLight"
        AllowAutomaticUpdates="true" AllowAutomaticDeletes="true">
        <MasterTableView EditMode="PopUp">
            <Columns>
                <tk:GridEditCommandColumn EditText="Details" />
                <tk:GridTemplateColumn HeaderText="Location Name">
                    <ItemTemplate>
                        <%# Eval("loc_location") %>
                    </ItemTemplate>
                    <HeaderStyle Font-Bold="true" HorizontalAlign="Center" />
                </tk:GridTemplateColumn>
                <tk:GridTemplateColumn HeaderText="Date">
                    <ItemTemplate>
                        <%# Eval("intvw_dt_end") %>
                    </ItemTemplate>
                    <HeaderStyle Font-Bold="true" HorizontalAlign="Center" />
                </tk:GridTemplateColumn>
                <tk:GridTemplateColumn HeaderText="Time">
                    <ItemTemplate>
                        <%# Eval("StartTime") %>
                        -
                        <%# Eval("EndTime") %>
                    </ItemTemplate>
                    <HeaderStyle Font-Bold="true" HorizontalAlign="Center" />
                </tk:GridTemplateColumn>
                <tk:GridTemplateColumn HeaderText="Max Enrollment">
                    <ItemTemplate>
                        <%# Eval("intvw_max_enrollment") %>
                    </ItemTemplate>
                    <HeaderStyle Font-Bold="true" HorizontalAlign="Center" />
                </tk:GridTemplateColumn>
                <tk:GridTemplateColumn HeaderText="Status">
                    <ItemTemplate>
                        <%# Eval("intvw_status").ToString() == "True" ? "Active" : "Inactive" %>
                    </ItemTemplate>
                    <HeaderStyle Font-Bold="true" HorizontalAlign="Center" />
                </tk:GridTemplateColumn>
                <tk:GridTemplateColumn HeaderText="Locked">
                    <ItemTemplate>
                        <%#Eval("intvw_lock").ToString() == "True" ? "Locked" : "Unlocked"%>
                    </ItemTemplate>
                    <HeaderStyle Font-Bold="true" HorizontalAlign="Center" />
                </tk:GridTemplateColumn>
            </Columns>
        </MasterTableView>
    </tk:RadGrid>
</asp:Content>

phani
Top achievements
Rank 1
 answered on 17 May 2020
5 answers
1.8K+ views

I'm sure this is a no brainer, but I can't find out how to get the ID of the row selected in javascript.

My RadGrid has the following property.

<MasterTableView AutoGenerateColumns="False" DataKeyNames="loc_Location_ID" DataSourceID="SqlDataSource1">

On clicking a row the client side RowClick method is called. In there I need to get the loc_Location_ID for the selected row. The loc_Location_ID is not displayed in the grid.

How do I get this value after clicking a row?
Ahmad
Top achievements
Rank 1
 answered on 16 May 2020
1 answer
131 views

Hello, I am trying to create a way for the user to view a pdf, xlsx, jpg, gif, etc., from a link button within my Detail table in a radgrid. I am able to accomplish this for a pdf, but not the image files or Excel files.

One of the main issues is that the file types stored within the SQL table field can be any of those above types. My question is how can I write the vb.net code to display any type of file from the same RadGrid column; as the Details Table can have numerous records of different file types. 

Here's what I have --

01.<DetailTables>
02.                <telerik:GridTableView DataKeyNames="fileID" Name="Attachments" DataSourceID="sdsVenFiles" CommandItemDisplay="Top" Caption="Files Attached to this Vendor Maintenance Request:"
03.                    NoDetailRecordsText="No files are attached to this Vendor Adjustment request." Width="75%" EditFormSettings-FormCaptionStyle-Font-Bold="true">
04.                    <ParentTableRelation>
05.                        <telerik:GridRelationFields DetailKeyField="wfID" MasterKeyField="wfID" />
06.                    </ParentTableRelation>
07.                    <CommandItemSettings ShowAddNewRecordButton="false" ShowRefreshButton="true" />
08.                    <Columns>
09.                        <telerik:GridBoundColumn SortExpression="fileID" HeaderText="File ID" HeaderButtonType="TextButton" DataField="fileID" Visible="false"></telerik:GridBoundColumn>
10.                        <telerik:GridBoundColumn SortExpression="wfID" HeaderText="Control #" HeaderButtonType="TextButton" DataField="wfID" Visible="false"></telerik:GridBoundColumn>
11.                        <telerik:GridTemplateColumn HeaderText="Open File">
12.                            <ItemTemplate>
13.                                <asp:LinkButton ID="lnkDownload" runat="server" Text='<%# Eval("fileName")%>' OnClick="viewFile" CommandArgument='<%# Eval("fileID")%>'></asp:LinkButton>
14.                            </ItemTemplate>
15.                        </telerik:GridTemplateColumn>
16.                         
17.                        <telerik:GridButtonColumn CommandName="Delete" ConfirmText="Delete this file?" HeaderText="Delete" Text="Delete" UniqueName="DeleteColumn1">
18.                        </telerik:GridButtonColumn>
19.                    </Columns>
20.                </telerik:GridTableView>
21.            </DetailTables>

 

And my vb.net --

01.Protected Sub viewFile(sender As Object, e As EventArgs)
02. 
03.        Dim id As Integer = Integer.Parse(TryCast(sender, LinkButton).CommandArgument)
04.        Dim bytes As Byte()
05.        Dim fileName As String, contentType As String
06.        Dim constr As String = ConfigurationManager.ConnectionStrings("DbName").ConnectionString
07.        Using con As New SqlConnection(constr)
08.            Using cmd As New SqlCommand()
09.                cmd.CommandText = "SELECT fileID, fileName, fileType, fileData FROM tblVendorFile WHERE fileId=@Id"
10.                cmd.Parameters.AddWithValue("@Id", id)
11.                cmd.Connection = con
12.                con.Open()
13.                Using sdr As SqlDataReader = cmd.ExecuteReader()
14.                    sdr.Read()
15.                    bytes = DirectCast(sdr("fileData"), Byte())
16.                    contentType = sdr("fileType").ToString()
17.                    fileName = sdr("fileName").ToString()
18.                End Using
19.                con.Close()
20.            End Using
21.        End Using
22. 
23.        Response.Clear()
24.        Response.Buffer = True
25.        Response.Charset = ""
26.        Response.Cache.SetCacheability(HttpCacheability.NoCache)
27.        Response.ContentType = "application/pdf"
28.        Response.BinaryWrite(bytes)
29.        Response.Flush()
30.        Response.End()
31. 
32.    End Sub

 

Thanks for any and all help!

Doncho
Telerik team
 answered on 15 May 2020
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?