This topic is locked

ASPRunner.NET Reading data rows

5/17/2007 1:07:24 PM
ASPRunner.NET General questions
swat author

I was wondering , how I can compare datarow1 vs datarow2-
Let say I want to seperate my datagrid view by ID number
ID =1 to ID = 10
ID =10 to ID = 20
...
Thanks

protected void dbGrid_Main_RowDataBound(object sender, GridViewRowEventArgs e)

{
if (e.Row.RowType == DataControlRowType.DataRow)

{





DataRowView rowData;

rowData = (DataRowView)e.Row.DataItem;






if (e.Row.Cells[3].Text.Length > 80)

e.Row.Cells[3].Text = func.ProcessLargeText(e.Row.Cells[3].Text, 80, "Main", "field=ID&key=" + "ID=" + Convert.ToString(rowData["ID"]) + ";" );
.....
Eugene 5/18/2007

[codebox]protected void dbGrid_Main_RowDataBound(object sender, GridViewRowEventArgs e)

{
if (e.Row.RowType == DataControlRowType.DataRow)

{
DataRowView rowData;

rowData = (DataRowView)e.Row.DataItem;

...

if (Convert.ToInt32(rowData["ID"])) % 10 == 0)

{

...your code...

}

...[/codebox]

swat author 5/18/2007

Eugene,
This works ,

if ((Convert.ToInt32(rowData["ID"])) % 10 == 1)

{

Run the code

}

However,

The code runs twice always-
Note: The database have only one ID which is equal to 1. When I insert this new (Convert.ToIn32....) statement , application suppose to return only one Datarow, but instead I am getting 2-
if ((Convert.ToInt32(rowData["ID"])) % 10 == 1)

{

Response.Write ("THIS IS TEST<BR>");

}


Result:

THIS IS TEST

THIS IS TEST

swat author 9/11/2007

Anyone has solution to this issue? <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=21266&image=1&table=forumreplies' class='bbc_emoticon' alt=':blink:' />
Thanks