c# - Capture dropdown change and update -


I have a gridview in one page and I have an update button which updates bulk for gridview. I have 5 columns in my gridview, the first of which 3 columns are not editable and the last two columns have dropdown value.

If I change any one dropdown in a page and click Update it, then I save all the rows on that page. I have to capture only the selected row values ​​and only need to update that line item along with how I can capture the old values ​​of this two dropdown and save it in a different table, which is called the History table. Can any suggestion or suggestion to get me this?

  & asp: GridView runat = "server" id = "gv" auto generated column = "wrong" & gt; & Lt; Columns & gt; & Lt; ASP: TemplateField & gt; & Lt; ItemTemplate & gt; & Lt; asp: dropdown list id = "ddl1" runat = "server" & gt; & Lt; / Asp: dropdown list & gt; & Lt; asp: HiddenField id = "hfddl1Val" runat = "server" value = '& lt;% # Eval ("col_name")% & gt; / & Gt; & Lt; / ItemTemplate & gt; & Lt; / ASP: TemplateField & gt; & Lt; / Column & gt; & Lt; / ASP: GridView & gt; Secure zero btn_save (Object Sender, EventArgs e) {foreach (GridViewRow line in gv.Rows)   

C #

 {Hindfield HF = (hidden field) row FontControl ("HFDL1Wall"); Dropdown list DDL = (dropdownlist) line Fontcontrol ("DDL 1"); Then, while updating (hf.Value! = Ddl.SelectedValue) {// save}}}   

, loop and compare HiddenField The value (which will be the previous data) will be dropdown list current value (as in ddl1.SelectedValue ). If both are equal then there is no change, otherwise the data is changed for that line and you can continue to save.

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -