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

radGridView

5 Answers 103 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Rajani
Top achievements
Rank 1
Rajani asked on 29 Sep 2008, 11:36 AM
How do I display TextBox for each Row in Grid. This should be displayed in editable column and look and feel should be same TextBox.




5 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 1
answered on 29 Sep 2008, 12:45 PM
Hello Rajani,

From what I understood, I suppose you want to display a TextBox for a column in EditMode of the grid. If this is the case, you just have to drop a TextBox control in the EditItemTemplate of a TemplateColumn as shown below.
aspx:
 <telerik:GridTemplateColumn UniqueName="Column1" HeaderText="TemplateColumn"
      <ItemTemplate> 
         <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>                
      </ItemTemplate>             
      <EditItemTemplate> 
         <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>                 
      </EditItemTemplate> 
 </telerik:GridTemplateColumn> 

Thanks
Princy.
0
Rajani
Top achievements
Rank 1
answered on 29 Sep 2008, 12:57 PM
Thanks for reply.
But I want the same in Winforms.
It should display as many textbox as No. of rows are there.
0
Nick
Telerik team
answered on 30 Sep 2008, 11:05 AM
Hi Rajani,

Please refer to the following article of our documentation. If you assign a datasource, the grid will generate automatically a textbox for each appropriate column.

Best regards,
Nick
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Rajani
Top achievements
Rank 1
answered on 30 Sep 2008, 11:59 AM
Thanks..
 
  But it is not giving the look and feel same as TextBox.
  When user clicks on particular cell, it is displaying editable Cell.
  By just seeing, user cant know that it is editable field. and also it is nt having border like normal textbox. throught screen shot u'll easily understand.
0
Nikolay
Telerik team
answered on 02 Oct 2008, 07:33 PM

Hi Rajani,

I have prepared a sample project which demonstrates how to show a RadTextBox for each cell in a particular column. The approach shows how to:

  1. Create your own GridDataCellElement descending from the GridDataCellElement class.
  2. Set this custom type to the CellType property in the CreateCell event handler.
  3. Subscribe to the CellFormatting event, where the Text of the currently formatted cell's RadTextBox should be set.

Please note that this is not out-of-the-box feature, but a workaround. Therefore, you will experience undesired behavior concerning the focus of the cells - i.e. the first time when you try to write in a RadTextBox, RadGridView will take the focus and will open the first editor of the current row. In addition, when you type text in a RadTextBox, the row in which the RadTextBox appears will not become the current one.
You can avoid getting the focus from the RadTextBox by setting RadGridView.ReadOnly to true. However, you will not be able to open any type of RadGridView editors at will.

Regards,

Nikolay
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
GridView
Asked by
Rajani
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 1
Rajani
Top achievements
Rank 1
Nick
Telerik team
Nikolay
Telerik team
Share this question
or