質問

I have a question regarding gridview inside gridview's selection functionality. I am trying to achieve forum functionality.. i.e. A thread is posted and people comment on that thread . one can quote from earlier posted comments, add his opinions and finally make his comment.

I am binding the inside gridview's data on RowDataBound event of parent gridview. In database I have a Parent ID columns which have the ID of the Thread post on which the reply is made. so far simple reply(without quoting any of earlier comments) functionality is working just fine.

Now I am having an issue on quoting scenario.. I've a button inside the inner gridview(gridview2)'s item template..upon clicked which should give me the ID of that post. but i am unable to figure out any solution yet..as gridview2 is not accessible in .cs file

役に立ちましたか?

解決

You can't directly access any control inside the gridview from code behind. You have to first make the object of that control.

GridView GridView2=(GridView)GridView1.Rows[RowIndex].FindControl("GridView2");

Something like this.
Refer this:http://www.codeproject.com/Articles/189997/Gridview-inside-Gridview-in-asp-net-Csharp. It may help you.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top