Conditional Controls In Gridview Template Column

I have a Gridview which is editable. I want to be able to programatically present the control in the editable field i.e. Display a DropDownList or a custom control instead of a TextBox and this decision is to be made based upon a hidden field in the DataSource. Can this be done and if so how?
0
pattyboy
8/2/2006 10:39:14 AM
asp.net.presentation-controls 72751 articles. 3 followers. Follow

2 Replies
527 Views

Similar Articles

[PageSpeed] 3

It can certainly be done.

I suggest creating a user control with a TextBox and a DropDownList on it. Only one is made visible through a property of the user control, and both allow reading and writing to a second property (the editable field value). You can bind both properties in the GridView.

Jos

0
Jos
8/2/2006 12:58:19 PM
Could you shed more light on how to construct the user control?
0
pattyboy
8/3/2006 2:12:07 PM
Reply:

Similar Artilces:

remove a gridview column dynamically, removes controls in template columns
I have a interface with a treeview and a gridview. The gridview has two templatefields that handles insert/update/deletes. The gridview is handling editing of different tables so I create the other columns in the gridview dynamically as boundfields. The user selects the table to edit in the treeview. The problem I am having happens when the user selects a table to edit the second time. The code that executes removes all bound fields, (dynamically added when user selected the first table in the treeview), but not the two template fields, and then adds boundfields specifi...

How can I control the width of a column in the GridView control.
From searching I see mention of ways to do it before the controls are bound. Is there a simpler way? If not, could someone explain to me how I need to go about it?Here is the code: <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="id"        DataSourceID="SqlDataSource1" EmptyDataText="There are no data records to display."        OnSelectedIndexChanged="GridView1_SelectedIndexChanged">   &nbs...

gridview control in another gridview control
Hi ia have a questioni have a gridview control which contains button in one colum.now my question is i need another gridview to be placed in the  first gidviewso that when i click on the button the second gridview will populate the data.now my question is how to place second gridview in first gridview.or is there any approach like first grid itself acting as parent and child.please help me  Hi sirikalavalapalli:                I think nested gridview will help you. Check this link and it will show you how...

Template column control for gridview
 Hi, I'm trying to create a web server control to use as a template column in a gridview, i want to use the data binded in the gridview as source, so far i haven't been able to do it. Anybody can get me an example of how to do this, or point me the classes i should extend, interfaces i should implement.  Regards,LFonseca  HiWhat exactly you want? HaresHClick here to Visite My SiteIf you want to be successful, be shamelessIf this will not help you out from your problem then please do not Mark As Answer Hi, Lfonseca:You can achieve this by define your ...

Issue with Template Columns & Bound Columns while updating the data in a GridView control
Hi, I'm facing the below problem (In general, ObjectDataSource is driving me crazy ! ) I have a simple gridview control and an ObjectDataSource is used to populate the grid. I'm trying to update a row and the corresponding tableadapter methods & stored procedure are in place. Each row has 2 checkboxes and 2 textboxes in edit mode. When the change the values in edit mode and hit update, the checkbox values changed are saved into the Database properly, whereas the textbox values are not being saved. If the textbox column is a bound column then the column is updated with <NULL> in...

Getting the control id of a control inside gridview control
 uhmm.. a little bit confusing regarding my subject because i dont know how to say it...by the way my problem is how can i get the id of a control (e.g. textbox) inside the gridview... and the textbox is in the templatefield... is there any way i can get its id??  hoping i could get a reply as soon as possible... Regards,MhaeyPlease remember to click “Mark as Answer” on the post that helps you.. =) What do you want's to do by getting the id of the Text box? Do you want's to find particular Textbox with certain id ? Kamran ShahidSr. Software Engineer(MCP,MCAD.net,MC...

How to add values to template control fields textbox control in GridView..
Hi all,    <asp:GridView ID="GridView1" EnableViewState="true" DataKeyNames="LicenseTemplateID"                       runat="server" AutoGenerateColumns="False" OnSelectedIndexChanged="GridView1_SelectedIndexChanged"                       Width="345px">                       <Columns>                           <asp:Templa...

Setting UpdatePanel Trigger control ID to GridView template control
I have a linkbutton control inside a template column of a gridview control. I'm trying to use that as a trigger to update an updatepanel control on the page, however atlas can't find the control by the simple ID "linkButton1". Is there a syntax that will allow me to specify the LinkButton control inside the gridview column template? I don't think you can setup your trigger that listens for the linkButton itself because when the grid is rendered each linkbutton on each row will be given a unique ID by .NET.  For example, if in the template definition you...

How to use WebPartZone control in gridview control's template?
I Need Your Help To Solve The Following Problem.Thanks. I want to use WebPartZone control (NOT ATLAS) like this:         <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False">            <Columns>                <asp:TemplateField HeaderText="templatecol">                    <ItemT...

Help Req: !!! :- On Disabling Controls Present inside a Gridview control
Hi All, We have A requirement Where we have disable controls inside a grid.These controls can be textbox, DropDownlist (in TemplateField), ComandField present inside the grid.We have to call a generic method for doing the same .(since it can be done for multiple grid.) PFB the code snippet we use. Which disables all the controls inside the page.The bolded part of the code is used to loop inside a grid view.(Not Working.)Is this ideal way to deal with the requirement.Or can someone suggest be a better way.        public void DisableMe(Page p1, st...

Gridview control embedded in another gridview control
I am writing an ambulance crew scheduling application on the web and I need some help completing the last part.  I have an access database that has three tables: user table, shift table (describing the shifts available), and a schedule table (that stores shift by shift_id and user by user_id).  I have a gridview control that will display the available shifts but I cannot get the embedded gridview control that will display the user that is signed up for each shift to display because I cannot figure out how to use the OnRowDataBound method.  I need a simple VB example of how to...

how can i place control in GridView Template column
hi i am facing problem placing contrlo on appropriate postion when i placing any web contol in template column it draged up  to header of the GridView can anybody give solution  to this problem thnaks Place it inside the Column tag. <code> <Columns>   <asp:TemplateField>      <ItemTemplate>         [Control here]      </ItemTemplate>   </asp:TemplateField></Columns> </code>Ryan OlshanASPI...

Template column control not Visible in all Gridview rows
I got something odd here.  there is too much code to post, but I have a Template column in a GridView (created in design mode) with a RadioButtonList as the control in that column.  But RadioButtonList does NOT exist in all rows!!!  It shows in some rows.  I am not tinkering with the Visible property.  Oddly enough though, the rows it doesn't show in are the rows with partial data (some dataitems are emptystrings).  But that deosn't make any sense to me.  Anybody seen this before?    jP  I believe you need an e...

Dynamically create controls in GridView template column
Hi,this is my first post so please be nice :)I have a situation where I'm loading GridView from XML data source and I need to dynamically create a TABLE control inside grids template column.One of table's columns has an editable TextBox, so there could be unknown number of rows in a gridview and unknown number of rows in each table.At the moment I'm creating those tables inside  GridView_RowDataBound event and all works fine.Problem is that when user clicks in "Update" button table controls are gone because they are dynamically created.My question is how can I crea...

Web resources about - Conditional Controls In Gridview Template Column - asp.net.presentation-controls

Conditional - Wikipedia, the free encyclopedia
Text is available under the Creative Commons Attribution-ShareAlike License ;additional terms may apply. By using this site, you agree to the ...

English grammar tenses Test & Use incl. going to, passive voice, time clauses, conditional, if clauses ...
Get English grammar tenses Test & Use incl. going to, passive voice, time clauses, conditional, if clauses, indirect speech on the App Store. ...

All sizes - The Portrait of Conditional Probability, With A Third Ear - Flickr - Photo Sharing!
Flickr is almost certainly the best online photo management and sharing application in the world. Show off your favorite photos and videos to ...

Yemen government tells UN it agrees to conditional truce
Yemen's government told the UN on Wednesday it would agree to a truce to end more than three months of fighting provided key &quot;guarantees&quot; ...

Weekend Economist: Conditional confidence
The uneven nature of economic growth and volatile investment spending pose serious questions for emerging economic optimism.

Jay Weatherill breaks ranks with conditional backing of 15% GST
South Australia has broken ranks with other Labor states and come out in favour of a 15 per cent goods and services tax, with conditions.

NRL accused of double standards as Balmain Leagues Club gets conditional reprieve
A Balmain Leagues Club director has accused the NRL of double standards after it bailed St George Illawarra out of financial trouble without ...

Liverpool Plains: Barnaby Joyce slams Government's conditional approval for new NSW coal mine
The Federal Agriculture Minister hits out at the Government's decision to give conditional approval for a huge open-cut coal mine near prime ...

Molly's former owner gets 3 month conditional jail term for animal cruelty
... owner of a two-year-old shepherd-cross dog, found emaciated and near death near Port Hardy last November, has received a three month conditional ...

Conditional discharge for census resister, 79, found guilty of violating Statistics Act
A 79-year-old Toronto woman has been handed a conditional discharge after being found guilty of violating the Statistics Act for refusing to ...

Resources last updated: 12/28/2015 1:05:21 AM