Hi
on item data bound change your output as you want...
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.datagrid.itemd
atabound(VS.80).aspx
Best of luck
Munna
www.munna.shatkotha.com
Hi Mark,
For your scenario, since the string transforming logic is not that
simple(you need to format both the display string and the url string ), I
think you'd better write a helper function in codebehind and call this
function to perform transform in your databinding control.
Here is a test function I've written which accept an input string and
transform it to output html hyperlinks:
===========================
protected void Page_Load(object sender, EventArgs e)
{
string ret =parse_string("Earth.New Zealand.Auckland.Henderson.New
Account");
Response.Write("<br/>" + ret);
}
string parse_string(string input)
{
const string stmp = "<a
href='http://www.mysite.com/showgroups/?GroupName={1}'>{0}</a>";
string[] items1 = input.Split('.');
string[] items2 = new string[items1.Length];
for (int i = 0; i < items1.Length; ++i)
{
items2[i] =string.Join(".", items1, 0, i + 1);
}
StringBuilder sb = new StringBuilder();
sb.AppendFormat(stmp, items1[0], items2[0]);
for (int i = 1; i < items1.Length; ++i)
{
sb.Append("."); sb.AppendFormat(stmp, items1[i], items2[i]);
}
return sb.ToString();
}
=========================
You can call this funcction in your databinding control to format the
certain data field (string value).
Hope this helps.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg@microsoft.com.
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
>From: "Mark B" <none@none.com>
>Subject: 2 Datagrid columns questions
>Date: Thu, 29 May 2008 23:03:09 +1200
>I have a Datagrid working fine, outputting:
>
>Group
>Most Popular Product Code
>--------
>-------------------------------
>
[quoted text clipped - 41 lines]
>
>TIA