I have a DropDownList in my gridview. I have it set up where it gets populated from the database and I can update the record just fine. But I rather NOT populate it from the database and only give the user 3 choices to choose from. The problem is when I change the code to display the 3 choices to choose from the update to database won't work. Which is a stored procedure and that works good. Below the code the I'm using to populate the DropDownList from my database and how I'm trying to change it to 3 choices to choose from. Can someone please tell me what I'm doing wrong? Thanks...
AutoGenerateDeleteButton="True" AutoGenerateEditButton="True" GridLines="None" OnRowDeleting="gridUserAccounts_RowDeleting" OnRowDeleted="gridUserAccounts_RowDeleted" DataKeyNames="UserName, UserId">
This is what I'm trying to go to work:
6 Replies
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
mikePosted Jun 14, 2016, 11:19 AM
ali tuncerPosted Jun 14, 2016, 3:24 AM
I think it will be easier if you share your code, how you save to database..
mikePosted Jun 14, 2016, 3:04 AM
Vinay SinghPosted Jun 14, 2016, 2:37 AM
Karthik ElumalaiPosted Jun 14, 2016, 2:30 AM
It really simple, you just place one dropdown control inside the template field of gridview control, and in codebehind file , find the that control using the findcontrol() method and just assign a value that using datasource
Abhishek KumarPosted Jun 14, 2016, 2:29 AM