Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
214 views
Hello,

I currently have a rad grid that on row insert and edit command displays a regular ASP DropDownList box populated from code behind in the OnItemDataBound event handler. Everything is working fine, the values are populated and the data is stored on insert/update, however changing the EditMode to InPlace on the master table view creates an empty box with no data populated. What is changing here?

Here is the first part of my ASP for the grid

<telerik:RadGrid ID="OrderItemGrid" runat="server" AutoGenerateColumns="False"
    CellSpacing="0" GridLines="None">
    <MasterTableView CommandItemDisplay="Top" DataKeyNames="OrderItemID" EditMode="InPlace">
        <CommandItemSettings ExportToPdfText="Export to PDF" AddNewRecordText="Quick-Add New Order Item" />
        <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column"
            Visible="True">
        </RowIndicatorColumn>
        <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column"
            Visible="True">
        </ExpandCollapseColumn>
        <Columns>
            <telerik:GridBoundColumn DataField="OrderItemID"
                FilterControlAltText="Filter OrderItemID column" HeaderText="Item ID"
                ReadOnly="True" UniqueName="OrderItemID">
            </telerik:GridBoundColumn>
            <telerik:GridTemplateColumn DataField="CatID" FilterControlAltText="Filter CatID column" HeaderText="Category" UniqueName="CatID">
                <EditItemTemplate>
                    <asp:DropDownList ID="DDCategory" runat="server"></asp:DropDownList>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:DropDownList ID="DDCategory" runat="server"></asp:DropDownList>
                </InsertItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="CatIDLabel" runat="server" Text='<%# Eval("CatID") %>'></asp:Label>
                </ItemTemplate>
            </telerik:GridTemplateColumn>


And here is the relevant code-behind


Protected Sub OrderItemGrid_ItemDataBound(ByVal sender As Object, ByVal e As GridItemEventArgs) Handles OrderItemGrid.ItemDataBound
    If TypeOf (e.Item) Is GridEditFormInsertItem And e.Item.IsInEditMode Then
        Dim editItem As GridEditFormInsertItem = CType(e.Item, GridEditFormInsertItem)
        Dim dropList As DropDownList = CType(editItem("CatID").FindControl("DDCategory"), DropDownList)
        Using dbContext As New MatrixORMModelVB()
            dropList.DataSource = dbContext.Categories.ToList()
            dropList.DataTextField = "CategoryName"
            dropList.DataValueField = "CategoriesID"
            dropList.DataBind()
        End Using
    ElseIf TypeOf (e.Item) Is GridDataItem And Not e.Item.IsInEditMode Then
        Dim editItem As GridDataItem = CType(e.Item, GridDataItem)
        Dim label As Label = CType(editItem("CatID").FindControl("CatIDLabel"), Label)
        Using dbContext As New MatrixORMModelVB()
            Dim temp As String = label.Text
            Dim tempCat As MatrixORM.Category = dbContext.Categories.Where(Function(c) c.CategoriesID = temp).First()
            label.Text = tempCat.CategoryName
        End Using
    End If
End Sub

If I remove EditMode="InPlace" from the MasterTableView things work perfectly. Why the difference?

Thanks
Princy
Top achievements
Rank 2
 answered on 07 Jun 2013
1 answer
146 views
Hi,
How to access the TreeListEditCommandColumn in the code behind. I was trying to access from code behind, but i could not able to acess.
Please help me out.Please refer the below code for your reference.

If i can acces the

TreeListEditCommandColumn , from that i can able to hide the plus button in the parent node. or i can set the visible true/false.

<telerik:RadTreeList ID="treeListClientBudget" runat="server" OnNeedDataSource="treeListClientBudget_NeedDataSource" Visible="false" HideExpandCollapseButtonIfNoChildren="true"
                            DataKeyNames="DataKey" Height="200px" OnChildItemsDataBind="treeListClientBudget_ChildItemsDataBind" OnItemDataBound="treeListClientBudget_ItemDataBound"
                            ParentDataKeyNames="ParentKey" AutoGenerateColumns="false" AllowLoadOnDemand="true" EditMode="InPlace" OnUpdateCommand="treeListClientBudget_UpdateCommand" OnInsertCommand="treeListClientBudget_InsertCommand" OnCancelCommand="treeListClientBudget_CancelCommand" OnEditCommand="treeListClientBudget_EditCommand">
                            <ClientSettings Selecting-AllowItemSelection="true" Scrolling-AllowScroll="true" Scrolling-UseStaticHeaders="true" >
                                <Selecting AllowToggleSelection="true"/>
                            </ClientSettings>
 
                            <Columns>
                                <telerik:TreeListEditCommandColumn   UniqueName="InsertCommandColumn"  ShowAddButton="false" ButtonType="ImageButton" ShowEditButton="false" HeaderStyle-Width="30px" ItemStyle-HorizontalAlign="Center">
                                     <HeaderStyle Width="60px" />
                                    <ItemStyle Width="60px" />
                                </telerik:TreeListEditCommandColumn>
                                <telerik:TreeListButtonColumn CommandName="Edit" Text="Edit" UniqueName="EditCommandColumn" ButtonType="ImageButton" HeaderStyle-Width="30px" ItemStyle-HorizontalAlign="Center">
                                    
                                </telerik:TreeListButtonColumn>
 
                                <telerik:TreeListButtonColumn UniqueName="DeleteCommandColumn" Text="Delete" CommandName="Delete" ButtonType="ImageButton" HeaderStyle-Width="30px"></telerik:TreeListButtonColumn>
                                <telerik:TreeListBoundColumn DataField="DisplayName" UniqueName="DisplayName" ReadOnly="true"
                                    HeaderText="Month/Classification">   </telerik:RadTreeList>

 

please refer the code for Codebehind .CS

 

protected void treeListClientBudget_ItemDataBound(object sender, TreeListItemDataBoundEventArgs e)
    {
 
 
        if (e.Item is TreeListDataItem)
        {
            TreeListDataItem item = e.Item as TreeListDataItem;
 
            //hdnClassificationId.Value = Convert.ToString(item.GetDataKeyValue("DataKey"));
            switch (item.HierarchyIndex.NestedLevel)
            {
                case 0:
                    item.BackColor = System.Drawing.Color.LightYellow;
                    break;
                case 1:
                    item.BackColor = System.Drawing.Color.YellowGreen;
                     
                    ImageButton treelist = item["TreeListEditCommandColumn"].FindControl("InsertCommandColumn") as ImageButton;
                    //treelist.ShowAddButton = true;
                    //    hdnClassificationId.Value =Convert.ToString( item.GetDataKeyValue("DataKey"));
                    break;
                case 2:
                    item.BackColor = System.Drawing.Color.LightPink;
                    item["InsertCommandColumn"].Visible = true;
                    break;
            }
        }
    }
Andrey
Telerik team
 answered on 07 Jun 2013
4 answers
228 views
So I would like to create a Grid with a Grid template column that contains a radiobutton and a textbox. On the click of the radiobutton, i want the textbox to appear to the right of the grid. Any help on starting this would be greatly appreciated.
Princy
Top achievements
Rank 2
 answered on 07 Jun 2013
2 answers
258 views
Hi guys. I have implemented a RadGrid with Edit and Insert Mode and filter capabilities.

When filtering the RadGrid while in edit mode, the edited row seems to be based on the row number, eg, when I'm editing row number 3, and while editing, the grid is filtered, the edited row remains at row number 3 even though the row of the record I'm currently editing may have changed.

For Example, if I'm doing auto CRUD on this table with in place editing

[id] [code]
-----------------------
[01] codeX
[02] codeY
[03] codeY

and the row being edited is the 2nd one ([02] codeY)

if a filter (using the RadGrid default filter) is done on Code "EqualTo" 'codeY' such that the result becomes

[id] [code]
-----------------------
[02] codeY
[03] codeY

the edited row is still the 2nd one ([03] codeY) even though the row originally being edited is ([02] codeY)

Is this the expected behaviour, or is there are way to instruct the RadGrid to look for the record to set the edit mode on that particular record again? If not, is there a way to automatically cancel edit mode/insert mode just before filtering? Or to disable all filtering controls while user is in edit/insert mode? Thanks for reading.
Joey
Top achievements
Rank 1
 answered on 07 Jun 2013
1 answer
59 views
Hi I have to create a grid dynamically.  I can do most of it in vb code behind but I also need an edit column?  What is the syntax for this creation?

        boundColumn = New GridBoundColumn()
        dgCompDetails.MasterTableView.Columns.Add(boundColumn)
        boundColumn.DataField = "ippComponentSrcValue"
        boundColumn.UniqueName = "dgippComponentSrcValue"
        boundColumn.Display = True
        boundColumn.HeaderText = "Value"

I need the next column to be a

GridEditCommandColumn

but can not figure out the correct syntax.

Thanks.

Shinu
Top achievements
Rank 2
 answered on 07 Jun 2013
4 answers
205 views
I had a hard time figuring out DatePicker's MonthView CSS is broken when using AntiXssEncoder library in the project. It somehow prevents MonthView to render properly. Is there a way to fix MonthView in DatePicker when using with AntiXssEncoder? May be manually adding some css lines and fixind the view?
Robert
Top achievements
Rank 1
 answered on 06 Jun 2013
1 answer
240 views
I'm using Telerik ASP.NET AJAX controls (ver. 2010.2.929.40).  When I use the AntiXssEncoder as the default encoder...

    <httpRuntime encoderType="Microsoft.Security.Application.AntiXssEncoder, AntiXssLibrary" />

The links on the radtabstrip controls in our application get rendered with %23 instead of # as the hyperlink....

i.e.
With AntiXssLibrary

<a class="rtsLink rtsAfter" href="%23"> 

Instead of without the AntiXssLibrary...

<a class="rtsLink rtsAfter" href="#">

Clicking on the first link results in a 404 error page.

Is there a solution for this problem? 
Robert
Top achievements
Rank 1
 answered on 06 Jun 2013
7 answers
375 views
How do we change the case sensitivity for the CAPTCHA when using the SendMail SocialNetType? When presented to end-users, there is no notification about case sensitivity and they could potentially get frustrated because the CAPTCHA error returns "Please, reenter the code in the captcha", even though the code IS entered in correctly, but in lowercase.
moegal
Top achievements
Rank 1
 answered on 06 Jun 2013
4 answers
261 views
Like the title describes, I'd like to prevent the "select all" checkbox within the header of the GridClientSelectColumn from firing or being selected automatically when all rows in the grid (current page) have been selected manually by the user (I believe it did not automatically select the header checkbox in some older versions).  The reason is that we are treating this header checkbox a little differently and when the user specifically checks this "select all" checkbox, it will check all rows of the current page AND we will check for it behind the scenes to select all items that have been returned for this specific query - but we also want the user to be able to select just those items on the current page if they wish without having this header checbox become checked.

I hope that makes sense and I appreciate the help!
Chau
Top achievements
Rank 1
 answered on 06 Jun 2013
3 answers
222 views
I have following chart I want to set two things using C#
  1. How can I set x-axis legends below chart not below axis since it overlaping lines?
  2. I am setting tooltip is not appearing like this "{0} Sentiment - {1} Volume"?

Chart Preview

private void FillChart(IEnumerable<EntitySearchResponse> data)
  {
      SentimentChart.ChartTitle.Text = "Sentemants Per day";
 
      SentimentChart.PlotArea.YAxis.TitleAppearance.Text = "Sentimants %";
 
 
      SentimentChart.PlotArea.XAxis.LabelsAppearance.RotationAngle = 90;
      SentimentChart.PlotArea.XAxis.Step = 10;
      SentimentChart.PlotArea.XAxis.Items.Clear();
 
      foreach (var date in data.Select(x => x.Date).Distinct())
      {
          var axisItem = new AxisItem(date.ToString("ddd dd"));
          SentimentChart.PlotArea.XAxis.Items.Add(axisItem);
      }
 
      SentimentChart.DataSource = data;
 
      SentimentChart.PlotArea.Series.Clear();
 
      foreach (var entityName in data.Select(x => x.EntityName).Distinct())
      {
          var series = new ColumnSeries();
          series.LabelsAppearance.DataFormatString = "{0} items";
          series.TooltipsAppearance.DataFormatString = "{0} {2} items";
          series.Name = entityName;
 
          var items = data.Where(x => x.EntityName == entityName).ToList();
          foreach (var entitySearchResponse in items)
          {
              var seriesItem = new SeriesItem(entitySearchResponse.Sentiment);
              seriesItem.TooltipValue = string.Format("{0} Sentiment - {1} Volume", entitySearchResponse.Sentiment,
                                                      entitySearchResponse.Volume);
              series.Items.Add(seriesItem);
          }
          SentimentChart.PlotArea.Series.Add(series);
      }
 
  }

Danail Vasilev
Telerik team
 answered on 06 Jun 2013
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?