or
|
GridColumn col = (GridColumn)RadGrid1.MasterTableView.GetColumn("ColumnUniqueName"); |
| <telerik:GridTemplateColumn HeaderText="SectionID" UniqueName="SectionID"> |
| <EditItemTemplate> |
| <telerik:RadComboBox ID="SectionIDEditor" runat="server" AppendDataBoundItems="true" DataValueField="SectionID" DataTextField="SectionName" DataSourceID="SqlDataSource3" Skin="WebBlue" > |
| <Items> |
| <telerik:RadComboBoxItem Value="" Text="Select Parent Section" /> |
| </Items> |
| </telerik:RadComboBox> |
| </EditItemTemplate> |
| <ItemTemplate> |
| <asp:Label ID="SectionIDLabel" runat="server" Text='<%# Eval("SectionID") %>'></asp:Label> |
| </ItemTemplate> |
| </telerik:GridTemplateColumn> |
| Protected Sub RadGrid1_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles RadGrid1.ItemDataBound |
| If (TypeOf e.Item Is GridEditableItem AndAlso e.Item.IsInEditMode) Then |
| 'access/modify the edit item template settings here |
| Dim Section As RadComboBox = CType(e.Item.FindControl("SectionIDEditor"), RadComboBox) |
| Section.DataSourceID = "SqlDataSource3" |
| Section.DataBind() |
| If Not DataBinder.Eval(e.Item.DataItem, "SectionID") Is Nothing And IsNumeric(DataBinder.Eval(e.Item.DataItem, "SectionID")) Then |
| ''Section.SelectedValue = DirectCast(DataBinder.Eval(e.Item.DataItem, "SectionID"), Integer) |
| ''Section.Items(0).Attributes("style") = "color: red" |
| 'Section.SelectedValue = DataBinder.Eval(e.Item.DataItem, "SectionID") |
| ''If Section.Items.FindItemByValue("", True).Selected Then |
| ''End If |
| ''Dim ComboItem As RadComboBoxItem |
| ''For Each ComboItem In Section.Items |
| '' If ComboItem.Value.Equals(e.Item.DataItem) Then |
| '' ComboItem.Selected = True |
| '' End If |
| ''Next ComboItem |
| If (Not Session("updatedValue") Is Nothing) Then |
| Section.SelectedValue = Session("updatedValue") |
| End If |
| Else |
| Section.SelectedValue = "" |
| End If |
| End If |
| 'If (TypeOf e.Item Is GridEditableItem AndAlso CType(e.Item, GridEditableItem).IsInEditMode) Then |
| ' 'Dim editedItem As GridEditableItem = CType(e.Item, GridEditableItem) |
| ' 'Dim editMan As GridEditManager = editedItem.EditManager |
| ' 'Dim editor As GridTemplateColumnEditor = CType(editMan.GetColumnEditor("SectionID"), GridTemplateColumnEditor) 'in case you have RadComboBox editor for the GridDropDownColumn (this is the default editor), 'you will need to use ComboBoxControl below instead of DropDownListControl 'and add RadComboBoxItems instead of ListItems to the Items collection of the editor |
| ' 'Dim Section As RadComboBox = editor.ComboBoxControl |
| ' Dim Section As RadComboBox = CType(e.Item.FindControl("SectionIDEditor"), RadComboBox) |
| ' 'Section.Items.Insert(0, New RadComboBoxItem("Select Parent Section", "NotSetItem")) |
| ' If Not DataBinder.Eval(e.Item.DataItem, "SectionID") Is Nothing And IsNumeric(DataBinder.Eval(e.Item.DataItem, "SectionID")) Then |
| ' 'Section.SelectedValue = DirectCast(DataBinder.Eval(e.Item.DataItem, "SectionID"), Integer) |
| ' 'Section.Items(0).Attributes("style") = "color: red" |
| ' Section.SelectedValue = DataBinder.Eval(e.Item.DataItem, "SectionID") |
| ' 'If Section.Items.FindItemByValue("", True).Selected Then |
| ' 'End If |
| ' 'Dim ComboItem As RadComboBoxItem |
| ' 'For Each ComboItem In Section.Items |
| ' ' If ComboItem.Value.Equals(e.Item.DataItem) Then |
| ' ' ComboItem.Selected = True |
| ' ' End If |
| ' 'Next ComboItem |
| ' End If |
| 'End If |
| End Sub |
Hi telerik team,
I have a doubt hiding edit and delete images in a column based upon Groupby status in outlook style grid.
i followed below URL
http://demos.telerik.com/aspnet-ajax/grid/examples/programming/webmail/defaultcs.aspx
instead of Received from date i will have status:open(4) on Expand group shows 4 (rows)items
in which edit and delte should display
if Satus:Closed(8) in which Edit and delete column will display but without images
I m able to do in common grid but in outlook style grid?
Appreciable for any quick help
Thanks & Regards
G.Sudheer kumar
| public class Programs |
| { |
| public string Name |
| { |
| get; |
| set; |
| } |
| public bool Required |
| { |
| get; |
| set; |
| } |
| public bool Approved |
| { |
| get; |
| set; |
| } |
| } |
| public partial class Charts: Page |
| { |
| List<Programs> ProgramList; |
| protected void Button_Click(object sender, ImageClickEventArgs e) |
| { |
| //Programs has items in it and is declare as a var |
| // for brevity sake I left out the filtering code |
| ProgramList = programs; |
| DetailsGrid.DataSource = null; |
| DetailsGrid.Rebind(); |
| } |
| protected void DetailsGrid_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e) |
| { |
| if (ProgramList != null) |
| { |
| DetailsGrid.DataSource = ProgramList; |
| } |