Autogenerated Columns

  • Thread starter Thread starter Binny
  • Start date Start date
B

Binny

I have a DG with autogenerated columns.
can i make a columns readonly like the data key column.
when edititemindex is valid.
Thanks
 
In the <asp:boundcolumn> tag, put readonly="True"

Eg.

<asp:boundcolumn datafieldid="ID" headertext="ID" readonly="True" />

Hope this helps,

Mun
 
You can still use this tag. It will override the autogenerated column. The
rest of the columns will still be automatically generated.

Eg.

<asp:datagrid id="DataGrid1" runat="server" width="100%" cellpadding="2"
autogeneratecolumns="True">
<columns>
<asp:boundcolumn datafield="ID" headertext="ID" readonly="True"/>
</columns>
</asp:datagrid>

Regards,

Mun
 
Thanks. But i see the duplicate columns. since they are
autogenerated also. Is there a way i can avoid this.?
thanks
 
I've tried a few things, and there doesn't seem to be a way to do this. If
you want to make a column readonly, you have to define each column to be
bound using the <asp:boundcolumn> tag, and set the readonly attribute to
true for the column you want to be readonly.

Regards,

Mun
 
Thanks for helping.
Finally,i figured out. To make this happen
we have to make the textboxes in the corresponding column
as read-only.
Thanks
 
Did you still use the autogenerate feature when doing this?

If possible, post code please. I'm interested to see how you done that.

Cheers,

Mun
 
Back
Top