Click here to Skip to main content
15,896,153 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i am reading 2nd and column value(label) of a repeater control and change
the text property against the data which is bind to that label,but repeater foreach loop
cannot read the last row always last row is avoided by control for manipulation
here is the code

on itemdatabound method
C#
if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem))
{
    foreach (RepeaterItem item in rptTask.Items)
    //for (int i = 0; i < rptTask.Items.Count; i++)
    {        
        Label lblGroupAssign = (Label)item.FindControl("lblASSIGNTOGROUP");
        Label lblExeAssign = (Label)item.FindControl("lblUSERNAME");
        Button BtnDownload = (Button)item.FindControl("lnkDownload");

        string grupassign = string.Empty;
        string exeassign = string.Empty;
        grupassign = lblGroupAssign.Text;
        exeassign = lblExeAssign.Text;

        if (grupassign == "0")
        {
            grupassign = "TDM";
            exeassign = "Not Assigned";
            //lblGroupAssign.Text = "TDM";
            //lblExeAssign.Text = "Not Assigned";
        }
        else if (grupassign == "1")
        {
            grupassign = "TE";
            //lblGroupAssign.Text = "TE";
        }
        string filename = BtnDownload.CommandArgument;
        if (filename != "0")
        {
            BtnDownload.Enabled = true;
        }
        else if (filename == "0")
        {
            BtnDownload.Enabled = false;
        }
        lblGroupAssign.Text = grupassign;
        lblExeAssign.Text = exeassign;
    }
}

i tried all the options but last row is not changing

here is the snap shot of a issue
1st one is grid and its working proper in grid n below that deir is a repeater
n its not working
Snap Shot[^]
Posted
Updated 22-Oct-13 3:39am
v3

1 solution

check below two things

1. The last row is getting bind means the DataSource has data for last rows.
2. The last row is of type ListItemType.Item and ListItemType.AlternatingItem
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900