Click here to Skip to main content
16,011,849 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello sir,
I wand to bind a data throw datalist with in Gridview.
another thing is that when is take datalist with gridview than datalist property is totally hide.So i can not generate dataItemBound event.
so i want to know that how to generate that dataItemBound property throw datalist with in GridView.
Posted

1 solution

               You have to write code in grid-view's row data bound event.
In that event you have to find the control in the grid view cell by it's name say "datalist1".


               After that type cast the control. once you have the datalist1 object you can assign it a data-source.


      protected void gvRatings_RowDataBound(object sender, GridViewRowEventArgs e)
      {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                DataList DataList1= ((DataList)e.Row.FindControl("DataList1"));
                DataList1.DataSource=<some data="" source="" object="">;
           //do what ever you want to do here using the value of your label
            }
      }
</some>


               Rememeber you have to bind data-list of each row of grid separately even if they have same data source. you can you same data-source object if you want to bind them all.
 
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