Gridview rowupdating code behind
When the user selects the first dropdownlist, I need it to update the contents of the second dropdownlist. The reason why is because on every postback I'm looping though the grid and making sure that the next dropdown only contains items that are filtered on the previous dropdown.
I have my Subs that do this fine when not inside the Grid View, but what is the correct way to do it whilst they are in the Grid View? So for instance when I select Heavy Sort as a next process step only heavy sort shows up. Hello all, I just posted a message yesterday, there is no one replied to me.
Also I cannot find the field name in Grid View which is the same to the update parameter name.
Hi payalp, The Update Parameters names are not equal to the names of New Values in Row Updating event. Sql Client" Select Command="select * from [spiderwebs_region] order by name " Update Command="Update Region With History" Update Command Type="Stored Procedure" Delete Command="Delete Region With History" Delete Command Type="Stored Procedure" On Inserting="Sqldatasource1_Inserting" On Inserted="Sqldatasource1_Inserted" Insert Command="Insert Region With History" Insert Command Type="Stored Procedure" Hi payalp, I suggest you assign the values to parameters directly in Row Updating event: Sql Data Source1.
Now I will show you the C# code behind file of the above ASP.
NET page that will handle different Grid View events to provide complete editing functionality.
In the Page_Load event, you simply load your data from the database and bind it with the Grid View control as shown below: For brevity I am not storing connection string in the web.config and also not using any Data Access Component.
When I remove the databind method, the grid shrinks after update button is clicked (or on postback). Last line of the following code is calling a local method for updating the database and passing all the parameters to this method.