Autogenerated Columns

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
 
M

Munsifali Rashid

In the <asp:boundcolumn> tag, put readonly="True"

Eg.

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

Hope this helps,

Mun
 
M

Munsifali Rashid

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
 
B

Binny

Thanks. But i see the duplicate columns. since they are
autogenerated also. Is there a way i can avoid this.?
thanks
 
M

Munsifali Rashid

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
 
B

Binny

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
 
M

Munsifali Rashid

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top