in a grid how to find a particular column is bound column or template column

hi,

 Any one know how to find a particular column is bound column or template column or button column,etc in a grid

Advance thanks

 

0
sathis_asp
1/19/2009 8:20:39 AM
asp.net.presentation-controls 72751 articles. 3 followers. Follow

6 Replies
728 Views

Similar Articles

[PageSpeed] 3

hi...

use this

dim label1 as Label=ctype(GridView1.FindControl("name"),Label)

 Hope This Helps


Bhaarat

Remember to click "Mark as Answer" on the post that helps U

My Blog
0
Bhaarat
1/19/2009 8:39:26 AM

find a particular column is bound column or template column no to find that particular column

0
sathis_asp
1/19/2009 8:47:02 AM

 Hi,

please excuse me if iam wrong.

i found that bount columns values are directly renders to a <td>  where template columns create some controls inside the cell.

so you can check whether that cells[1].controls.count > 0 then it may be a template field.

 

correct me if iam wrong


Sincerely,
MOONCODER

Please remember to click Mark as Answer on the post that helps you, and to click Unmark as Answer if a marked post does not actually answer your question.
0
mooncoder
1/19/2009 9:00:53 AM

ok...

i got now... it was my misunderstanding

use this

GrvDetail.Columns(1).GetType.ToString() 

to retrive its type...

Hope this helps 


Bhaarat

Remember to click "Mark as Answer" on the post that helps U

My Blog
0
Bhaarat
1/19/2009 9:04:56 AM

Its never good to rely on undocumented details. If we decide to change an implementation detail in the next version then you app will break. What are you really trying to do?


David Fowler
SDE, ASP.NET Team, Microsoft
0
davidfowl
1/19/2009 9:41:26 AM

Thank You Bhaarat

0
sathis_asp
1/19/2009 10:32:54 AM
Reply:

Similar Artilces:

When is a column not a column?
I have several extremely similar datawindows that I have to maintain that go against the same table. Recently, I had to add a column to that table, and also add the column to ALL of these datawindows that go against this table. I added the column to the first datawindow, set up the edit control style, etc. I then did a copy/paste of the columns edit control to the remaining dw's (of course remembering to first add the column in SQL). Everything (update props, column specs, column props) seems to indicate that the pasted column is linked to the column I selected, HOWEVER, when I...

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...

Bound columns and template columns in Gridview
Hello Everyone, In my gridview, I changed some of the bound columns to template columns, I noticed that the template column is not recognized inside the RowDataBound event method. The reason I changed the bound columns to template columns so that I can add the total column in the footer. I guess I cannot do that with bound columns. If I do e.Row.Cells[5].Text then  5th column is not recognixed inside the Rowdatabound event, but If i do e.Row.Cells[4].Text then  it is recognized. Please let me know what am I doing wrong. <asp:GridView ID="dgAgentActivity" runat="server" AutoGen...

converting Bound Column to Template Column
Hi All, I wanted to convert the bound column in the grid to Template column. How could I do this dynamically? I know it can be done using the edit column dialog box, but I need to do that in the code behind. waiting for your reply. Thanks, regards,   Hi Techwork, Not tested and incomplete but just to get you going: Iterate the Columns property and find the BoundField with:Columns[i].GetType().Name == "BoundField" and((BoundField)Columns[i]).DataField == ... Remove this BoundField from the Columns Collection with:Columns.RemoveAt(i); Create a new TemplateField insta...

IF you set column to width 0 in a datawindow grid, the column appear as a with column at the end of the grid
Can you remove the white space at the end of a grid, it seems to appear when we set columnwidths to '0'.. ICE I've not seen that. What version of PB are you using? What platform? On Tue, 27 Aug 2002 11:42:02 +0200, in powersoft.public.powerbuilder.datawindow ICE <ICE@nospam.com> wrote: >Can you remove the white space at the end of a grid, it seems to appear when >we set columnwidths to '0'.. > > >ICE > > Bruce Armstrong [TeamSybase] http://www.teamsybase.com Not 1 - but 2 new books on developing with PowerBuilder...

Setting Datagrid Column to invisible when Column is an AutoGeneratedColumn NOT a bound Column
Hi all, Just like the title says, I'm trying to set a column to invisible but I'm unable to do so. If I bound the column I can used the code: me.datagrid.Column.Item(1).Visible = False But since I'm wanting the column NOT to be bound (there are a number of sql scripts that populate the same datagrid so I cannot bound all the columns since the columns are different for each script etc etc etc) how do I set an AutoGeneratedColumn to invisible?? Please help! Andrewwww.codingmayhem.com - VB.NET, C#, Silverlight, Javascript, HTML, CSS, T-SQL, MySQL and SQLitewww.headshot...

DataGrid: Bound Column vs Template Column
I have a datagrid with a bound column and a template column as given below.When I scan through the grid, I get the value of the first column (bound column). However, I cannot get the value of the second column (Template Column). I can see the data in both columns though.////////////////////////////////////////////////////////////////////////////////////<AlternatingItemStyle BackColor="#e0e0e0"></AlternatingItemStyle><Columns><asp:BoundColumn DataField="Facility" HeaderText="Facility"> </asp:BoundColumn><asp:TemplateColumn HeaderText="Facility2"><ItemSty...

Problem: Template Column Converts To ( Bound ?) Column On PostBack
I have a template column in a datagrid and I have a button that allows the user to copy data from the second column into the template column, though when the user hits this button the template column converts to a bound column (or what appears to be a bound column). Any ideas how to resolve, thanks. Is there a different function for updating a template column ?For copying data form a bound column into a template column I am using this function:foreach(DataGridItem dgi in DataGrid1.Items){dgi.Cells[3].Text = dgi.Cells[4].Text;}...

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...

Dynamic change the 'Read Only' in datagrid(template column/Bound column)
I create few template column and bound column in datagrid. One of the template column contain the StudentMark. I want to know how to change that column to (Read only) or "Not" (Read only) when click the edit button. It is based on a dropdownlist to determine to read only or not. I think i must use the template column, since i need to do the validation to the StudentMark. (For example, If select value '1' in dropdownlist, the "StudentMark" is become 'Read only' and select '2' become vice versa. I was success to bind the datagrid and "StudentMark" become a textbox...

Writing a column after column
Hi all, I need to consolidate columns of data available across different directories into a single excel csv file. Usually we write to a file row after row but for the current task I have, it would be convenient to write the file column after column. Is there a file writing mode for this? If not, I guess, I will have to write the matrix row by row and then take a transpose. Let me know what you guys think and if you could share some skeleton of code for something like this would be great. Thanks. -vijay vijay wrote: > I need to consolidate columns of data available acro...

Datagrid Bound Column needs to be bound to 2 columns?a valu
Hi I have a datagrid with dynamically bounded columns. One column has to display a value that will come from 2 columns in the database. Is there a way to do this? the code I have for the moment is: 'Add columns 'Code Dim col1 As New BoundColumn col1.HeaderText = cLang.read("code") col1.DataField = "Patient_Code" 'this needs to be 2 database columns!! dtaSearchresult.Columns.Add(col1) .. .. .. .. Thx alot! Combine the two columns in your SELECT statement eg SELECT <PatientCol1>+<PatientCol2> AS Patient_Code FR...

validation columns against column
Hi  Do anybody know some articles or codeexample of how to validate columns against a input Column. B can be > A and B can be < C. If you in row ID write 55 for Column_B, it must be reject.example:ID        column_A  Column_B   Column_C1              3               10             152         &...

How to order columns in datagrid with template columns
I have a datagrid with two template columns that appear in positions 0  and 1  on my datagrid.  How can I move these template columns to other postions?   -smc~ Remember To Mark The Posts Which Helped You As The ANSWER ~  Change to source view, look for the <asp: ..... </asp:....> within the <Columns> .... </Columns> and, cut and paste into the required position. <Columns>  <asp:BoundField DataField="Id" HeaderText="Id" ReadOnly="True"  SortExpression="Id" >    <I...

Web resources about - in a grid how to find a particular column is bound column or template column - asp.net.presentation-controls

Bill Cosby Criminal Complaint: Read Probable Cause And Statement Filed By Andrea Constand
Bill Cosby was arrested and charged on Dec. 30, 2015, and we have the criminal complaint for you to read. Filed by Andrea Constand in 2005, the ...

Los Angeles Saw a Huge Crime Increase in 2015. Or Did It?
You want to talk about cities that have seen an increase in crime? Ladies and gentlemen, I give you Los Angeles: Violent crime in L.A. climbed ...

First ‘Bourne 5’ Image and New Plot Details Revealed: Jason Bourne Is “in a Dark and Tortured Place”
America sure has spent a lot of money trying to save Matt Damon over the years, but thankfully his next role, Jason Bourne, is a more self-reliant ...

Kim Kardashian Doesn't Believe in New Year's Resolutions, But Does Set Goals for Herself!
Kim Kardashian wrote a blog post on her new app/website to explain that she doesn’t believe in New Year’s resolutions. “To be honest, I’m not ...

Postal Service Releasing ‘Star Trek’ Stamps
The U.S. Postal Service will boldly go where it’s gone only once before. The agency will debut a quartet of “Star Trek” stamps honoring the original ...

Allegiant Air Flight Makes Emergency Landing in Tennessee
Allegiant Air flight makes emergency landing at Tennessee airport; no injuries

AT&T’s Voice over LTE can now reach other cellular carriers
In select markets, AT&T subscribers should now be able to place voice over LTE (VoLTE) calls to people on other carrier networks, according to ...

California Shooter's Friend Indicted on Gun, Terror Charges
Indictment of man tied to California shooters alleges weapons deception, terror conspiracy

Record flooding shuts down I-55 near St. Louis
Chicago Tribune Record flooding shuts down I-55 near St. Louis Chicago Tribune An unusual outbreak of December tornadoes and other violent ...

Iran’s Missile Test Angers US; Will Oil Prices Get Some Relief?
Bidness Etc provides a snapshot of the possible impact of the Iranian missile test on crude oil prices, and the United States Oil Fund LP (ETF) ...

Resources last updated: 12/31/2015 6:28:11 PM