2014年7月13日 星期日

[RESOLVED] use Gridview inside ItemTemplate of a formview


Hello All,


I have formview and I would like to add gridview in ITEMTEMPLATE of the formview?


the gridview will use sam datasource as formview.


Would you please tell me how can I achieve this?



In formview ItemTemplate I have got the image control which displays the image of  a person.


I also got the Table which displays the information of a person 


and I want to display persons other details like order details in a gridview.


all data is coming from the same datasource and I have bound the formview in code behind file.



REgards



Hi ravi,


your requirement seems simple and there can be multiple options to achive this, so i recommend you to follow the Link below, from MSDN, hopefully it will help.


http://msdn.microsoft.com/en-us/library/bb288032.aspx



Hi Ijaz,


I am having one formview whose data source is assigned programitycally in codebehined using databind().


Now i am putting gridview to the same formview and I also need to display some data in gridview. 


I am lost somewhere here even the page is not displaying the gridview at all.


Regards



Use FormView1.FindControl() to find your gridview and set the datasource and call databind. That should work I think. 



i have done it like 


myform.FindControl("myGV").DataBind();


but no luck


gridview is not coming up at all



You have to use findcontrol and cast that to gridview then set the DataSource property AND THEN call databind.



Hello I have done that but still gridview is not visible inside formview



I have done below on button click


assigned datasource to formview


bound data to formview


gridview mygv= (gridview)form1.findcontrol("MyGrid");


mygv.datasource= ds.tables["Object"];


mygv.databind();


but no luck




Finally I have achieved it dont know why but I cleared the history of browser and then rebuild the solution again and it worked


Thank you very much to all for your precious time


Regards


沒有留言:

張貼留言