473,654 Members | 3,068 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem using GridView1.Colum ns.Insert(2, nameColumn);

It seems when I use GridView1.Colum ns.Insert(2, nameColumn); to
dynamically insert a column into a grid I loose all items that are
bound using

<asp:TemplateFi eld HeaderText="E-Mail" >
<ItemTemplate >
<a href='mailto:<% # Eval("email")%> '
target="new"><a sp:Label ID="email" runat="server" Text='<%#
Bind("email")%> '></asp:Label></a>

</ItemTemplate>
<ItemStyle Wrap="true" />
</asp:TemplateFie ld>

Here is my scenerio I have an if statement that checks a criteria. if
it matches I want that column in the table.....

I can use the GridView1.Colum ns.Add(nameColu mn); and all the fields
work fine but the added field is in not in the position that I
want......

any suggestions?

Oct 4 '06 #1
1 3402
I think I may have found something that works.... I have eliminated the
use of the templatefield and have made it a bounddield

this seems to work with the GridView1.Colum ns.Insert(2, nameColumn);

<asp:BoundFie ld DataField="emai l" HeaderText="E-mail"
SortExpression= "email" DataFormatStrin g="<a
href=&quot;mail to:{0}&quot;&gt ;{0}</a>" />

Chicagoboy27 wrote:
It seems when I use GridView1.Colum ns.Insert(2, nameColumn); to
dynamically insert a column into a grid I loose all items that are
bound using

<asp:TemplateFi eld HeaderText="E-Mail" >
<ItemTemplate >
<a href='mailto:<% # Eval("email")%> '
target="new"><a sp:Label ID="email" runat="server" Text='<%#
Bind("email")%> '></asp:Label></a>

</ItemTemplate>
<ItemStyle Wrap="true" />
</asp:TemplateFie ld>

Here is my scenerio I have an if statement that checks a criteria. if
it matches I want that column in the table.....

I can use the GridView1.Colum ns.Add(nameColu mn); and all the fields
work fine but the added field is in not in the position that I
want......

any suggestions?
Oct 4 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
1544
by: Scott Meddows | last post by:
I have a datagrid control that I've inherited from the base datagrid control (Source below). I am applying a datatable style onto the datatable that I assign as my datasource. All of my column but one are set as readonly=true. The writeable column does not update when I'm editing it. Is there something different that I need to be doing to update this data? Also, how do I get the "new row" to not appear at the bottom of the datagrid?...
1
9416
by: Chicagoboy27 | last post by:
I have dynamically bound a field to a gridview using the follwoing code: BoundField nameColumn = new BoundField(); nameColumn.DataField = "territory"; nameColumn.HeaderText = "Terr Num"; nameColumn.SortExpression = "territory"; //appends the column at the end
3
4358
by: rn5a | last post by:
A SqlDataReader is populated with the records from a SQL Server 2005 DB table. The records retrieved depends upon 2 conditions (the conditions depend on what a user selects in an ASPX page). If condition1 is true, then the SqlDataReader will be populated with the records existing in table1 & will return 0 to the calling function but if condition2 is true, then the SqlDataReader will be populated with the records from another table named...
0
960
by: sathyan8294 | last post by:
i am using dotnet 2003.i am doing my project in vb.net windows application.i have two form in my project.first form is datagrid .In second form label and textboxes are avilable to save the entering values in datagrid of first form through this 2nd form.my problem is,if i select the row or record and click edit menu means,want to display the values of that selected row in textboxes of second form. for example, in first form, there are 4...
1
6762
by: sathyan8294 | last post by:
i am using dotnet 2003.i am doing my project in vb.net windows application.i have two form in my project.first form is datagrid .In second form label,textboxes and combobox are avilable to save the entering values in datagrid of first form through this 2nd form.my problem is,i want to search a value using combobox. for example, in first form, there are 4 columns named as name,age,rollno,address in datagrid. values are ramu for namecolumn,24...
5
3745
by: =?Utf-8?B?SnVsaWEgQg==?= | last post by:
Hi, I wonder if anyone can help? I've got a web form (intranet), .net version 1.1. I've got a sub that populates a datatable in a dataset, dependent on a dropdown field selection. This works great, but if the user selects another item from the dropdown field and the sub runs again, the original data is overwritten. How do I store the original data and add the new datarow without overwriting the original? Here's my code: Protected...
0
8372
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8706
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8591
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7304
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6160
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5621
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4149
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2709
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1592
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.