473,383 Members | 1,853 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

GridView custom column display.

Hello.
It was very easy to display the contents of a table in a database using
the GridView. But I wonder if this is possible. The field 'e-mail'
contains original e-mail addresses, but for security reason, I would
like to omit some part of them. For example,

Original field data : so*****@microsoft.com
Displayed in GridView : some...@microsoft.com (replace 3 characters
left side of @)

If I use the old way (manually querying and outputting using
<table>...) it will take some time but not a hard job. I just want to
know wheter I can do this with GridView or not. Please let me know if
you have any idea. Thank you.

Feb 6 '06 #1
2 1498
As wating for a nice reply, I tried to solve it myself.
protected void GridView1_RowDataBound(object sender,
GridViewRowEventArgs e)
{
if (e.Row.Cells.Count > 1)
{
StringBuilder temp=new StringBuilder(e.Row.Cells[1].Text);
int whereisat = e.Row.Cells[1].Text.IndexOf("@")-1;
for(int i=0; i<3; i++)
{
if (whereisat < 1)
break;
temp[whereisat - i] = '.';
}
e.Row.Cells[1].Text = temp.ToString();
}
}
where Cells[1] is the e-mail field. It worked as I expected but is
there any better way to do this job?

ty*******@gmail.com wrote:
Hello.
It was very easy to display the contents of a table in a database using
the GridView. But I wonder if this is possible. The field 'e-mail'
contains original e-mail addresses, but for security reason, I would
like to omit some part of them. For example,

Original field data : so*****@microsoft.com
Displayed in GridView : some...@microsoft.com (replace 3 characters
left side of @)

If I use the old way (manually querying and outputting using
<table>...) it will take some time but not a hard job. I just want to
know wheter I can do this with GridView or not. Please let me know if
you have any idea. Thank you.


Feb 6 '06 #2
This is one of the correct ways.

Eliyahu

<ty*******@gmail.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
As wating for a nice reply, I tried to solve it myself.
protected void GridView1_RowDataBound(object sender,
GridViewRowEventArgs e)
{
if (e.Row.Cells.Count > 1)
{
StringBuilder temp=new StringBuilder(e.Row.Cells[1].Text);
int whereisat = e.Row.Cells[1].Text.IndexOf("@")-1;
for(int i=0; i<3; i++)
{
if (whereisat < 1)
break;
temp[whereisat - i] = '.';
}
e.Row.Cells[1].Text = temp.ToString();
}
}
where Cells[1] is the e-mail field. It worked as I expected but is
there any better way to do this job?

ty*******@gmail.com wrote:
Hello.
It was very easy to display the contents of a table in a database using
the GridView. But I wonder if this is possible. The field 'e-mail'
contains original e-mail addresses, but for security reason, I would
like to omit some part of them. For example,

Original field data : so*****@microsoft.com
Displayed in GridView : some...@microsoft.com (replace 3 characters
left side of @)

If I use the old way (manually querying and outputting using
<table>...) it will take some time but not a hard job. I just want to
know wheter I can do this with GridView or not. Please let me know if
you have any idea. Thank you.

Feb 6 '06 #3

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

Similar topics

3
by: washoetech | last post by:
I have a gridview control. In this grid view there is a column for the price of an item. Some of the prices have a dollar sign in front of it and some dont. How do I get rid of the dollar sign...
8
by: Mike Kelly | last post by:
I've chosen to implement the "optimistic concurrency" model in my application. To assist in that, I've added a ROWVERSION (TIMESTAMP) column to my main tables. I read the value of the column in my...
3
by: NateDawg | last post by:
I'm reposting this. I'm kinda in a bind untill i get this figured out, so if anyone has some input it would sure help me out. Ok, I’ve noticed a few gridview problems floating around the forum....
7
by: | last post by:
Hello, Does anyone have an idea on how I can filter the data in the gridview control that was returned by an sql query? I have a gridview that works fine when I populate it with data. Now I...
5
by: sutphinwb | last post by:
Hi - This could be a simple question. When I relate two tables in a datasetet, how do I get that relation to show up in a GridView? The only way I've done it, is to create a separate table in the...
1
by: =?Utf-8?B?UGF0cmljayBG?= | last post by:
I have a gridview on the page that i want to dynamically populate with radiobuttons, so i went out on the net and found something that works perfectly, it created radionuttons and the postback with...
4
by: Mark Olbert | last post by:
I'm running into a well-described issue in the ASPNET model that I haven't found a good work around for. I have a GridView to which I dynamically add data-bound TemplateFields at run-time. The...
1
by: savajx1 | last post by:
I need to dynamically create a set of bound fields contained in a GridView control. I also have a single static CommandField that I can declare in the Columns <tagof the GridView control. I have...
0
by: tim85 | last post by:
Hello, I am trying to extend the System.Web.UI.WebControls.BoundField class to create a custom GridView / DetailsView column that will render other controls, for example a Calendar or a...
2
by: gnewsgroup | last post by:
I have a GridView, in which the header of one column changes depending on the selected value of a DropDownList outside of this GridView. I did this dynamic header through protected void...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

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.