Click here to Skip to main content
15,888,285 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am using ASP.Net 4.0 in Visual Studio 2010. I have two tables in my database 'registration'- table1 ==" Users" which has a column called usertype and table 2=="Requests" which has a column called assigned_to.

What I intend to do is:- when the
page loads the grid view is shown and when I click the edit command, the assigned_to column contains a dropdown list showing all the values from the firstname column of Users where Usertype='facilitator'.

Now when I click the value in the drop down list and then click update the values in the grid view do not get updated. I am not using any code in the C# file. I am just using the edit template feature of the grid view.

please could any body help?
Posted
Updated 21-Jul-13 20:41pm
v2
Comments
jaideepsinh 22-Jul-13 2:37am    
I think you have to use update panel.Do you try that?Paste you code here if you did.
[no name] 22-Jul-13 4:23am    
i tried the update panel... didn't work
jaideepsinh 22-Jul-13 6:09am    
Paste you code here if you did.
Thanks7872 22-Jul-13 2:43am    
I am not using any code in the C# file. Why?

You need to use RowCommand event of the grid and write the update logic in code behind file.
 
Share this answer
 
Comments
[no name] 22-Jul-13 4:26am    
could you help me with the code for the RowCommand function?
<asp:gridview id="GridView1" datasourceid="MyDataSource" datakeynames="Code" xmlns:asp="#unknown">
AutoGenerateColumns="false" runat="server">
<columns> <asp:commandfield buttontype="Link" showeditbutton="true" showcancelbutton="true">
<asp:boundfield datafield="Code" headertext="Code">
<asp:boundfield datafield="Name" headertext="Name">
<asp:boundfield datafield="Description" headertext="Description">


<asp:sqldatasource id="MyDataSource" xmlns:asp="#unknown">
ConnectionString="<%$Connectionstrings:ERPConnectionString%>"
SelectCommand="SELECT * FROM Sample"
UpdateCommand="Update SAMPLE SET Name=@Name,Description=@Description Where Code=@Code"
DeleteCommand="Delete SAMPLE Where Code=@Code" runat="server"/>

-------- The above way is when you sepcify soruce also in the grid, From your question if you are not doing any coding in c# Code you should be using something similar to one above. Please note the '
 
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