Click here to Skip to main content
15,920,110 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionHow to perform this requirement Pin
Nath23-Jan-10 5:50
Nath23-Jan-10 5:50 
AnswerRe: How to perform this requirement Pin
thatraja23-Jan-10 7:05
professionalthatraja23-Jan-10 7:05 
GeneralRe: How to perform this requirement Pin
Not Active23-Jan-10 8:12
mentorNot Active23-Jan-10 8:12 
GeneralRe: How to perform this requirement Pin
thatraja23-Jan-10 9:14
professionalthatraja23-Jan-10 9:14 
GeneralRe: How to perform this requirement Pin
Not Active23-Jan-10 9:33
mentorNot Active23-Jan-10 9:33 
GeneralRe: How to perform this requirement Pin
thatraja23-Jan-10 10:17
professionalthatraja23-Jan-10 10:17 
GeneralRe: How to perform this requirement Pin
Nath24-Jan-10 1:02
Nath24-Jan-10 1:02 
GeneralRe: How to perform this requirement Pin
Nath23-Jan-10 15:29
Nath23-Jan-10 15:29 
GeneralRe: How to perform this requirement Pin
thatraja23-Jan-10 16:32
professionalthatraja23-Jan-10 16:32 
AnswerRe: How to perform this requirement Pin
Not Active23-Jan-10 8:07
mentorNot Active23-Jan-10 8:07 
QuestionASP.NET Deployment, how Pin
awedaonline23-Jan-10 3:03
awedaonline23-Jan-10 3:03 
AnswerRe: ASP.NET Deployment, how Pin
Vimalsoft(Pty) Ltd23-Jan-10 3:40
professionalVimalsoft(Pty) Ltd23-Jan-10 3:40 
GeneralRe: ASP.NET Deployment, how Pin
awedaonline24-Jan-10 22:23
awedaonline24-Jan-10 22:23 
AnswerRe: ASP.NET Deployment, how Pin
Not Active23-Jan-10 3:41
mentorNot Active23-Jan-10 3:41 
GeneralRe: ASP.NET Deployment, how Pin
awedaonline24-Jan-10 22:25
awedaonline24-Jan-10 22:25 
QuestionMessage Removed Pin
23-Jan-10 1:12
hi_everybody23-Jan-10 1:12 
AnswerRe: how can i handle url Pin
Not Active23-Jan-10 2:28
mentorNot Active23-Jan-10 2:28 
GeneralMessage Removed Pin
24-Jan-10 19:59
hi_everybody24-Jan-10 19:59 
GeneralRe: how can i handle url Pin
Not Active25-Jan-10 1:05
mentorNot Active25-Jan-10 1:05 
QuestionCounting the values in a gridview Pin
AndyASPVB22-Jan-10 23:30
AndyASPVB22-Jan-10 23:30 
AnswerRe: Counting the values in a gridview Pin
Manas Bhardwaj23-Jan-10 1:12
professionalManas Bhardwaj23-Jan-10 1:12 
GeneralRe: Counting the values in a gridview Pin
AndyASPVB23-Jan-10 1:21
AndyASPVB23-Jan-10 1:21 
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)

{

Table tbl = e.Row.Parent as Table;

TableCell cell = new TableCell();

CheckBox chk = new CheckBox();

Label lbl2 = new Label();

HiddenField rowValue = new HiddenField();

if (e.Row.RowType == DataControlRowType.Header)

{

e.Row.Visible = false;

}

else

{

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

{

Label lbl = (Label)e.Row.FindControl("lblValue");

string str1 = ((Label)(lbl)).Text;

string prevStr= (string)Session["previousStr"];

if (prevStr== str1)

{

counter += 1;

}

else

{

prevStr= sr1 ;

Session["previousStr"] = prevStr;

counter = 1;



if (tbl != null)

{

GridViewRow row = new GridViewRow(-1, -1, DataControlRowType.DataRow, DataControlRowState.Normal);



rowValue.ID = "hdnNumRows";

rowValue.Value = counter;

lbl2.Text = Convert.ToString(counter);

cell.ColumnSpan = this.GridView1.Columns.Count;

cell.Width = Unit.Percentage(100);

cell.BackColor = System.Drawing.Color.Aqua;

HtmlGenericControl span = new HtmlGenericControl("span");

span.InnerHtml = prevStr;

cell.Controls.Add(span);

cell.Controls.Add(chk);

cell.Controls.Add(lbl2);

cell.Controls.Add(rowValue);

row.Cells.Add(cell);

tbl.Rows.AddAt(tbl.Rows.Count - 1, row);





}

}









}



}



}


As you can see, I have a counter in both parts of my if statement. This is so that if the "if" part is true the counter goes up by one, else it is still one. When run this with JavaScript to show the results, it is fine, I am seeing 3, 2, 1, but when I try show this in a label, all I am seeing 1,1,1. Why?
GeneralRe: Counting the values in a gridview Pin
Manas Bhardwaj23-Jan-10 1:34
professionalManas Bhardwaj23-Jan-10 1:34 
GeneralRe: Counting the values in a gridview Pin
AndyASPVB23-Jan-10 1:45
AndyASPVB23-Jan-10 1:45 
Questionbrowser issues Pin
saravanan0522-Jan-10 20:08
saravanan0522-Jan-10 20:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.