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

GridBoundColumn Visible="false"

4 Answers 267 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Kjell
Top achievements
Rank 1
Kjell asked on 19 Feb 2013, 07:49 PM

I set GridBoundColumn DataField="id" Visible="false" and have <MasterTableView EditMode="PopUp">

When i click on edit the PopUp dialog display textfield with the id?
The update still works fine.....

I set GridBoundColumn ReadOnly="True" and now the id textfield is lost.
But now when i try update the PopUp form, it not work??

How to set the GridBoundColumn Visible="false" and not display it in the PopUp dialog?
Or have i missed something?

The DataField="id" is my update id.........

Protected Sub RadGrid1_UpdateCommand(ByVal source As Object, ByVal e As GridCommandEventArgs) Handles RadGrid1.UpdateCommand
    Dim editItem As GridEditableItem = TryCast(e.Item, GridEditableItem)
    Dim newValues As New Hashtable()
    e.Item.OwnerTableView.ExtractValuesFromItem(newValues, editItem)
    Dim UppdateId As String = newValues("id").ToString()

4 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 1
answered on 20 Feb 2013, 03:50 AM
Hi,

Try setting the Display property of the GridBoundColumn in ASPX to false and set the textbox visibility in ItemDataBound event as follows.

ASPX:
<telerik:GridBoundColumn DataField="OrderID" Display="false"></telerik:GridBoundColumn>

C#:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
{
    if (e.Item is GridEditableItem && e.Item.IsInEditMode)
    {
        GridEditableItem editItem = e.Item as GridEditableItem;
        TextBox txt = (TextBox)editItem["OrderID"].Controls[0];
        txt.Visible = false;
    }
}

Thanks,
Shinu.
0
Kjell
Top achievements
Rank 1
answered on 20 Feb 2013, 09:02 AM

Thanks, that works now.
But how delete the colon (:) i have where the id column was? Se the attached dump.....
And how align the Uppdatera and Avbryt to right?

And how align the popup dialog center/middle in the grid?

0
Shinu
Top achievements
Rank 1
answered on 21 Feb 2013, 04:58 AM
Hi,

In order to remove the ' : ' , set the 'EditFormHeaderTestFormat' property of bound column as empty string like below.

ASPX:
<telerik:GridBoundColumn DataField="OrderID" Display="false" UniqueName="OrderID" EditFormHeaderTextFormat="">
</telerik:GridBoundColumn>

To have a custom look for the RadGrid edit form ,you can set the EditFormType as Template and can create custom edit form. The following help article shows how to achieve that. Please let me know if you need more help on this.

Custom Edit Forms

And the following help article help you to make the edit form in center of RadGrid.

Center PopUp Edit Form in RadGrid

Thanks,
Shinu.
0
Carlin
Top achievements
Rank 1
answered on 30 May 2013, 03:19 PM
We found that using the visible=false could cause certain instances of the value to not be available in a postback or code-behind situation; switching to use display=false instead restored the data availability.
Tags
Grid
Asked by
Kjell
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 1
Kjell
Top achievements
Rank 1
Carlin
Top achievements
Rank 1
Share this question
or