EditCommandColumn makes my textboxes too big

M

MIGUEL?N.

Hi all,

I've added an EditCommandColumn to my dinamically created Datagrid.
All works pretty well, events fire in the correct way and so on. My
problem is when I click the "Edit" link: All row is made editable for
me, but the textboxes are enormous, too big. As a consequence of those
strange textboxes, the columns are also bigger in width and finally at
the bottom of my page appears the horizontal scroll, which I must
avoid.

What's the solution for customizing this Edition Mode? I've tried with
"EditItemStyle", applying a style to this edition mode, but there is
no way of achieving the desired result.

I've heard about TemplateColumns but I'm quite newbie to them.

Can someone give me a solution to make this textboxes smaller and not
to show the horizontal scroll? Or can someone advise me about
Templatecolumns (If I should use them in this particular case)?

Thanks in advance.
 
S

Scott M.

The solution is NOT to have the columns generated for you dynamically and to
create them yourself at design-time.

Uncheck the "Create Columns Automatically At Run Time" checkbox in the
DataGrid's Property Builder

Add a Bound Column and indicate the field name to bind it to (do this for
each column in your grid).

Go back through those bound columns and click the hyperlink at the bottom of
the dialog box to convert the column to a Template Column.

You will now be able to right-click your grid and choose Edit Templates and
pick the column to work on. You will have access to control that is being
used for edit mode and be able to change it as usual.
 
M

MIGUEL?N.

I've realised you haven't understood my post at all. I MUST CREATE THE
GRID DINAMICALLY, SO I MUST ADD ALL COLUMS BY CODE. The problem is
that adding TemplateColumns by code is quite embarrasing, bacuse you
must implement ITemplate and override a method called InstantiateIn.

After deciding myself for using TemplateColumns, I'm asking all you
about the easiest way for adding TemplateColumns (with textboxes,
links, labels, etc.) to a DataGrid.

I've tried implementing ITemplate, nevertheless I found it quite
difficult.

Thanks.
 
S

Scott M.

Easy now Miguel! You asked about template columns and I gave you the
design-time answer. You never said anything in your OP about needing to
create the columns in code.
 

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

Similar Threads


Members online

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,144
Latest member
KetoBaseReviews
Top