Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
105 views
I have a RadGrid that retrieve data on button click via Sql using a repository pattern.  When the downloadPDF button is used the PDF only display the header info.  The remainder of the pdf page is blank.   Below are my codes.  Your help is greatly appreciated.
<head runat="server">
 
 <title>Trader Position</title>
 
 <link href="../Content/CotUI.css" rel="stylesheet" />
 
 <script type="text/javascript">
  
 function requestStart(sender, args) {
 
 if (args.get_eventTarget().indexOf("DownloadPDF") > 0)
 
 args.set_enableAjax(false);
 
}
 
 </script>
  
</head>
<body>
 <form id="form1" runat="server">
 
<telerik:RadScriptManager ID="RadScriptManager1" runat="server" AsyncPostBackTimeout="900"></telerik:RadScriptManager>
<div>
 
<asp:Button ID="ViewDataButton" runat="server" Text="View Trader Data" CssClass="blu-btn" ToolTip="Click to View Trader Data" OnClick="ViewDataButton_Click" />
</div>
<br />
 
<div id="TradersPositionDataGrid">
 
<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Black">
 
</telerik:RadAjaxLoadingPanel>
 
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" ClientEvents-OnRequestStart="requestStart" DefaultLoadingPanelID="RadAjaxLoadingPanel1" UpdatePanelsRenderMode="Inline">
 
<AjaxSettings>
 
<telerik:AjaxSetting AjaxControlID="ViewDataButton">
 
<UpdatedControls>
 
<telerik:AjaxUpdatedControl ControlID="TraderRadGrid" ></telerik:AjaxUpdatedControl>
 
</UpdatedControls>
 
</telerik:AjaxSetting>
 
</AjaxSettings>
 
</telerik:RadAjaxManager>
 
<asp:ImageButton ID="DownloadPDF" runat="server" ImageUrl="~/Images/pdf-icon.png" OnClick="DownloadPDF_Click" />
 
<telerik:RadGrid ID="TraderRadGrid" runat="server" PageSize="500" AutoGenerateColumns="false" AllowPaging="true" Width="1100"
 
OnUpdateCommand="TraderRadGrid_UpdateCommand" OnItemCreated="TraderRadGrid_ItemCreated" >
 
<ExportSettings IgnorePaging="true" OpenInNewWindow="true" HideStructureColumns="true" >
 
<Pdf PageHeight="210mm" PageWidth="297mm" DefaultFontFamily="Arial Unicode MS" PageTopMargin="45mm"
 
BorderStyle="Medium" BorderColor="#666666">
 
</Pdf>
 
</ExportSettings>
 
<ClientSettings>
 
 <%--<Scrolling AllowScroll="true" UseStaticHeaders="true"></Scrolling>--%>
 
 <%--<Scrolling AllowScroll="false" UseStaticHeaders="false"></Scrolling>--%>
 
<Virtualization ItemsPerView="500" EnableVirtualization="true" EnableCurrentPageScrollOnly="true" InitiallyCachedItemsCount="2000" />
 
<Resizing AllowColumnResize="true" />
 
</ClientSettings>
 
<MasterTableView EditMode="InPlace" EnableNoRecordsTemplate="true" CommandItemDisplay="Top" AutoGenerateColumns="false" DataKeyNames="OWNER_ID">
 
<CommandItemSettings ShowAddNewRecordButton="false" />
 
<ColumnGroups>
 
<telerik:GridColumnGroup HeaderText="Futures" Name="FuturesInfo" HeaderStyle-HorizontalAlign="Center"></telerik:GridColumnGroup>
 
<telerik:GridColumnGroup HeaderText="Adjusted Options" Name="AdjOptionInfo" HeaderStyle-HorizontalAlign="Center"></telerik:GridColumnGroup>
 
</ColumnGroups>
 
<Columns>
 
<telerik:GridEditCommandColumn ButtonType="ImageButton"></telerik:GridEditCommandColumn>
 
<telerik:GridBoundColumn UniqueName="TraderId" DataField="OWNER_ID" HeaderText="Trader Id"></telerik:GridBoundColumn>
 
<telerik:GridBoundColumn UniqueName="TraderName" DataField="TRADER_NAME" HeaderText="Trader Name"></telerik:GridBoundColumn>
 
<telerik:GridBoundColumn UniqueName="ContractMarket" DataField="CONTRACT_MARKET_CODE" HeaderText="Contract Market"></telerik:GridBoundColumn>
 
<telerik:GridBoundColumn UniqueName="ExpirationDate" DataField="FUTURES_EXPIRATION_DATE" HeaderText="Expiration Date"></telerik:GridBoundColumn>
 
<telerik:GridBoundColumn UniqueName="FutureLong" DataField="FUT_LONG" HeaderText="Future Long" ColumnGroupName="FuturesInfo"></telerik:GridBoundColumn>
 
<telerik:GridBoundColumn UniqueName="FutureShort" DataField="FUT_SHORT" HeaderText="Future Short" ColumnGroupName="FuturesInfo"></telerik:GridBoundColumn>
 
<telerik:GridBoundColumn UniqueName="AdjOptionLong" DataField="ADJ_OPT_LONG" HeaderText="Adjusted Option Long" ColumnGroupName="AdjOptionInfo"></telerik:GridBoundColumn>
 
<telerik:GridBoundColumn UniqueName="AdjOptionShort" DataField="ADJ_OPT_SHORT" HeaderText="Adjusted Option Short" ColumnGroupName="AdjOptionInfo"></telerik:GridBoundColumn>
 
<telerik:GridBoundColumn UniqueName="CommercialFlag" DataField="COMMERCIAL_FLAG" HeaderText="Commercial Flag"></telerik:GridBoundColumn>
 
</Columns>
 
<EditFormSettings EditColumn-HeaderStyle-Width="50px">
 
<EditColumn ButtonType="ImageButton" />
 
</EditFormSettings>
 
</MasterTableView>
 
<PagerStyle AlwaysVisible="true" Mode="NextPrev"></PagerStyle>
 
</telerik:RadGrid>
 
</div>
 
</form>
 
</body>
 
</html>

 

 

bool isPdfExport = false;
 
        protected void DownloadPDF_Click(object sender, ImageClickEventArgs e)
        {
             
             
            isPdfExport = true;
            //TraderRadGrid.Rebind();
            //TraderRadGrid.MasterTableView.Rebind();      
            TraderRadGrid.MasterTableView.ExportToPdf();
             
        }

 

Again Thank You.

 

 

 













 

 

 


Ronald
Top achievements
Rank 1
 answered on 31 Jul 2014
4 answers
92 views
I am having one RadGrid and binding one Datatable to it From codebehind.
At each paging or sorting or drag drop column it goes server side (page refreshed) and then displays.
is there any professional way i can achieve this with faster speed.
my code is

<telerik:RadGrid ID="RadGridEmployeeCost" runat="server" AllowSorting="True" AllowPaging="true"
    AllowFilteringByColumn="true" CellSpacing="0" GridLines="None" HeaderStyle-Font-Bold="true"
    Skin="Web20" OnNeedDataSource="RadGridEmployeeCost_NeedDataSource" ShowGroupPanel="true"
    OnColumnCreated="RadGridEmployeeCost_ColumnCreated">
    <ClientSettings AllowDragToGroup="True" />
</telerik:RadGrid>

 AND
  protected void RadGridEmployeeCost_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
       {
               ObjCon.Open();
               SqlCommand ObjCmd = new SqlCommand("SELECT name,address,TelPhone,EmailId,Qualification FROM WorkSummary", ObjCon);
               ObjCmd.ExecuteNonQuery();
               SqlDataAdapter ObjDa = new SqlDataAdapter(ObjCmd);
               DataSet ds = new DataSet();
               ObjDa.Fill(ds);
               RadGridEmployeeCost.DataSource = ds;
           }
       }
 
protected void RadGridEmployeeCost_ColumnCreated(object sender, GridColumnCreatedEventArgs e)
       {
           if ((e.Column is GridBoundColumn && e.Column.UniqueName == "TelPhone" || e.Column.UniqueName == "EmailId" || e.Column.UniqueName == "Qualification"))
           {
               GridBoundColumn column = e.Column as GridBoundColumn;
               column.AllowFiltering = false;
           }
       }

Jayesh Goyani
Top achievements
Rank 2
 answered on 31 Jul 2014
5 answers
543 views

In each row of a grid with EditType = "Row", I'm trying to show/hide the column editor controls based on data in that row. When some rows are in edit mode (after being clicked on), they will display a text box, checkbox, etc. approporiate for that particular row. Other rows will hide that option in the same column.
For the entire column, edit controls can be shown/hidden based on the column's ReadOnly field. Can this be turned on/off for individual rows?
Would prefer to handle this server-side. Trying to avoid managing dynamically added controls based on data conditions and instead simply turn on/off editing in specific cells of each row.

In the example below, when a row is in edit mode, I want the edit text box in the MilkType column to only display if the Product for that row is Milk. Otherwise the cell should be read-only when the row is in edit mode.

Thanks!
-Matt

(posting code separately - having problems submitting new thread with code blocks)

Matt
Top achievements
Rank 1
 answered on 31 Jul 2014
5 answers
418 views
Hello all,

I am having trouble with the calculated column. everything works well until the calculated column is added then I get error message "Identifier expected".

Have gone through the documentations and examples but cannot figure out what's wrong and why it's not working.
Here is the code below. Any insight would be appreciated. Thanks!



 
<telerik:RadGrid
     ID="ReportGrid"
     runat="server"
     DataSourceID="SearchResultDataSource"
 
         >
          
          
         <MasterTableView
         DataSourceID="SearchResultDataSource"
         AllowPaging="false"
 
         >
              
              
             <Columns>
                 
                                
                 <telerik:GridBoundColumn
                 DataField="name_last_first"
                 HeaderText="Name"
                  SortExpression="name_last_first"
                   UniqueName="name_last_first"
                                     
                     Aggregate="CountDistinct"
                      FooterAggregateFormatString="<b>{0:d}</b>"
 
                      />
 
                  
                 <telerik:GridNumericColumn
                 DataField="07" HeaderText="July"
                  SortExpression="07" UniqueName="07"
                   
               Aggregate="Sum"
               FooterAggregateFormatString="<b>{0:d}</b>"
                   />
 
 
 
                 <telerik:GridNumericColumn
                 DataField="08"
                 HeaderText="Aug" SortExpression="08"
                 UniqueName="08"                  
                
               Aggregate="Sum"
               FooterAggregateFormatString="<b>{0:d}</b>"
                 />
 
 
                 <telerik:GridNumericColumn DataField="09" HeaderText="Sept" SortExpression="09" UniqueName="09"
               Aggregate="Sum"
               FooterAggregateFormatString="<b>{0:d}</b>"
               />
 
 
 
                 <telerik:GridNumericColumn DataField="10" HeaderText="Oct" SortExpression="10" UniqueName="10"
               Aggregate="Sum"
               FooterAggregateFormatString="<b>{0:d}</b>"
               />
 
 
 
                 <telerik:GridNumericColumn DataField="11" HeaderText="Nov" SortExpression="11" UniqueName="11"
               Aggregate="Sum"
               FooterAggregateFormatString="<b>{0:d}</b>"
               />
 
 
 
                 <telerik:GridNumericColumn DataField="12" HeaderText="Dec" SortExpression="12" UniqueName="12"
               Aggregate="Sum"
               FooterAggregateFormatString="<b>{0:d}</b>"
               />
 
                 <telerik:GridNumericColumn DataField="01" HeaderText="Jan" SortExpression="01" UniqueName="01"
               Aggregate="Sum"
               FooterAggregateFormatString="<b>{0:d}</b>"
                
               />
 
                 <telerik:GridNumericColumn DataField="02" HeaderText="Feb" SortExpression="02" UniqueName="02"
               Aggregate="Sum"
               FooterAggregateFormatString="<b>{0:d}</b>"
                
               />
 
 
 
                 <telerik:GridNumericColumn DataField="03" HeaderText="Mar" SortExpression="03" UniqueName="03"
               Aggregate="Sum"
               FooterAggregateFormatString="<b>{0:d}</b>"
                
               />
 
                
 
                 <telerik:GridNumericColumn DataField="04" HeaderText="April" SortExpression="04" UniqueName="04"
               Aggregate="Sum"
               FooterAggregateFormatString="<b>{0:d}</b>"
                
               />
 
 
                 <telerik:GridNumericColumn DataField="05" HeaderText="May" SortExpression="05" UniqueName="05"
               Aggregate="Sum"
               FooterAggregateFormatString="<b>{0:d}</b>"
                
               />
 
                 <telerik:GridNumericColumn
                 DataField="06"
                 HeaderText="June"
                  SortExpression="06"
                  UniqueName="06"
               Aggregate="Sum"
               FooterAggregateFormatString="<b>{0:d}</b>"
/>
 
 
 
          <telerik:GridCalculatedColumn
          HeaderText="Opened"
          UniqueName="Opened"           
          Aggregate="Sum" 
          FooterAggregateFormatString="<b>{0:d}</b>"
          DataFormatString="{0:d}"
          DataType="System.Int32"
          DataFields="01,02,03,04,05,06,07,08,09,10,11,12"
          Expression="{0}+{1}+{2}+{3}+{4}+{5}+{6}+{7}+{8}+{9}+{10}+{11}"                     
          />
    
 
             </Columns>
 
 
              <GroupByExpressions>
                  
                 <telerik:GridGroupByExpression>
                     <GroupByFields>
                        <telerik:GridGroupByField FieldName="unit_type" HeaderText=" " SortOrder="Ascending"  />
                     </GroupByFields>
                     
                     <SelectFields>
                         <telerik:GridGroupByField FieldName="unit_type" HeaderText=" " HeaderValueSeparator=" "  SortOrder="Ascending"  />
                     </SelectFields>
                 </telerik:GridGroupByExpression>
 
 
 
 
                 <telerik:GridGroupByExpression>
                     <GroupByFields>
                         <telerik:GridGroupByField FieldName="unit_name" HeaderText=" " SortOrder="Ascending"  />
                     </GroupByFields>
                                             
                     <SelectFields>
                         <telerik:GridGroupByField FieldName="unit_name" HeaderText=" " HeaderValueSeparator=" "  SortOrder="Ascending"  />
                     </SelectFields>
                 </telerik:GridGroupByExpression>
 
 
             </GroupByExpressions>
 
 
 
 
         </MasterTableView>
 
     </telerik:RadGrid>
 
 
 <asp:SqlDataSource ID="SearchResultDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
     SelectCommand="rpt_getOpenAndAssignedByMonthForUnit" EnableCaching="False" SelectCommandType="StoredProcedure">
 
     <SelectParameters>
    <asp:ControlParameter
    Name="int_fy"
    Type="Int32" 
    PropertyName="Text"
    ControlID="YearTxt"
    />
David
Top achievements
Rank 1
Iron
Iron
Veteran
 answered on 31 Jul 2014
2 answers
139 views
I am trying to create a custom EditForm for use with the RadGrid.  When I edit or insert a record, the other records in the grid display incorrectly.  

My app:
- simple ASP.NET 4.5 web application
- OS: Windows 8.1
- IDE: VS2013.  
- Telerik version - I am a consultant and using the DLLs provided by my client, so I don't have any sort of Telerik SDK installed.  The version of Telerik.Web.UI.dll I am using is 2013.1.417.35 (17MB, dated 5/12/2014 7:50pm).
- Browser: Google Chrome Version 36.0.1985.125 m.  I also tested on IE 11 11.0.9600.17207 (Update version 11.0.10).

TestGrid.aspx:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="TestGrid.aspx.cs" Inherits="TestGrid" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
        <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="dataGrid">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="dataGrid" LoadingPanelID="RadAjaxLoadingPanel1"/>
                        <telerik:AjaxUpdatedControl ControlID="divMsgs" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>
        <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" />
        <div>
            <telerik:RadGrid runat="server" ID="dataGrid" AutoGenerateColumns="False" Width="300px">
                <MasterTableView DataKeyNames="Id" CommandItemDisplay="Top" EditMode="EditForms">
                    <Columns>
                        <telerik:GridEditCommandColumn />
                        <telerik:GridBoundColumn HeaderText="Id" DataField="Id" Display="False" UniqueName="Id" />
                        <telerik:GridBoundColumn HeaderText="Name" DataField="Name" UniqueName="Name" />
                        <telerik:GridBoundColumn HeaderText="Age" DataField="Age" UniqueName="Age" />
                    </Columns>
                    <EditFormSettings EditFormType="Template">
                        <FormTemplate>
                            <table>
                                <thead>
                                    <th colspan="2">Person Info</th>
                                </thead>
                                <tbody>
                                    <tr>
                                        <td>Name</td>
                                        <td><asp:TextBox ID="tbName" runat="server" Text='<%# Bind("Name") %>' /></td>
                                    </tr>
                                    <tr>
                                        <td>Age</td>
                                        <td><asp:TextBox ID="tbAge" runat="server" Text='<%# Bind("Age") %>' /></td>
                                    </tr>
                                    <tr>
                                        <td align="right" colspan="2">
                                            <asp:Button ID="btnUpdate" runat="server" 
                                                Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>'
                                                CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>' />
                                            &nbsp;
                                            <asp:Button ID="btnCancel" runat="server" 
                                                Text="Cancel" CausesValidation="False" CommandName="Cancel" />
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                        </FormTemplate>
                    </EditFormSettings>
                </MasterTableView>
            </telerik:RadGrid>
        </div>
    </form>
</body>
</html>

TestGrid.aspx.cs:

using System;
using System.Collections;
using System.Diagnostics;
using Telerik.Web.UI;

public partial class TestGrid : System.Web.UI.Page {
    protected void Page_Load(object sender, EventArgs e) {
        dataGrid.NeedDataSource += dataGrid_NeedDataSource;
        dataGrid.InsertCommand += dataGrid_InsertCommand;
        dataGrid.UpdateCommand += dataGrid_UpdateCommand;
    }

    void dataGrid_NeedDataSource(object sender, GridNeedDataSourceEventArgs e) {
        dataGrid.DataSource = People;
    }

    public People People {
        get {
            var obj = this.ViewState["_people"];
            if (obj != null) return (People)obj;
            var people = People.AllPeople;
            this.ViewState["_people"] = people;
            return people;
        }
    } 

    void dataGrid_UpdateCommand(object sender, GridCommandEventArgs e) {
        var values = new Hashtable();
        e.Item.OwnerTableView.ExtractValuesFromItem(values, e.Item as GridEditableItem);
        foreach (DictionaryEntry de in values) Debug.WriteLine("{0}={1}", de.Key, de.Value);
        People.UpdatePerson(values);
        this.ViewState["_people"] = People;
    }

    void dataGrid_InsertCommand(object sender, GridCommandEventArgs e) {
        var values = new Hashtable();
        e.Item.OwnerTableView.ExtractValuesFromItem(values, e.Item as GridEditableItem);
        People.AddPerson(values);
        this.ViewState["_people"] = People;
        
    }
}

App_Code\Person.cs:

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;

[Serializable]
public class Person {
    static int _nextId;

    private int m_id;

    public int Id {
        get { return m_id; }
        set { 
            m_id = value;
            _nextId = Math.Max(m_id + 1, _nextId);
        }
    }

    public string Name { get; set; }
    public int Age { get; set; }
    public Person(int id, string name, int age) {
        Id = id;
        Name = name;
        Age = age;
    }
    public Person() {}
    public void AssignId() {
        Id = _nextId;
    }

    public override string ToString() {
        return string.Format("#{0}: {1} [{2}]", Id, Name, Age);
    }

    public void Update(Hashtable values) {
        Name = (string)values["Name"];
        Age = int.Parse((string)values["Age"]);
    }
}

[Serializable]
public class People : List<Person> {
    public People() {
        Add(new Person(1, "David", 43));
        Add(new Person(2, "Rebecca", 40));
    }
    public void UpdatePerson(Hashtable values) {
        var person = this.FirstOrDefault(p => p.Id == int.Parse((string)values["Id"]));
        if (person == null) throw new NullReferenceException("Person not found (" + values["Id"] + ")");
        person.Update(values);
    }
    public void AddPerson(Hashtable values) {
        var person = new Person();
        person.AssignId();
        person.Update(values);
        Add(person);
    }

    static People s_people;
    public static People AllPeople { get { return s_people ?? (s_people = new People()); } }
}

I have attached three files:
- Pic1.png: Viewing the data (works fine)
- Pic2.png: Edit the "David" record
- Pic3.png: Insert a new record

I tried viewing source after clicking Insert, but it appears that source in that case is simply the source I see when I view the data.  The custom edit form controls don't appear in that source. 

Note that this is the same behavior as in this post:

http://www.telerik.com/forums/problem-editform-template--edit-and-new-record 
David
Top achievements
Rank 1
 answered on 31 Jul 2014
5 answers
146 views
Hi there,

I am wondering if there is any support for a floating column chart.  I tried to make my own by creating a Series with a white background, however, the column itself has a gray border.

John
Danail Vasilev
Telerik team
 answered on 31 Jul 2014
2 answers
134 views
Hello all first time poster here, I have a bit of a problem with a RadGrid GridTemplateColumn and a dropdownlist is saving back a blank string. Here is the code I am using. I don't know how much you need so I will post the minimum.
<telerik:RadGrid ID="RadGrid1" DataSourceID="SqlDataSource1" runat="server" OnUpdateCommand="RadGrid1_UpdateCommand"
        ShowStatusBar="true" AutoGenerateColumns="False" AllowSorting="True" AllowMultiRowSelection="False"
        AllowPaging="False" AllowAutomaticDeletes="True" AllowAutomaticInserts="True"
        AllowAutomaticUpdates="True" OnItemUpdated="RadGrid1_ItemUpdated" OnItemDeleted="RadGrid1_ItemDeleted"
        OnItemInserted="RadGrid1_ItemInserted" OnInsertCommand="RadGrid1_InsertCommand" OnItemDataBound="RadGrid1_ItemDataBound"
        OnItemCreated="RadGrid1_ItemCreated" Width="950">
        <MasterTableView DataSourceID="SqlDataSource1" DataKeyNames="ID" AllowMultiColumnSorting="True"
            Width="100%" CommandItemDisplay="Top" Name="Questions">
            <DetailTables>
                <telerik:GridTableView DataKeyNames="ID" DataSourceID="SqlDataSource2" Width="100%"
                    runat="server" CommandItemDisplay="Top" Name="Answers">
                    <ParentTableRelation>
                        <telerik:GridRelationFields DetailKeyField="QuestionID" MasterKeyField="ID"></telerik:GridRelationFields>
                    </ParentTableRelation>
                    <Columns>
                        <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn1">
                            <HeaderStyle Width="20px"></HeaderStyle>
                            <ItemStyle CssClass="MyImageButton"></ItemStyle>
                        </telerik:GridEditCommandColumn>
                        <telerik:GridBoundColumn SortExpression="QuestionID" HeaderText="Question" HeaderButtonType="TextButton"
                            DataField="QuestionID" UniqueName="QuestionID" ReadOnly="true">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn SortExpression="AnswerText" HeaderText="Answer Text" HeaderButtonType="TextButton"
                            DataField="AnswerText" UniqueName="AnswerText">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn SortExpression="PanelAmount" HeaderText="Panel Amount" HeaderButtonType="TextButton"
                            DataField="PanelAmount" UniqueName="PanelAmount">
                        </telerik:GridBoundColumn>
                        <telerik:GridTemplateColumn  SortExpression="IsEnd" HeaderText="Is End"
                            HeaderButtonType="TextButton" DataField="IsEnd" UniqueName="IsEnd">
                            <ItemTemplate>
                                <asp:Label ID="LabelIsEnd" runat="server"><%# DataBinder.Eval(Container.DataItem, "IsEnd")%></asp:Label>
                            </ItemTemplate>
                            <EditItemTemplate>
                                <asp:CheckBox ID="CheckBoxIsEnd" runat="server" Checked='<%#Eval("IsEnd") %>' />
                            </EditItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridBoundColumn SortExpression="JumpToQuestion" HeaderText="Jump To Question"
                            HeaderButtonType="TextButton" DataField="JumpToQuestion" UniqueName="JumpToQuestion">
                        </telerik:GridBoundColumn>
                        <telerik:GridTemplateColumn  SortExpression="StartSurvey" HeaderText="Start Survey"
                            HeaderButtonType="TextButton" DataField="StartSurvey" UniqueName="StartSurvey">
                            <ItemTemplate>
                                <asp:Label ID="LabelStartSurvey" runat="server"><%# DataBinder.Eval(Container.DataItem, "StartSurvey")%></asp:Label>
                            </ItemTemplate>
                            <EditItemTemplate>
                                <asp:CheckBox ID="CheckBoxStartSurvey" runat="server" Checked='<%#Eval("StartSurvey") %>' />
                            </EditItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridButtonColumn CommandName="Delete" Text="Delete" UniqueName="DeleteColumnAnswer">
                        </telerik:GridButtonColumn>
                    </Columns>
                </telerik:GridTableView>
            </DetailTables>
            <Columns>
                <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn1">
                    <HeaderStyle Width="20px"></HeaderStyle>
                    <ItemStyle CssClass="MyImageButton"></ItemStyle>
                </telerik:GridEditCommandColumn>
                <telerik:GridBoundColumn SortExpression="ID" HeaderText="ID" HeaderButtonType="TextButton"
                    DataField="ID" UniqueName="ID" ReadOnly="true">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn SortExpression="QuestionText" HeaderText="Question Text"
                    HeaderButtonType="TextButton" DataField="QuestionText" UniqueName="QuestionText">
                </telerik:GridBoundColumn>
                <telerik:GridTemplateColumn  SortExpression="QuestionType" HeaderText="Question Type"
                    HeaderButtonType="TextButton" DataField="QuestionType" UniqueName="QuestionType">
                    <ItemTemplate>
                        <asp:Label ID="LabelQuestionType" runat="server"><%# DataBinder.Eval(Container.DataItem, "QuestionType")%></asp:Label>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:DropDownList ID="DropDownListQUestionType" runat="server"></asp:DropDownList>
                        <%--<asp:DropDownList ID="DropDownListQUestionType" runat="server" SelectedValue='<%#Eval("QuestionType") %>'></asp:DropDownList>--%>
                    </EditItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridBoundColumn SortExpression="QuestionPosition" HeaderText="Question Position"
                    HeaderButtonType="TextButton" DataField="QuestionPosition" UniqueName="QuestionPosition">
                </telerik:GridBoundColumn>
                <telerik:GridButtonColumn CommandName="Delete" Text="Delete" UniqueName="DeleteColumnQuestion">
                </telerik:GridButtonColumn>
            </Columns>
        </MasterTableView>
    </telerik:RadGrid>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:Local_TypingTool_NewConnectionString %>"
        UpdateCommand="UPDATE [Screener_Questions] SET [QuestionText] = @QuestionText, [QuestionType] = @QuestionType, [QuestionPosition] = @QuestionPosition WHERE [ID] = @ID"
        SelectCommand="SELECT [ID], [QuestionText], [QuestionType], [QuestionPosition] FROM Screener_Questions WHERE [Survey_ID] = @Survey_ID"
        InsertCommand="INSERT INTO [Screener_Questions] ([Survey_ID], [QuestionText], [QuestionType], [QuestionPosition]) VALUES (@Survey_ID, @QuestionText, @QuestionType, @QuestionPosition)"
        DeleteCommand="DELETE FROM [Screener_Questions] WHERE [ID] = @ID">
        <DeleteParameters>
            <asp:Parameter Name="ID" Type="Int32" />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="Survey_ID" Type="Int32" />
            <asp:Parameter Name="QuestionText" Type="String" />
            <asp:Parameter Name="QuestionType" Type="Int32" />
            <asp:Parameter Name="QuestionPosition" Type="Int32" />
        </InsertParameters>
        <UpdateParameters>
            <asp:Parameter Name="ID" Type="Int32" />
            <asp:Parameter Name="QuestionText" Type="String" />
            <asp:Parameter Name="QuestionType" Type="Int32" />
            <asp:Parameter Name="QuestionPosition" Type="Int32" />
        </UpdateParameters>
        <SelectParameters>
            <asp:Parameter Name="Survey_ID" Type="String" />
        </SelectParameters>
    </asp:SqlDataSource>

protected void RadGrid1_UpdateCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
        {
            GridEditableItem editedItem = e.Item as GridEditableItem;
            DropDownList list = editedItem.FindControl("DropDownListQUestionType") as DropDownList;
            Session["updatedValueQUestionType"] = list.SelectedValue;
        }

When I run the code I see the dropdownlist and it has data and it shows the correct drop down value when displayed.
On the RadGrid1_UpdateCommand it does see the value to hold it in the session but for some reason it actauly saves it back as a blank string.

Princy
Top achievements
Rank 2
 answered on 31 Jul 2014
1 answer
134 views
Hi

I am using radasyncupload to add avatars to my website profile and there is a radimageeditor in the same page. I want to upload a file directly and open it directly in the image editor for cropping. Any solution?

Thankyou
Shinu
Top achievements
Rank 2
 answered on 31 Jul 2014
3 answers
580 views
Hi,

I was hoping to keep any ticked check boxes ticked when my radgrid rebinds. I found this tutorial: http://www.telerik.com/help/aspnet-ajax/grid-selecting-row-with-checkbox-server-side.html however my "onCheckedItem" events never fire, instead my "needDataSource" event is fired and that is the end of it (I verified this using debug mode and checkpoints). I'm assuming this is because I'm using advanced data binding unlike in the tutorial. I need to keep advanced data binding for features such as grid export. Also it's important the checkboxes are server side because I want to be able to build functions in c# which rely on what tick boxes are selected. Below is the code for my radgrid 

Let me know if you need any more code. Thanks in advance

[code]
​<telerik:RadGrid ID="batchGrid" runat="server"
AllowFilteringByColumn="True" AllowSorting="True"
CellSpacing="0" GridLines="None" OnNeedDataSource="batchGrid_NeedDataSource"
EnableViewState="False" AutoGenerateColumns="True" OnColumnCreated="batchGrid_ColumnCreated"
OnExportCellFormatting="batchGrid_ExportCellFormatting"><ExportSettings ExportOnlyData="true" HideStructureColumns="true" >
<Excel Format="Html"/>
 </ExportSettings> <ClientSettings AllowColumnsReorder="True" EnablePostBackOnRowClick="false" >
 <Selecting AllowRowSelect="false"/>
 <Resizing AllowResizeToFit="true" />
 </ClientSettings> <MasterTableView NoMasterRecordsText="No batch found containing this part, with the current filters">
<Columns>
 <telerik:GridTemplateColumn UniqueName="CheckBoxTemplateColumn" AllowFiltering="false" Reorderable="false" >
 <ItemTemplate>
 <asp:CheckBox ID="MyCheckBox" runat="server" OnCheckedChanged="ToggleRowSelection" AutoPostBack="true" />
 </ItemTemplate>
 <HeaderTemplate>
 <asp:CheckBox ID="headerChkbox" runat="server" OnCheckedChanged="ToggleSelectedState" AutoPostBack="true" />
 </HeaderTemplate>
 </telerik:GridTemplateColumn>
 </Columns>
 <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column" Visible="True">
 <HeaderStyle Width="20px" />
 </RowIndicatorColumn>
 <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column" Visible="True">
 <HeaderStyle Width="20px" />
 </ExpandCollapseColumn>
 <EditFormSettings>
 <EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn>
 </EditFormSettings>
 </MasterTableView> <FilterMenu EnableImageSprites="False" ></FilterMenu>
</telerik:RadGrid>
[/code]
Princy
Top achievements
Rank 2
 answered on 31 Jul 2014
3 answers
122 views
I created a radgrid bound to a webservice (by using ClientSettings/DataBinding). and found that I could not get the grid to go into edit mode at all. I wanted to have a grid with an edit button column, and simply click the button to popup an autogenerated edit form for that grid row, but it doesn't even attempt to open the popup or go into edit mode.

I tried a simple project where I set up a radgrid bound using another method (needdatasource) and set up the editing how I wanted it, and it all worked. But when I add markup for databinding the edit mode completely stops working.

Am I trying to achieve something impossible?
Konstantin Dikov
Telerik team
 answered on 31 Jul 2014
Narrow your results
Selected tags
Tags
+? more
Top users last month
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?