Click here to Skip to main content
15,891,529 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Add Button in gridview, for that i written the code in source page as follows

<asp:TemplateField HeaderText="Course1">
<itemtemplate>
<asp:Button ID="Btncourse" Height="15px" Width="40px" BorderStyle="None" OnClick="Btncourse_Click "
runat="server" Text='<%#Bind("Course") %>'/>




for that i written a code above, when i run shows error as follows

DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'Course'.


what is the problem in my above code.


please help me.

Rgds,
Narasiman P.
Posted
Comments
Siddhesh Patankar 12-Jul-13 4:06am    
Does the data source you have related with the Gridview has a Column with Heading Course?? First Check that, as you have to specify the exact column name in this case.
What are you using DataTable or DataSet to populate the GridView?? Judging by the error I am guessing DataTable

Course is the DataField which will bind the data from the datasource which you pass to the gridview. Check the Datasource whether you having any field with names as Course. The value of the Course field will be the Button text. Check your requirement once again
 
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