Ask a Question related to ASP.NET Data Grid Control, Design and Development.
-
Anamika #1
Edit Datagrid - show textbox and dropdown
Hi All,
I have a problem trying to edit the data in a datagrid control.
I have 2 bound columns in the datagrid. I have added the following
code inorder to edit the data. I want it such that certain rows of
data when edited will bring the textbox control while certain other
rows will bring a dropdownlist from where i can select a value.
is it possible to do that in the SAME template column?
Any help will be much appreciated.
Thanks,
Anamika
----
<Columns>
<asp:EditCommandColumn
ButtonType="LinkButton"
UpdateText="Update"
CancelText="Cancel"
EditText="Edit"
ItemStyle-HorizontalAlign="Center"
HeaderText="Edit">
</asp:EditCommandColumn>
<asp:BoundColumn DataField="Header" HeaderText="Application
Field"></asp:BoundColumn>
<asp:BoundColumn DataField="Value" HeaderText="Field
Value"></asp:BoundColumn>
</Columns>
Anamika Guest
-
select to show a dropdown list
I would like to present some options to a user and when one of these options is selected a dropdown list would than be presented from which the user... -
DataGrid Edit TextBox
Hi NG. I'm having trouble controling the size of the textboxes that appear when the user clicks the "edit" button for a row in my datagrid. I... -
Set the width of the edit textbox after clicking on Edit link in datagrid...
Hi There, I have a data grid where I have a couple of columns as follows: ----------------------------------------- |id | textual... -
TextBox and DropDown in a Datagrid ItemTemplate
Hi All, I need help to solve this scenario. I have 2 columns on a datagrid. Column1 Header is NAME Column2 Header is VALUE. The VALUE column... -
Edit Mode - How do I populate dropdown in edittemplate from dropdown in another column?
I have a datagrid with 2 columns that I want to interact when I'm in Edit Mode. I've reproduced just the columns I want to interact below. I can... -
Scott Mitchell [MVP] #2
Re: Edit Datagrid - show textbox and dropdown
Anamika wrote:
It is possible, yes. First, you'd have to use a TemplateColumn instead> Hi All,
> I have a problem trying to edit the data in a datagrid control.
> I have 2 bound columns in the datagrid. I have added the following
> code inorder to edit the data. I want it such that certain rows of
> data when edited will bring the textbox control while certain other
> rows will bring a dropdownlist from where i can select a value.
>
> is it possible to do that in the SAME template column?
> Any help will be much appreciated.
of a BoundColumn. To customize the editing interface, you need to use a
TemplateColumn, as discussed in this article:
[url]http://aspnet.4guysfromrolla.com/articles/080702-1.aspx[/url]
Now, I assume you have some databound field that determines whether or
not a TextBox should be shown or a DropDownList. In the simplest case,
you could just toggle the Visible property based on this value.
Something like (untested):
<asp:TemplateColumn>
<ItemTemplate>
<asp:TextBox ... Visible='<%#
Convert.ToBoolean(DataBinder.Eval(Container.DataIt em, "ShowTextBox"))
%>' ... />
<asp:DropDownList ... Visible='<%# Not
Convert.ToBoolean(DataBinder.Eval(Container.DataIt em, "ShowTextBox"))
%>' ... />
</ItemTemplate>
</asp:TemplateColumn>
This assumes that the ShowTextBox database field is a Boolean and
indicates whether a TextBox should be shown (True) or a DropDownList
(False).
hth
--
Scott Mitchell
[email]mitchell@4guysfromrolla.com[/email]
[url]http://www.4GuysFromRolla.com[/url]
[url]http://www.ASPFAQs.com[/url]
[url]http://www.ASPMessageboard.com[/url]
* When you think ASP, think 4GuysFromRolla.com!
Scott Mitchell [MVP] Guest
-
Anamika #3
Re: Edit Datagrid - show textbox and dropdown
Hi Scott,
Thanks for the response. I went through your site before posting here.
I'll try toggling the controls during runtime like you suggested.
Thanks,
Anamika
Anamika Guest



Reply With Quote

