I have a webgrid inside a WARP. I have a Save button below the grid that is also inside the WARP. I have an AddNewRow on the webgrid. When the user enters their data for the new row, and then they press the save button, the new row is added, but it is also updating the last row in the table to what the user entered as the new data. So, when I look at the table in SQL Server, it basically has duplicate rows, but one is the new one and one was just an update to an existing record. Now, if a user types in their data and then simply clicks off that record, the row is added and no update is done. Why would this save button be causing this to happen. I have absolutely no code behind the save button...it's really just there because the user is used to being able to click a save button to save the rows and they can't grasp not having a button to press that saves their data.
I'm sorry...I thought I replied to this...must have been another post I submitted that I replied to. I'm still not sure what the problem was, but I had a separate problem with the page and I ended up starting over from scratch and when I did, it semed to work the way I expected it to work.
Thank you for looking at it and again, I am sorry I didn't respond.
Hello Fred,
Let me know if you still need any assistance with this.
Regards,
Lyuba
Developer Support Engineer
Infragistics
www.infragistics.com/support
I had a look at your source code but I didn’t find anything that can cause this behavior. I created a project using your source code and I tried it with different Infragistics versions – 9.2.20092.1003, 10.1.20101.1011, and 10.1.20101.2051, and with all of them the new line was added and no other value was changed. Would you send me an isolated sample that illustrates the behavior that you are seeing?
I'll try to attach it...but I don't know if the formatting will come out correct. I am not doing anything when the Save button is clicked, the only real purpose was to give the user something to press because that's what they are used to. I'm using the CRUD method to add/edit/delete rows.
ASPX Page----------------- <igmisc:WebAsyncRefreshPanel ID="WARP" runat="server" Height="100%" Width="100%" TriggerPostBackIDs="grid_Lookup">
<igtbl:UltraWebGrid ID="grid_Lookup" runat="server" Browser="Xml" DataKeyField="Lookup_ID" DataSourceID="SqlDataSource_Lookup" EnableAppStyling="True" Height="100px" Width="100%"> <displaylayout allowdeletedefault="Yes" allowsortingdefault="Yes" allowupdatedefault="Yes" bordercollapsedefault="Separate" headerclickactiondefault="SortMulti" loadondemand="Xml" name="gridxLookup" rowheightdefault="20px" stationarymargins="Header" stationarymarginsoutlookgroupby="True" tablelayout="Fixed" version="4.00" CellClickActionDefault="Edit" AllowAddNewDefault="Yes"> <framestyle height="100px" width="100%"> </framestyle> <clientsideevents initializelayouthandler="grid_Lookup_InitializeLayoutHandler" /> <activationobject bordercolor="" borderwidth=""> </activationobject> <AddNewRowDefault Visible="Yes"> </AddNewRowDefault> <filteroptionsdefault allowrowfiltering="OnClient" filteruitype="FilterRow"> </filteroptionsdefault> </displaylayout> <bands> <igtbl:UltraGridBand DataKeyField="Lookup_ID"> <Columns> <igtbl:UltraGridColumn BaseColumnName="Lookup_ID" DataType="System.Int32" Hidden="True" IsBound="True" Key="Lookup_ID"> <header caption="Lookup_ID"> </header> </igtbl:UltraGridColumn> <igtbl:UltraGridColumn BaseColumnName="Lookup_Code" FilterOperatorDefaultValue="Contains" IsBound="True" Key="Lookup_Code" Width="100%"> <header caption="Description"> <rowlayoutcolumninfo originx="1" /> <RowLayoutColumnInfo OriginX="1" /> </header> <cellstyle horizontalalign="Left" wrap="True"> </cellstyle> <footer> <rowlayoutcolumninfo originx="1" /> <RowLayoutColumnInfo OriginX="1" /> </footer> </igtbl:UltraGridColumn> </Columns> <addnewrow view="NotSet" visible="NotSet"> </addnewrow> </igtbl:UltraGridBand> </bands> </igtbl:UltraWebGrid>
<asp:SqlDataSource ID="SqlDataSource_Lookup" runat="server" ConnectionString="<%$ ConnectionStrings:csHealth_Promotions %>" DeleteCommand="usp_AIM_del_Lookup_Value" DeleteCommandType="StoredProcedure" OnDeleting="SqlDataSource_Lookup_Deleting" SelectCommand="usp_AIM_get_Lookup_Values" SelectCommandType="StoredProcedure" OnSelecting="SqlDataSource_Lookup_Selecting" UpdateCommand="usp_AIM_upd_Lookup_Value" UpdateCommandType="StoredProcedure" OnUpdating="SqlDataSource_Lookup_Updating" InsertCommand="usp_AIM_ins_Lookup_Value" InsertCommandType="StoredProcedure" OnInserting="SqlDataSource_Lookup_Inserting"> <DeleteParameters> <asp:Parameter Name="Lookup_ID" Type="Int32" /> <asp:Parameter Name="User_Name" Type="String" /> </DeleteParameters> <InsertParameters> <asp:Parameter Name="Lookup_Type" Type="String" /> <asp:Parameter Name="Lookup_Code" Type="String" /> <asp:Parameter Name="Lookup_Description" Type="String" /> <asp:Parameter Name="Misc1" Type="String" /> <asp:Parameter Name="User_Name" Type="String" /> </InsertParameters> <SelectParameters> <asp:Parameter Name="Lookup_Type" Type="String" /> </SelectParameters> <UpdateParameters> <asp:Parameter Name="Lookup_ID" Type="Int32" /> <asp:Parameter Name="Lookup_Code" Type="String" /> <asp:Parameter Name="Lookup_Description" Type="String" /> <asp:Parameter Name="Misc1" Type="String" /> <asp:Parameter Name="User_Name" Type="String" /> </UpdateParameters> </asp:SqlDataSource> <br /> <div align="center"> <asp:Button ID="btnSave" runat="server" Text="Save" /> </div> </igmisc:WebAsyncRefreshPanel>ASPX.VB Page-------------------------Partial Class Lookup_Lab_Providers Inherits System.Web.UI.Page
Protected Sub grid_Lookup_AddRow(ByVal sender As Object, ByVal e As Infragistics.WebUI.UltraWebGrid.RowEventArgs) Handles grid_Lookup.AddRow End Sub
Protected Sub grid_Lookup_DeleteRow(ByVal sender As Object, ByVal e As Infragistics.WebUI.UltraWebGrid.RowEventArgs) Handles grid_Lookup.DeleteRow End Sub
Protected Sub grid_Lookup_UpdateRow(ByVal sender As Object, ByVal e As Infragistics.WebUI.UltraWebGrid.RowEventArgs) Handles grid_Lookup.UpdateRow End Sub
Protected Sub SqlDataSource_Lookup_Deleting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.SqlDataSourceCommandEventArgs) Handles SqlDataSource_Lookup.Deleting Dim UserName As String UserName = User.Identity.Name UserName = Right(UserName, UserName.Length - 4)
e.Command.Parameters("@User_Name").Value = UserName End Sub
Protected Sub SqlDataSource_Lookup_Inserting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.SqlDataSourceCommandEventArgs) Handles SqlDataSource_Lookup.Inserting Dim UserName As String UserName = User.Identity.Name UserName = Right(UserName, UserName.Length - 4)
e.Command.Parameters("@User_Name").Value = UserName e.Command.Parameters("@Lookup_Type").Value = "Lab_Provider" End Sub
Protected Sub SqlDataSource_Lookup_Selecting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.SqlDataSourceSelectingEventArgs) Handles SqlDataSource_Lookup.Selecting e.Command.Parameters("@Lookup_Type").Value = "Lab_Provider" End Sub
Protected Sub SqlDataSource_Lookup_Updating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.SqlDataSourceCommandEventArgs) Handles SqlDataSource_Lookup.Updating Dim UserName As String UserName = User.Identity.Name UserName = Right(UserName, UserName.Length - 4)
End Class
Would you tell me how exactly are you adding the row to the database, what are you doing when you click on the Save button?
Can you attach the aspx and the code behind of the page with your ultrawebgrid?