When I click in the update link and try to save then, is not saving anything at all. How can I solve this update issue with my gridview?
This is my code:
<asp:GridView ID="GridView1" runat="server" AllowSorting="True" AutoGenerateColumns="False"
DataSourceID="SqlDataProspecto" DataKeyNames="IdProspecto" Style="position: static">
<Columns>
<asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
<asp:BoundField DataField="IdProspecto" HeaderText="IdProspecto" InsertVisible="False"
ReadOnly="True" SortExpression="IdProspecto" />
<asp:BoundField DataField="Prospecto" HeaderText="Prospecto" SortExpression="Prospecto" />
<asp:TemplateField HeaderText="Sector" SortExpression="Descripcion">
<EditItemTemplate>
<aspropDownList ID="DropDownList1" runat="server" DataSourceID="SqlDataSector"
DataTextField="Descripcion" DataValueField="IdSector" SelectedValue='<%# Bind("IdSector") %>'
Style="position: static">
</aspropDownList><asp:SqlDataSource ID="SqlDataSector" runat="server" ConnectionString="<%$ ConnectionStrings:SIPConnectionString %>"
SelectCommand="SELECT * FROM [Sector] ORDER BY [Descripcion]"></asp:SqlDataSource>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("Descripcion") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Nicho" SortExpression="Nicho">
<EditItemTemplate>
<aspropDownList ID="DropDownList2" runat="server" DataSourceID="SqlDataNicho" DataTextField="Descripcion"
DataValueField="IdNicho" SelectedValue='<%# Bind("IdNicho") %>' Style="position: static">
</aspropDownList><asp:SqlDataSource ID="SqlDataNicho" runat="server" ConnectionString="<%$ ConnectionStrings:SIPConnectionString %>"
SelectCommand="SELECT * FROM [Nicho] ORDER BY [Descripcion]"></asp:SqlDataSource>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label2" runat="server" Text='<%# Bind("Nicho") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataProspecto" runat="server" ConflictDetection="CompareAllValues"
ConnectionString="<%$ ConnectionStrings:SIPConnectionString %>" DeleteCommand="DELETE FROM [Prospecto] WHERE [IdProspecto] = @original_IdProspecto AND [Nombre] = @original_Nombre AND [IdSector] = @original_IdSector AND [IdNicho] = @original_IdNicho"
InsertCommand="INSERT INTO [Prospecto] ([Nombre], [IdSector], [IdNicho]) VALUES (@Nombre, @IdSector, @IdNicho)"
OldValuesParameterFormatString="original_{0}" SelectCommand="SELECT Prospecto.IdProspecto, Prospecto.Nombre AS Prospecto, Sector.IdSector, Sector.Descripcion, Nicho.IdNicho, Nicho.Descripcion AS Nicho FROM Prospecto INNER JOIN Sector ON Prospecto.IdSector = Sector.IdSector INNER JOIN Nicho ON Prospecto.IdNicho = Nicho.IdNicho ORDER BY Prospecto"
UpdateCommand="UPDATE [Prospecto] SET [Nombre] = @Nombre, [IdSector] = @IdSector, [IdNicho] = @IdNicho WHERE [IdProspecto] = @original_IdProspecto AND [Nombre] = @original_Nombre AND [IdSector] = @original_IdSector AND [IdNicho] = @original_IdNicho">
<DeleteParameters>
<asparameter Name="original_IdProspecto" Type="Int16" />
<asparameter Name="original_Nombre" Type="String" />
<asparameter Name="original_IdSector" Type="Int16" />
<asparameter Name="original_IdNicho" Type="Int16" />
</DeleteParameters>
<UpdateParameters>
<asparameter Name="Nombre" Type="String" />
<asparameter Name="IdSector" Type="Int16" />
<asparameter Name="IdNicho" Type="Int16" />
<asparameter Name="original_IdProspecto" Type="Int16" />
<asparameter Name="original_Nombre" Type="String" />
<asparameter Name="original_IdSector" Type="Int16" />
<asparameter Name="original_IdNicho" Type="Int16" />
</UpdateParameters>
<InsertParameters>
<asparameter Name="Nombre" Type="String" />
<asparameter Name="IdSector" Type="Int16" />
<asparameter Name="IdNicho" Type="Int16" />
</InsertParameters>
</asp:SqlDataSource>
Thanks in advance for the support.
This is my code:
<asp:GridView ID="GridView1" runat="server" AllowSorting="True" AutoGenerateColumns="False"
DataSourceID="SqlDataProspecto" DataKeyNames="IdProspecto" Style="position: static">
<Columns>
<asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
<asp:BoundField DataField="IdProspecto" HeaderText="IdProspecto" InsertVisible="False"
ReadOnly="True" SortExpression="IdProspecto" />
<asp:BoundField DataField="Prospecto" HeaderText="Prospecto" SortExpression="Prospecto" />
<asp:TemplateField HeaderText="Sector" SortExpression="Descripcion">
<EditItemTemplate>
<aspropDownList ID="DropDownList1" runat="server" DataSourceID="SqlDataSector"
DataTextField="Descripcion" DataValueField="IdSector" SelectedValue='<%# Bind("IdSector") %>'
Style="position: static">
</aspropDownList><asp:SqlDataSource ID="SqlDataSector" runat="server" ConnectionString="<%$ ConnectionStrings:SIPConnectionString %>"
SelectCommand="SELECT * FROM [Sector] ORDER BY [Descripcion]"></asp:SqlDataSource>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("Descripcion") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Nicho" SortExpression="Nicho">
<EditItemTemplate>
<aspropDownList ID="DropDownList2" runat="server" DataSourceID="SqlDataNicho" DataTextField="Descripcion"
DataValueField="IdNicho" SelectedValue='<%# Bind("IdNicho") %>' Style="position: static">
</aspropDownList><asp:SqlDataSource ID="SqlDataNicho" runat="server" ConnectionString="<%$ ConnectionStrings:SIPConnectionString %>"
SelectCommand="SELECT * FROM [Nicho] ORDER BY [Descripcion]"></asp:SqlDataSource>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label2" runat="server" Text='<%# Bind("Nicho") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataProspecto" runat="server" ConflictDetection="CompareAllValues"
ConnectionString="<%$ ConnectionStrings:SIPConnectionString %>" DeleteCommand="DELETE FROM [Prospecto] WHERE [IdProspecto] = @original_IdProspecto AND [Nombre] = @original_Nombre AND [IdSector] = @original_IdSector AND [IdNicho] = @original_IdNicho"
InsertCommand="INSERT INTO [Prospecto] ([Nombre], [IdSector], [IdNicho]) VALUES (@Nombre, @IdSector, @IdNicho)"
OldValuesParameterFormatString="original_{0}" SelectCommand="SELECT Prospecto.IdProspecto, Prospecto.Nombre AS Prospecto, Sector.IdSector, Sector.Descripcion, Nicho.IdNicho, Nicho.Descripcion AS Nicho FROM Prospecto INNER JOIN Sector ON Prospecto.IdSector = Sector.IdSector INNER JOIN Nicho ON Prospecto.IdNicho = Nicho.IdNicho ORDER BY Prospecto"
UpdateCommand="UPDATE [Prospecto] SET [Nombre] = @Nombre, [IdSector] = @IdSector, [IdNicho] = @IdNicho WHERE [IdProspecto] = @original_IdProspecto AND [Nombre] = @original_Nombre AND [IdSector] = @original_IdSector AND [IdNicho] = @original_IdNicho">
<DeleteParameters>
<asparameter Name="original_IdProspecto" Type="Int16" />
<asparameter Name="original_Nombre" Type="String" />
<asparameter Name="original_IdSector" Type="Int16" />
<asparameter Name="original_IdNicho" Type="Int16" />
</DeleteParameters>
<UpdateParameters>
<asparameter Name="Nombre" Type="String" />
<asparameter Name="IdSector" Type="Int16" />
<asparameter Name="IdNicho" Type="Int16" />
<asparameter Name="original_IdProspecto" Type="Int16" />
<asparameter Name="original_Nombre" Type="String" />
<asparameter Name="original_IdSector" Type="Int16" />
<asparameter Name="original_IdNicho" Type="Int16" />
</UpdateParameters>
<InsertParameters>
<asparameter Name="Nombre" Type="String" />
<asparameter Name="IdSector" Type="Int16" />
<asparameter Name="IdNicho" Type="Int16" />
</InsertParameters>
</asp:SqlDataSource>
Thanks in advance for the support.