Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

Compare values of gridview txtboxes before insert

Avatar of kdeutsch
kdeutschFlag for United States of America asked on
.NET ProgrammingASP.NETVisual Basic.NET
7 Comments1 Solution397 ViewsLast Modified:
I need to compare the old value of my textbox to the new value that was put into the textbox to see if anything changed else I don't want to save anything in the row and move to next row.  Here is my gridiview with bound txtBoxes and my initial code behind.

<asp:TemplateField HeaderText="ACTUAL">
                       <ItemTemplate>
                           <asp:TextBox ID="txtActual" runat="server" Text='<%# Eval("ACTUAL_VALUE") %>' Width="60" MaxLength="8"></asp:TextBox>
                       </ItemTemplate>
                   </asp:TemplateField>
                    <asp:TemplateField HeaderText="TARGET">
                       <ItemTemplate>
                           <asp:TextBox ID="txtTarget" runat="server" Text='<%# Eval("TARGET_VALUE") %>' Width="60" MaxLength="8"></asp:TextBox>
                       </ItemTemplate>
                   </asp:TemplateField>
                    <asp:TemplateField HeaderText="TOLERANCE">
                       <ItemTemplate>
                           <asp:TextBox ID="txtTolerance" runat="server" Text='<%# Eval("TOLERANCE_RAW") %>' Width="120" MaxLength="8"></asp:TextBox>
                       </ItemTemplate>
                   </asp:TemplateField>



I have a linkbutton to save it all. but I need to compare values so that I am not saving information that does not need to be saved becuase of the expensive long trip of the update process to an oracle server over a link from sql.

For Each dgi As GridViewRow In Gridmain.Rows
            Dim Actualval As String = CType(dgi.FindControl("txtActual"), TextBox).Text
            Dim Targetval As String = CType(dgi.FindControl("txtTarget"), TextBox).Text
            Dim Tolval As String = CType(dgi.FindControl("txtTolerance"), TextBox).Text
            Dim BMVal1 As String = CType(dgi.FindControl("txtBm1"), TextBox).Text
            Dim BMVal2 As String = CType(dgi.FindControl("txtBm2"), TextBox).Text
            Dim BMVal3 As String = CType(dgi.FindControl("txtBm3"), TextBox).Text
            Dim BMVal4 As String = CType(dgi.FindControl("txtBm4"), TextBox).Text
            Dim BMVal5 As String = CType(dgi.FindControl("txtBm5"), TextBox).Text
        Next
ASKER CERTIFIED SOLUTION
Avatar of CmdoProg2
CmdoProg2Flag of United States of America image

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Commented:
This problem has been solved!
Unlock 1 Answer and 7 Comments.
See Answers