Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
179 views
Hi,

I want to setup a RadGrid Object with batch editing using multiple disconnected DataTable data sources. How do I making sorting work as it should on in the Template Columns containing RadComboBox/Label controls? The columns I want to sort alphabetically in the example below are EntrĂ©e, and Salad.

Rad Grid aspx:

001.<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="TesterApp.Default" %>
002.<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
003.</asp:Content>
004.<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
005.    <form id="form1" runat="server">
006.             <asp:Label ID="GridStatusLabel" runat="server" Text="Nothing Yet" ForeColor="#33CC33"></asp:Label>
007.<br />
008.      <telerik:RadScriptManager ID="RadScriptManager1" runat="server"/>
009. 
010.      <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" MinDisplayTime="1000" Skin="Silk">
011.      </telerik:RadAjaxLoadingPanel>
012. 
013.      <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" DefaultLoadingPanelID="RadAjaxLoadingPanel">
014.         <AjaxSettings>
015. 
016.            <telerik:AjaxSetting AjaxControlID="SampleGrid">
017.               <UpdatedControls>
018.                  <telerik:AjaxUpdatedControl ControlID="SampleGrid" LoadingPanelID="RadAjaxLoadingPanel1" />
019.                  <telerik:AjaxUpdatedControl ControlID="GridStatusLabel"/>
020.               </UpdatedControls>
021.            </telerik:AjaxSetting>
022. 
023.         </AjaxSettings>
024.      </telerik:RadAjaxManager>
025. 
026.      <telerik:RadGrid
027.         ID="SampleGrid"
028.         runat="server"
029.         AllowPaging="True"
030.         AllowSorting="True"
031.         ShowStatusBar="True"
032.         GroupPanelPosition="Top"
033. 
034.         AllowAutomaticUpdates="True"
035.         AllowAutomaticInserts="True"
036.         AllowAutomaticDeletes="True"
037. 
038.         OnNeedDataSource="SampleGrid_NeedDataSource"
039. 
040.         OnItemCommand="SampleGrid_ItemCommand"
041.         OnItemDataBound="SampleGrid_ItemDataBound"
042.         OnBatchEditCommand="SampleGrid_BatchEditCommand"
043. 
044.         Skin="Silk"
045.         Height="467px"
046.      >
047.           <MasterTableView
048.             DataKeyNames="PersonID"
049.             AutoGenerateColumns="false"
050.             EditMode="Batch"
051.             CommandItemStyle-Wrap="false" ItemStyle-Wrap="false"
052.             CommandItemDisplay="TopAndBottom"
053.             CommandItemSettings-ShowExportToExcelButton="true"
054.             CommandItemSettings-ShowExportToPdfButton="true"
055.            >
056.               <BatchEditingSettings
057.                   EditType="Cell"
058.                   OpenEditingEvent="DblClick"
059.                />
060.                    <Columns>
061.                        <telerik:GridBoundColumn
062.                            UniqueName="rgcPersonID"
063.                            DataField="PersonID"
064.                            DataType="System.Int32"
065.                            Display="False"
066.                        >
067.                        </telerik:GridBoundColumn>
068. 
069.                        <telerik:GridBoundColumn
070.                            UniqueName="rgcFirst"
071.                            DataField="First"
072.                            HeaderText="First Name"
073.                            >
074.                        </telerik:GridBoundColumn>
075. 
076.                        <telerik:GridBoundColumn
077.                            UniqueName="rgcInitial"
078.                            DataField= "Initial"
079.                            HeaderText="Mid Initial"
080.                            >
081.                        </telerik:GridBoundColumn>
082. 
083.                        <telerik:GridBoundColumn
084.                            UniqueName="rgcLast"
085.                            DataField= "Last"
086.                            HeaderText="Last Name"
087.                            >
088.                        </telerik:GridBoundColumn>
089. 
090.                        <telerik:GridBoundColumn
091.                            UniqueName="rgcProfession"
092.                            DataField= "Profession"
093.                            HeaderText="Profession"
094.                            ItemStyle-Wrap="false"
095.                            >
096.                        </telerik:GridBoundColumn>
097. 
098.                        <telerik:GridTemplateColumn
099.                            UniqueName="rgcEntree"
100.                            HeaderText="Entree"
101.                            HeaderToolTip="This person's favorite meal, of course!"
102.                            DataField="EntreeID"
103.                            AllowSorting="true"
104.                            SortExpression="EntreeID"
105.                            HeaderStyle-Width="90"
106.                            ItemStyle-Width="50px"
107.                            ItemStyle-HorizontalAlign="Center"
108.                            HeaderStyle-HorizontalAlign="Center"
109.                            Resizable="false"
110.                            ItemStyle-Wrap="false"
111.                        >
112.                            <ItemTemplate>
113.                                <asp:Label ID="lblEntree" runat="server" Text='<%# Eval("EntreeFaveID")%>' ></asp:Label>
114.                            </ItemTemplate>
115.                            <EditItemTemplate>
116.                                <telerik:RadComboBox
117.                                    UniqueName="rcbunEntree"
118.                                    ID="rcbidEntreeID"
119.                                    DataValueField="EntreeID"
120.                                    DataTextField="Name"
121.                                    runat="server"
122.                                    OnPreRender="rcbidEntreeID_PreRender"
123.                                    >
124.                                </telerik:RadComboBox>
125.                            </EditItemTemplate>
126.                        </telerik:GridTemplateColumn>
127. 
128.                        <telerik:GridTemplateColumn
129.                            UniqueName="rgcSalad"
130.                            HeaderText="Salad"
131.                            HeaderToolTip="I think it's healthy."
132.                            DataField="SaladID"
133.                            AllowSorting="true"
134.                            SortExpression="SaladID"
135.                            HeaderStyle-Width="90"
136.                            ItemStyle-Width="50px"
137.                            ItemStyle-HorizontalAlign="Center"
138.                            HeaderStyle-HorizontalAlign="Center"
139.                            Resizable="false" ItemStyle-Wrap="false"
140.                        >
141.                            <ItemTemplate>
142.                                <asp:Label ID="lblSalad" runat="server" Text='<%# Eval("SaladFaveID")%>' ></asp:Label>
143.                            </ItemTemplate>
144.                            <EditItemTemplate>
145.                                <telerik:RadComboBox
146.                                    UniqueName="rcbunSalad"
147.                                    ID="rcbidSaladID"
148.                                    DataValueField="SaladID"
149.                                    DataTextField="Name"
150.                                    runat="server"
151.                                    OnPreRender="rcbidSaladID_PreRender"
152.                                    >
153.                                </telerik:RadComboBox>
154.                            </EditItemTemplate>
155.                        </telerik:GridTemplateColumn>
156. 
157.                        <telerik:GridTemplateColumn
158.                            UniqueName="rgcDateFaveEaten"
159.                            AllowSorting="true"
160.                            ItemStyle-HorizontalAlign="Center"
161.                            HeaderStyle-HorizontalAlign="Center"
162.                            HeaderText="Last Meal Date"
163.                            SortExpression="rgcDateFaveEaten"
164.                            >
165.                            <ItemTemplate>
166.                                <asp:Label runat="server" ID="lblDateFaveEaten" Text='<%# Eval("DateFaveEaten", "{0:MM/dd/yyyy}") %>'>
167.                                </asp:Label>
168.                            </ItemTemplate>
169.                            <EditItemTemplate>
170.                                <telerik:RadDatePicker ID="rdpDateFaveEaten" runat="server" Width="100">
171.                                </telerik:RadDatePicker>
172.                            </EditItemTemplate>
173.                        </telerik:GridTemplateColumn>
174.                    </Columns>
175.            </MasterTableView>
176. 
177.            <ClientSettings
178.                AllowKeyboardNavigation="True"
179.                EnableRowHoverStyle="true"
180.            >
181.            <ClientEvents OnCellSelected=""/>
182.                <Selecting AllowRowSelect="True" CellSelectionMode="SingleCell" />
183.                <Scrolling AllowScroll="True" UseStaticHeaders="True" />
184.                <Resizing AllowColumnResize="True" ClipCellContentOnResize="true" ResizeGridOnColumnResize="false" />
185.            </ClientSettings>
186.            <PagerStyle Height="40px" />
187. 
188.            <FilterMenu EnableEmbeddedSkins="True" Skin ="Silk"></FilterMenu>
189.        </telerik:RadGrid>
190.    </form>
191.</asp:Content>


Code Behind:

001.using System;
002.using System.Data;
003.using System.Linq;
004.using Telerik.Web.UI;
005.using System.Web.UI.WebControls;
006. 
007.namespace TesterApp {
008. 
009.    public partial class Default : System.Web.UI.Page
010.    {
011.        private DataTable Foodies = new DataTable("FoodLiker");
012.        private DataTable Entrees = new DataTable("Entree");
013.        private DataTable Salads = new DataTable("Salad");
014. 
015.        protected void Page_Load(object sender, EventArgs e)
016.        {
017.            Entrees.Columns.Add("EntreeID", typeof(Int32));
018.            Entrees.Columns.Add("Name", typeof(string));
019.            Entrees.Columns.Add("Description", typeof(string));
020. 
021.            Salads.Columns.Add("SaladID", typeof(Int32));
022.            Salads.Columns.Add("Name", typeof(string));
023.            Salads.Columns.Add("Description", typeof(string));
024. 
025.            Foodies.Columns.Add("PersonID",      typeof(Int32));
026.            Foodies.Columns.Add("First",         typeof(string));
027.            Foodies.Columns.Add("Initial",       typeof(char));
028.            Foodies.Columns.Add("Last",          typeof(string));
029.            Foodies.Columns.Add("Profession",    typeof(string));
030.            Foodies.Columns.Add("EntreeFaveID",    typeof(Int32));
031.            Foodies.Columns.Add("SaladFaveID",     typeof(Int32));
032.            Foodies.Columns.Add("DateFaveEaten", typeof(string));
033. 
034.            Entrees.Rows.Add(100, "No Entree Chosen", "Choose, or Lose. It's how you play the game.");
035.            Entrees.Rows.Add(111, "Spicy Honey-Brushed Chicken Thighs", "Habanero Flavored Chicken Pieces Dipped in Blended Comb Scraped Off with a Denman Grooming Brush");
036.            Entrees.Rows.Add(222, "Easy Baked Fish Fillets", "Preschool Bag of Cod Pieces Made to Prepare with a Ten Watt Light Bulb");
037.            Entrees.Rows.Add(333, "Spaghetti with Sausage and Tomato Sauce", "Pasta Pushed through a Struddler with Chunks of Imitation Meat Substitute and Ketchup");
038.            Entrees.Rows.Add(444, "Miso-Glazed Salmon", "Salmon in a Bowl of Miso Soup");
039.            Entrees.Rows.Add(555, "Chicken Cordon Bleu", "Fancy Poultry Slices Eaten with Your Pinky Finger Sticking Out");
040.            Entrees.Rows.Add(666, "Shrimp and Broccoli Stir-Fry", "Sea Creatures Curled up with Flakey Plastic Tails with Pieces of Broccoli Mixed together with a Paddle inside a Fryolater");
041. 
042.            Salads.Rows.Add(80, "No Salad Chosen",    "Choose Your Destiny");
043.            Salads.Rows.Add(81, "Jello Salad",    "I think this was in a Bill Cosby Commercial");
044.            Salads.Rows.Add(82, "Ambrosia",       "A Salad if it Was Bought in a Candy Store");
045.            Salads.Rows.Add(83, "Celery Victor""Named after the Guy");
046.            Salads.Rows.Add(84, "Coleslaw",       "Mixed with Original Recipe Chicken, you Have Soggy Sweet Chicken");
047.            Salads.Rows.Add(85, "Crab Louie",     "Under the Sea, Everything's Better, Everything's Wetter, Take it from Me");
048.            Salads.Rows.Add(86, "Glorified Rice", "I Thought this was Supposed to be a Salad");
049. 
050.            Foodies.Rows.Add(10000, "Jim",      "K",   "TheJay",     "Filmographer",                         333, 82,"1/10/2015");
051.            Foodies.Rows.Add(20000, "Kevin",    null"Slevin",     "Step Dancer",                          222, 86,"1/10/2015");
052.            Foodies.Rows.Add(30000, "Cathleen", "M",   "Fuhrsberg""Colecovision Repair Dude",             555, 82,"1/10/2015");
053.            Foodies.Rows.Add(40000, "Trey",      null, "Chase",      "Salesman of the Year",                 666, 81,"1/10/2015");
054.            Foodies.Rows.Add(50000, "Chevy",     "B""Taylor",     "Professional Rumorist",                222, 82,"1/10/2015");
055.            Foodies.Rows.Add(60000, "Lance",     "K""Simmons",    "The One Who's Got it All Figured Out", 111, 86,"1/10/2015");
056.            Foodies.Rows.Add(70000, "Sandy",     null, "Seekleston", "Brainwashing Machine Repair Man",      222, 83,"1/10/2015");
057.        }
058. 
059.        protected void SampleGrid_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
060.        {
061.            SampleGrid.DataSource = Foodies;
062.        }
063. 
064.        protected void SampleGrid_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
065.        {
066.            if (e.CommandName == "DeleteRecord")
067.            {
068.                GridStatusLabel.Text = "Deleted a Record.";
069.            }
070.        }
071. 
072.        protected void SampleGrid_BatchEditCommand(object sender, Telerik.Web.UI.GridBatchEditingEventArgs e)
073.        {
074.            foreach (GridBatchEditingCommand command in e.Commands)
075.            {
076.                switch (command.Type)
077.                {
078.                    case GridBatchEditingCommandType.Update:
079.                        GridStatusLabel.Text = "Update a Record from Batch Edit";
080.                    break;
081.                    case GridBatchEditingCommandType.Insert:
082.                        GridStatusLabel.Text = "Insert a Record from Batch Edit";
083.                    break;
084.                    case GridBatchEditingCommandType.Delete:
085.                        GridStatusLabel.Text = "Delete a Record from Batch Edit";
086.                    break;
087.                }
088.            }
089.        }
090. 
091.        protected void SampleGrid_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
092.        {
093.            if (e.Item is GridDataItem)
094.            {
095.             // Setup Handlers for the Grid Data
096.                GridDataItem dataItem = e.Item as GridDataItem;
097.                Label lbl;
098. 
099.             // Populate the Entree Drop Down
100.                lbl = (Label)dataItem["rgcEntree"].FindControl("lblEntree");
101.                if (lbl != null) {
102.                    if (lbl.Text.Length <= 0)
103.                        lbl.Text = "100";
104. 
105.                    Entrees.PrimaryKey = new DataColumn[] { Entrees.Columns["EntreeID"] };
106.                    DataRow currentRecordRow = Entrees.Rows.Find(Convert.ToInt32(lbl.Text));
107.                    lbl.Text = currentRecordRow["Name"].ToString();
108.                }
109. 
110.             // Populate the Salad Drop Down
111.                lbl = (Label)dataItem["rgcSalad"].FindControl("lblSalad");
112.                if (lbl != null) {
113.                    if (lbl.Text.Length <= 0)
114.                        lbl.Text = "100";
115. 
116.                    Salads.PrimaryKey = new DataColumn[] { Salads.Columns["SaladID"] };
117.                    DataRow currentRecordRow = Salads.Rows.Find(Convert.ToInt32(lbl.Text));
118.                    lbl.Text = currentRecordRow["Name"].ToString();
119.                }
120. 
121.            }
122.        }
123. 
124.        protected void rcbidEntreeID_PreRender(object sender, EventArgs e)
125.        {
126.            RadComboBox combo = sender as RadComboBox;
127. 
128.            combo.DataSource = Entrees;
129.            combo.DataValueField = "EntreeID";
130.            combo.DataTextField = "Name";
131.            combo.ToolTip = "Description";
132.            combo.DataBind();
133.        }
134. 
135.        protected void rcbidSaladID_PreRender(object sender, EventArgs e)
136.        {
137.            RadComboBox combo = sender as RadComboBox;
138. 
139.            combo.DataSource = Salads;
140.            combo.DataValueField = "SaladID";
141.            combo.DataTextField = "Name";
142.            combo.ToolTip = "Description";
143.            combo.DataBind();
144.        }
145.    }
146.}

Konstantin Dikov
Telerik team
 answered on 30 Mar 2015
1 answer
63 views
I'm using AsyncUpload control inside a RadAjaxLoadingPanel , I added RadAjaxManager to my page. 
Then the files are uploading fine in IE,
but it throws a script error when I open my page in other Browsers.

Please help me in this scenario.

Thanks in Advance.

Note: Please find the attachment
Hristo Valyavicharski
Telerik team
 answered on 30 Mar 2015
15 answers
188 views
From another post/sample i'm using the javascript below to resize my grid height to make the grid be 100% of a div tag. It works perfect, until i set the <ClientEvents OnGridCreated="oncreated" /> property. In the "oncreated" function i was just saving off a reference to grid for something later. For some reason setting that property cause my grid to resize and to be small.

 function oncreated() {
       var RadGrid1 = RadGrid1.gridObj();
   }

---  this is working without the <ClientEvents OnGridCreated="oncreated" />

<script>
   var $ = $telerik.$; //make jQuery available through $ alias

  
   function oncreated() {
       var RadGrid1 = RadGrid1.gridObj();
   }

   function pageLoad() {
       setGridHeight(); //set grid's height on page load
   }

   $(window).resize(function () {
       setGridHeight(); //maintain grid's height on window resize
   });

   function setGridHeight() {
       var headerHeight = $('.header').outerHeight(),  //header height including margin, padding and borders
footerHeight = $('.footer').outerHeight(),  //footer height including margin, padding and borders
windowHeight = $(window).height(),          //window height
gridObj = $find('<%= RadGrid1.ClientID%>'), //grid's client object

gridHeight = windowHeight - (headerHeight + footerHeight + 2); //calculate grid's height
                    $('#' + gridObj.get_id()).height(gridHeight);                  //set grid's height to the calculated
                    gridObj.repaint();                                             //it is required to repaint the grid so it can recalculate its metrics after window resize
                }
</script>

<telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="true" PageSize="50" AllowSorting="true" OnNeedDataSource="RadGrid1_NeedDataSource">
<MasterTableView Width="100%" TableLayout="Fixed">
</MasterTableView>
<ClientSettings>
<Scrolling AllowScroll="true" UseStaticHeaders="true" />
                <ClientEvents OnGridCreated="oncreated" />
</ClientSettings>
</telerik:RadGrid>

    <style>
html,
body,
form {
height: 100%;
margin: 0;
padding: 0;
vertical-align: top;
}

.header {
height: 20px;
            background: green;
color: white;
}
.footer {
height: 20px;
background: green;
color: white;
}
</style>

Pavlina
Telerik team
 answered on 30 Mar 2015
3 answers
166 views
Hi,

I have a dashboard having multiple widgets. Some widgets containing radgrid with vertical scroll bar. when I apply UseStaticHeaders on grid then grid does not dispaly on screen in full width becasue some column and scroll bar goes into out of screen(see the image1). when i am undocking the menu of left side then grid display in full width on screen with scroll bar (see the image 2).

So how i will make grid to dispaly full width including scroll bar as well as usestaticheader is true in both condition either on menu doc or undock mode.

Please help.

Warm Regards,
Reyaz

Pavlina
Telerik team
 answered on 30 Mar 2015
1 answer
119 views
Hello,

is it possible to show the headers of the DetailTable in the MasterTableView only once?

You can see my grid in the attachment. I want to show all blue rows on top of the grid. The filtering functionality is required as well. Is there a way to do this? Any help is appreciated.
Konstantin Dikov
Telerik team
 answered on 30 Mar 2015
1 answer
287 views
Hi,

I use the "try...catch" in order to save the data to the server.
And I was exception handling in the "throw ex".

However, this doesn't display page when an error occurs.
So I have to debug to check the exception message.

In such a case, do I need to process How?

here my code.

aspx
    <title></title>
    <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
    <script type="text/javascript">
        function Update() {
            var batchManager = grid2.get_batchEditingManager();
            batchManager.saveChanges(grid2.get_masterTableView());
        }
......
<body>
    <form id="form" runat="server">
    <div>
       <telerik:RadAjaxPanel ID="RadAjaxPanel2" runat="server" Height="100%" Width="100%" HorizontalAlign="NotSet" OnAjaxRequest="RadAjaxPanel2_AjaxRequest">
            <telerik:RadGrid ID="RadGrid2" runat="server" AutoGenerateColumns="False" Culture="ko-KR" GroupPanelPosition="Top" OnNeedDataSource="RadGrid2_NeedDataSource" OnBatchEditCommand="RadGrid2_BatchEditCommand" OnItemCreated="RadGrid2_ItemCreated" Height="445px" OnPreRender="RadGrid2_PreRender" AllowAutomaticUpdates="True" ShowFooter="True">
                <ClientSettings AllowColumnsReorder="True" ReorderColumnsOnClient="True" AllowKeyboardNavigation="True">
                    <ClientEvents OnRowCreated="RowCreated" OnBatchEditCellValueChanged="RadGrid2_OnBatchEditCellValueChanged" />
                    <KeyboardNavigationSettings AllowSubmitOnEnter="True" CancelChangesKey="D1" />
                    <Scrolling AllowScroll="True" UseStaticHeaders="True" />
                </ClientSettings>
                <MasterTableView EditMode="Batch" BatchEditingSettings-EditType="Cell">
                    <Columns>
............


aspx.cs
....................
        protected override void OnPreInit(EventArgs e)
        {
            baseScriptManager = new ScriptManager();
            baseScriptManager.AsyncPostBackTimeout = 600;
            Page.Items[typeof(ScriptManager)] = baseScriptManager;
 
            base.OnPreInit(e);
        }
 
        protected override void OnPreLoad(EventArgs e)
        {
            Page.Items[typeof(ScriptManager)] = null;
            baseScriptManager.AllowCustomErrorsRedirect = true;
            baseScriptManager.AsyncPostBackError += this.baseScriptManager_AsyncPostBackError;
 
            this.Form.Controls.Add(baseScriptManager);
 
            base.OnPreLoad(e);
        }
        private void baseScriptManager_AsyncPostBackError(object sender, AsyncPostBackErrorEventArgs e)
        {
            baseScriptManager.AsyncPostBackErrorMessage = e.Exception.Message;
        }
        protected void RadGrid2_BatchEditCommand(object sender, GridBatchEditingEventArgs e)
        {
            ................
 
            using (DbConnection connection = db.CreateConnection())
            {
                connection.Open();
                DbTransaction transaction = connection.BeginTransaction();
                try
                {
                    DbCommand dbCommand = null;
                    foreach (DBParameter DBParameter in parameters)
                    {
                        dbCommand = db.GetStoredProcCommand("uspw_test1");
                        dbCommand.CommandTimeout = commandTimeout;
                        if (DBParameter != null)
                        {
                            foreach (Parameter parameter in DBParameter.ListParameter)
                                db.AddInParameter(dbCommand, parameter.Name, parameter.DBType, parameter.Value);
                        }
 
                        result += db.ExecuteNonQuery(dbCommand, transaction);
                    } 
                    // Commit the transaction
                    transaction.Commit();
                }
                catch (System.Exception ex)
                {
                    // Rollback transaction
                    transaction.Rollback();
                    throw ex;
                }
                connection.Close();
 
                return;
            }
        }
Angel Petrov
Telerik team
 answered on 30 Mar 2015
2 answers
92 views
Hi,

I am using asyncupload for storing files firstly in temp folder and then move to main folder after saving the records to the database.
I look around many demos given but not found the exact solution. The demos are so complicated.

Please give a simple example using only asyncuploader for my task.
I am be very thankful.

Thanks in advance..
Anuj
Top achievements
Rank 1
 answered on 30 Mar 2015
2 answers
245 views
Hi All,
Just wondering how can I disable Template Column Link button on Client side.
I wanted to change color, change cursor to default, not clickable and wont go to its link.
My code works for other databound column but for this template only through';
is working, all the rest is not applying at all.
Any info would be much appreciated.
Thanks in advance.

ASPX
<telerik:GridTemplateColumn HeaderText="Name" SortExpression="NAME" UniqueName="Name" HeaderTooltip="Name" DataField="NAME" HeaderStyle-Width="25%" ItemStyle-Width="25%" Exportable="true">
   <ItemTemplate>
      <asp:LinkButton id="lnkName" ForeColor="Blue" runat="server" Text='<%# Convert.ToString(DataBinder.Eval(Container.DataItem, "NAME"))%>' CommandName="LAUNCH_NAME" CausesValidation="false"></asp:LinkButton>
   </ItemTemplate>
</telerik:GridTemplateColumn>


JS
function isTaskNA(chk,idx) {
var chkNA = document.getElementById(chk);
var masterTable = $find("<%=GrdMain.ClientID %>").get_masterTableView();
var PN = masterTable.get_dataItems()[idx].get_cell("Name");
var row = masterTable.get_dataItems()[idx].get_element();
   if (chkNA.checked){
   row.style.color = 'gray';
   row.style.textDecoration = 'line-through';
   row.style.fontStyle = 'italic';
   PN.style.ForeColor = 'gray';
   PN.disabled = 'disabled';
   }else {
   row.style.color = 'black';
   row.style.textDecoration = 'none';
   row.style.fontStyle = "normal";
   PN.style.ForeColor = 'blue';
   }
}

RJ
Top achievements
Rank 1
 answered on 30 Mar 2015
2 answers
147 views
Hello, I bind a grid programmatically using NeedDataSource.
Filtering, sorting, paging, all work perfectly.

myDataSource = new ObjectDataSource { ... };
myDataSource.Selecting += SourceSelecting;
...
 
private void SourceSelecting(object sender, ObjectDataSourceSelectingEventArgs e)
{
     e.InputParameters["filterExpression"] = myGrid.MasterTableView.FilterExpression;
}

I have problems when SQL Server BIT columns are bound to a GridCheckBoxColumn and I allow filtering on it.
The problem is that in previous code the filter expression is something like ([MyBoolColumn] = True).
This expression is not valid when I pass it to SQL Server, because True is not a valid bit value (should be 1).

Is there any way to tell the grid to use 0/1 as filter values for GridCheckBoxColumns instead of False/True?

Thanks
Igor
Top achievements
Rank 2
 answered on 29 Mar 2015
1 answer
98 views
I followed your demo here:
http://demos.telerik.com/aspnet-ajax/ajax/examples/common/showingwebcontrols/defaultcs.aspx

And got the show/hide to work great, however I have problems with the treeview after the showing/hiding. I can't click on most of the checkboxes any longer. See the screencast below. 

http://screencast.com/t/irAwzZBFg1

Any ideas?
Bill
Top achievements
Rank 1
 answered on 27 Mar 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?