473,397 Members | 1,949 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Can not Edit gridview having TemplateField

Hi,

I have a gridview which is having a TemplateField with a checkbox.When I edit this field an erro is occured saying,"Could not find control 'chkPrimary' in ControlParameter 'Primary_Skill'."I am giving the code below..Plz help me...

<asp:GridView id="gdSkills" runat="server" DataSourceID="SqlDataSource1" DataKeyNames="Emp_code,Skill_Id" PageSize="15" AllowPaging="True" AutoGenerateColumns="False">
<HeaderStyle CssClass="gridViewHeader" />
<RowStyle CssClass="gridViewRowStyle" Wrap="False" Width="100%" />
<AlternatingRowStyle CssClass="gridViewAlternative" Wrap="False" Width="100%" />
<Columns>
<asp:BoundField DataField="Skill_name" HeaderText="Skill" ReadOnly="True" />
<asp:BoundField DataField="No_Months" HeaderText="No of Months" />
<asp:TemplateField HeaderText="Primary">
<ItemTemplate>
<asp:CheckBox ID="chkPrimary" runat="server" Checked='<%# GetBoolean(Eval("Skill_Id"),Eval("Emp_code"))%>' />
</ItemTemplate>
</asp:TemplateField>
<asp:CommandField ShowEditButton= "True"/>
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ProviderName="System.Data.SqlClient"

ConnectionString="<%$ ConnectionStrings:MyDatabase%>"


SelectCommand="select ES.Skill_id,Skill_name,emp_code,No_Months,Primary_ Skill from Skill S
join Emp_skills ES on S.Skill_id=ES.Skill_id
where emp_code=@Emp_code order by Skill_name"
UpdateCommand="update emp_Skills set No_Months=@No_Months,Primary_Skill=@Primary_Skill where Skill_id=@Skill_id AND EMP_CODE=@Emp_Code">
<SelectParameters>
<asp:SessionParameter Name="Emp_code" SessionField="Empcode" Type="String" />
</SelectParameters>
<UpdateParameters>
<asp:Parameter Name="No_Months" Type="Double" />
<asp:Parameter Name="Skill_id" Type="Int32" />
<asp:ControlParameter Name="Primary_Skill" ControlID="chkPrimary" />
<asp:SessionParameter Name="Emp_code" SessionField="Empcode" Type="String" />
</UpdateParameters>
</asp:SqlDataSource>
Mar 5 '08 #1
0 774

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: tfsmag | last post by:
I have a Grid that I've set up to have two of the fields use dropdownlists while in edit mode. Now I can bind the data to the dropdownlists just fine. My problem is that the second dropdown depends...
0
by: j-in-uk | last post by:
Hi, I am using the gridView control at first the EmptyInsert command is executed from the EmptyDataTemplate but when a user clicks Edit after the 1st insert, for some reason it detects the...
1
by: Marc | last post by:
Hi, I made a detailsview for inserting records. I also made a gridview for editing and deleting the same records. The keyfield is an autonumbering field in Access (pcnr). My problem is: I can...
2
by: VB Programmer | last post by:
I have a gridview control with several data fields. When the user clicks 'edit' for the row I want the user to be able to edit a particular text field. Under that 'edit' textbox is a button. ...
1
by: cyningeston | last post by:
OS: WinXP Pro, VB/ASP/ADO.NET I'm building a web-based supplier management application. For each supplier we are required by the FDA to track certain documents. I've managed to pull them from...
2
by: Blasting Cap | last post by:
I have a couple fields (one varchar 20, one varchar 500) for a PO Number & a comment field on a datagrid. Once they're entered, a user can edit them and make changes to them. However, when...
8
by: kabilahan | last post by:
how to store gridview values in a two dimesion array am having a gridview like this <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" Width="150px"> ...
0
by: dch | last post by:
I have a GridView, and when I click Edit, it is firing the OnRowEditing event ,and I am setting the edititem index, but it keeps displaying the ItemTemplate fields instead of the EditItemTemplate. I...
1
by: rogerford | last post by:
I have a grid which i bind with values from Database. I have events to edit and update the grid. I am not using SqlDatasource to connect to DB. Rather i am doing the updating of the grid...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.