This is a migrated thread and some comments may be shown as answers.

Control visibility of a control

1 Answer 33 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mark
Top achievements
Rank 1
Mark asked on 11 Nov 2014, 01:55 PM
Hi  I have a rad grid and I would like to control a date time control in one column based on that data in another column,

so if the column called Multiple  is Yes then I would like to either make the column called  SuggestedFix  not visible or not editable is this possible?
grid definition below

  <Columns>
<telerik:GridClientSelectColumn UniqueName="add_number" headertext="Select" HeaderStyle-Width="4%" ItemStyle-Width="4%" ItemStyle-HorizontalAlign="Left"/>
<telerik:GridBoundColumn UniqueName="id" DataField="id" HeaderText="id" ReadOnly="True" Display="False" SortExpression="carriername" > </telerik:GridBoundColumn>
<telerik:GridBoundColumn UniqueName="Multiple" DataField="Multiple" HeaderText="Multiple" ReadOnly="True" HeaderStyle-Width="9%" ItemStyle-Width="9%" FilterControlWidth="75%" FilterControlAltText="CLI filter column" > </telerik:GridBoundColumn>
<telerik:GridBoundColumn UniqueName="cli" DataField="cli" HeaderText="CLI" ReadOnly="True" HeaderStyle-Width="9%" ItemStyle-Width="9%" FilterControlWidth="75%" FilterControlAltText="CLI filter column" > </telerik:GridBoundColumn>
<telerik:GridBoundColumn UniqueName="cost" DataField="cost" HeaderText="Cost" ReadOnly="True" HeaderStyle-Width="10%" ItemStyle-Width="10%" FilterControlWidth="75%" ItemStyle-HorizontalAlign="Right" FilterControlAltText="CLI filter column" > </telerik:GridBoundColumn>
<telerik:GridBoundColumn UniqueName="calls" DataField="calls" HeaderText="No of Calls" ReadOnly="True" HeaderStyle-Width="10%" ItemStyle-Width="10%" FilterControlWidth="75%" ItemStyle-HorizontalAlign="Right" FilterControlAltText="CLI filter column" > </telerik:GridBoundColumn>
<telerik:GridBoundColumn UniqueName="mindate" DataField="mindate" HeaderText="From Date" ReadOnly="True" dataformatstring="{0:dd/MM/yyyy}" HeaderStyle-Width="9%" ItemStyle-Width="9%" FilterControlWidth="75%" FilterControlAltText="CLI filter column" > </telerik:GridBoundColumn>
<telerik:GridBoundColumn UniqueName="maxdate" DataField="maxdate" HeaderText="To Date" ReadOnly="True" dataformatstring="{0:dd/MM/yyyy}" HeaderStyle-Width="9%" ItemStyle-Width="9%" FilterControlWidth="75%" FilterControlAltText="CLI filter column" > </telerik:GridBoundColumn>
<telerik:GridBoundColumn UniqueName="condate" DataField="condate" HeaderText="Connection Date" ReadOnly="True" dataformatstring="{0:dd/MM/yyyy}" HeaderStyle-Width="9%" ItemStyle-Width="9%" FilterControlWidth="75%" FilterControlAltText="CLI filter column" > </telerik:GridBoundColumn>
<telerik:GridBoundColumn UniqueName="dcondate" DataField="dcondate" HeaderText="Disconnection Date" ReadOnly="True" dataformatstring="{0:dd/MM/yyyy}" HeaderStyle-Width="9%" ItemStyle-Width="9%" FilterControlWidth="75%" FilterControlAltText="CLI filter column" > </telerik:GridBoundColumn>
<telerik:GridDateTimeColumn UniqueName="suggestedFix" DataField="suggestedFix" HeaderText="Suggested Fix Date" HeaderStyle-Width="20%" ItemStyle-Width="20%" FilterControlAltText="Account Filter column" FilterControlWidth="80%" ItemStyle-VerticalAlign="Top" ColumnEditorID="GridDateColumnEditor1" > </telerik:GridDateTimeColumn>
</Columns>

1 Answer, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 14 Nov 2014, 09:52 AM
Hi Mark,

You can try the approach below for achieving the required functionality:
protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
{
if (e.Item is GridEditableItem && (e.Item.IsInEditMode))
        {
            GridEditableItem editedItem = e.Item as GridEditableItem;
            RadDateTimePicker pckr=editedItem["suggestedFix"].Controls[0] as RadDateTimePicker;
            TextBox textBox = editedItem["Multiple"].Controls[0] as TextBox;
         if (textBox.Text == "Yes")
                {
                    pckr.Visible = false;
                }
 
           }
     
}



Regards,
Maria Ilieva
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Grid
Asked by
Mark
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
Share this question
or