HOW TO ADD DYNAMICALY GRIDVIEW ROW IN HYPERLINK

Posted by Cnagasa under C# on 12/7/2011 | Points: 10 | Views : 3635 | Status : [Member] | Replies : 6
Hi friends,

HOW TO ADD DYNAMICALLY GRID VIEW ROW IN HYPERLINK in c# coding

sudarshan.c


Responses

Posted by: Blessyjees on: 12/7/2011 [Member] Bronze | Points: 25

Up
0
Down
Hi

When you add hyperlink in gridview? You can add hyperlink in rowbound event of the gridview.

Blessy Baby
Digitalmesh Softech pvt Ltd
https://blessybaby.wordpress.com/

Cnagasa, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Cnagasa on: 12/7/2011 [Member] Starter | Points: 25

Up
0
Down
thank for giving the reply

ViewState[COLUMN_COUNT_KEY] = myTable.Columns.Count;

gvTrackingReport.DataKeyNames = new string[] { myTable.Columns[myTable.Columns.Count - 1].ColumnName };
gvTrackingReport.Columns.Clear();
for (int i = 0; i < myTable.Columns.Count; i++)
{
DataColumn objDC = myTable.Columns[i];

BoundField objBC = new BoundField();
objBC.DataField = objDC.ColumnName;
objBC.HeaderText = objDC.ColumnName;
objBC.SortExpression = objDC.ColumnName;
objBC.HeaderStyle.HorizontalAlign = HorizontalAlign.Center;
objBC.ItemStyle.HorizontalAlign = HorizontalAlign.Center;

objBC.HeaderStyle.CssClass = (i == 0 ? "first" : "");
objBC.ItemStyle.CssClass = (i == 0 ? "first" : "row");
objBC.DataFormatString = WebComponents.FormatString.InputDataType(objDC.DataType.ToString());

in the above code mytable has hyperlink columns how to made hyperlink property
last 3 columns of mytable


Regards
Sudarshan.C

sudarshan.c

Cnagasa, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Hmanjarawala on: 12/7/2011 [Member] Bronze | Points: 25

Up
0
Down
For that you have to define object HyperLinkField instead of BoundField

Himanshu Manjarawala
Sr. Software Engineer@AutomationAnywhere
http://fieredotnet.wordpress.com/

Cnagasa, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Cnagasa on: 12/7/2011 [Member] Starter | Points: 25

Up
0
Down
hi,

i am trying the below code

HyperLinkField HPF = new HyperLinkField();

if (objDC.ColumnName == "MAWB URL")
{
HPF.DataTextField = objDC.ColumnName;
HPF.HeaderText = objDC.ColumnName;
for (int j = 0; j < myTable.Rows.Count; j++)
{
HPF.NavigateUrl = myTable.Rows[j]["MAWB URL"].ToString();
HPF.Target = myTable.Rows[j]["MAWB URL"].ToString();
HPF.DataNavigateUrlFields = new string[] { myTable.Rows[j][myTable.Columns[myTable.Columns.Count - 4].ColumnName].ToString() };
}
}

but i will not getting the data


Regard's
Sudarshan.C

sudarshan.c

Cnagasa, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Hmanjarawala on: 12/8/2011 [Member] Bronze | Points: 25

Up
0
Down
have you add this Hyperlink Fields to Gridview

Himanshu Manjarawala
Sr. Software Engineer@AutomationAnywhere
http://fieredotnet.wordpress.com/

Cnagasa, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Cnagasa on: 12/12/2011 [Member] Starter | Points: 25

Up
0
Down
hi,

i want dynamically hyperlink added can u send me the code pl z...

Regard's
Sudarshan.C

sudarshan.c

Cnagasa, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response