How to get gridview row inside dropdownlistselectedindexchange where in my gridview i displayed usin

Posted by Oswaldlily under ASP.NET on 8/9/2011 | Points: 10 | Views : 1227 | Status : [Member] | Replies : 4
How to get gridview row inside dropdownlistselectedindexchange where in my gridview i displayed using label




Responses

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

Up
0
Down
plz, discribe question properly, not getting what is exact question??

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

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

Posted by: Oswaldlily on: 8/9/2011 [Member] Starter | Points: 25

Up
0
Down
ddl_selectedindexchange
Dim ddl As DropDownList = DirectCast(sender, DropDownList)
Dim row As GridViewRow = TryCast(ddl.NamingContainer, GridViewRow)
dim a as string=ctype(grid.rows(row.rowindex).findcontrol("lbl"),label).text
end
in 3rd line it showin eror lik
"object reference not toinstance of obj"
3rd line is callin method of gridview.but don knw that line is correct or not

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

Posted by: Jpchoudhari on: 8/10/2011 [Member] Starter | Points: 25

Up
0
Down
Hi Oswaldlily,

Hope this helps.

Dim ddl As DropDownList = TryCast(sender, DropDownList)

Dim objDCF As DataControlFieldCell = TryCast(ddl.Parent, DataControlFieldCell)
Dim lblText As String = TryCast(objDCF.FindControl("lbl"), Label).Text


Thanks,
jay

Kind Regards,
Jay

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

Posted by: Kunalverma31 on: 8/16/2011 [Member] Starter | Points: 25

Up
0
Down
I hope below code will help you out.

foreach (GridViewRow Gr in GridView1.Rows)
{

Label s =(Label) Gr.Cells[0].FindControl("");
}

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

Login to post response