PDA

View Full Version : سوال: مشکل با UserControl



fakhravari
پنج شنبه 14 مهر 1390, 23:00 عصر
با سلام
دوستان من یک label دارم توی یک گرید در یک UserControl
حالا می خواهم دسترسی داشته باشم با این کد ها نمیشه مشکل از کجان؟

Label aa = (Label)this.FindControl("Label2");
aa.Text = "sfsf";



Label l1 = (Label)GridView2.FindControl("Label1");
l1.Text = "safasfas";

mahdioo12194
جمعه 15 مهر 1390, 00:07 صبح
Label aa = (Label)GridView2.Rows[0].FindControl("Label3");
aa.Text = "sfsf";





foreach (GridViewRow row in GridView2.Rows)
{

Label aa = (Label)row.Cells[0].FindControl("Label3");
aa.Text = "sfsf";
}