Problem to update in my gridview

Discussion in 'ASP .Net' started by egsdar, Nov 8, 2008.

  1. egsdar

    egsdar Guest

    Hello, I'm trying to do an update in my gridview but it is not doing for
    "Descripcion" it but with the other field "IdGrupo" it does and I need to
    save both, how can I solve this:


    This is my code:

    <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder2"
    Runat="Server">
    <span style="font-size: 24pt">
    <img src="Images/Barra_tipopropuesta.png" style="position: static"
    /><br />


    <br />
    <asp:SqlDataSource ID="SqlDataSource4" runat="server"
    ConnectionString="<%$ ConnectionStrings:SIPConnectionString %>"
    SelectCommand="SELECT * FROM [Grupo]"></asp:SqlDataSource>

    <br />
    <asp:SqlDataSource ID="SqlDataSource3" runat="server"
    ConnectionString="<%$ ConnectionStrings:SIPConnectionString %>"
    SelectCommand="SELECT TipoPropuesta.IdTipoPropuesta AS Expr2,
    TipoPropuesta.Descripcion AS Descripcion, TipoPropuesta.IdGrupo,
    Grupo.Descripcion AS Expr1 FROM TipoPropuesta INNER JOIN Grupo ON
    TipoPropuesta.IdGrupo = Grupo.IdGrupo"
    UpdateCommand="UPDATE [TipoPropuesta] SET [Descripcion] =
    @Descripcion, [IdGrupo] = @IdGrupo WHERE [IdTipoPropuesta] =
    @IdTipoPropuesta" DeleteCommand="DELETE FROM [TipoPropuesta] Where
    [IdTipoPropuesta] = @IdTipoPropuesta">
    <UpdateParameters>
    <asp:parameter Name="Descripcion" />
    <asp:parameter Name="IdGrupo" />
    <asp:parameter Name="IdTipoPropuesta" />
    </UpdateParameters>
    <DeleteParameters>
    <asp:parameter Name="IdTipoPropuesta" />
    </DeleteParameters>
    </asp:SqlDataSource>
    <center><span style="font-size: 14pt; font-family: Microsoft Sans
    Serif">Consultas
    :: Tipos de Propuesta</span><br />

    <asp:GridView ID="GridView2" runat="server"
    AutoGenerateColumns="False" DataKeyNames="Expr2"
    DataSourceID="SqlDataSource3" Style="position: static"
    BackColor="LightGoldenrodYellow" BorderColor="Tan" BorderWidth="1px"
    CellPadding="2" ForeColor="Black" GridLines="None" Font-Size="11px">
    <Columns>
    <asp:CommandField ShowEditButton="True"
    ShowDeleteButton="True" />
    <asp:BoundField DataField="Expr2" HeaderText="ID"
    InsertVisible="False" ReadOnly="True"
    SortExpression="Expr2" />
    <asp:TemplateField HeaderText="T. Propuesta"
    SortExpression="Expr3">
    <EditItemTemplate>
    <asp:TextBox ID="TextBox1" runat="server" Text='<%#
    Bind("Descripcion") %>'></asp:TextBox>
    </EditItemTemplate>
    <ItemTemplate>
    <asp:Label ID="Label2" runat="server" Text='<%#
    Bind("Descripcion") %>'></asp:Label>
    </ItemTemplate>
    </asp:TemplateField>
    <asp:TemplateField HeaderText="Grupo" SortExpression="Expr1">
    <EditItemTemplate>
    <asp:DropDownList ID="DropDownList2" runat="server"
    DataSourceID="SqlDataSource4"
    DataTextField="Descripcion"
    DataValueField="IdGrupo"
    Style="position: static" SelectedValue='<%#
    Bind("IdGrupo") %>'>
    </asp:DropDownList>
    </EditItemTemplate>
    <ItemTemplate>
    <asp:Label ID="Label1" runat="server" Text='<%#
    Bind("Expr1") %>'></asp:Label>
    </ItemTemplate>
    </asp:TemplateField>
    <asp:BoundField DataField="IdGrupo" HeaderText="IdGrupo"
    SortExpression="IdGrupo" Visible="False" />
    </Columns>
    <FooterStyle BackColor="Tan" />
    <PagerStyle BackColor="PaleGoldenrod" ForeColor="DarkSlateBlue"
    HorizontalAlign="Center" />
    <SelectedRowStyle BackColor="DarkSlateBlue"
    ForeColor="GhostWhite" />
    <HeaderStyle BackColor="Tan" Font-Bold="True" />
    <AlternatingRowStyle BackColor="PaleGoldenrod" />
    </asp:GridView>
     
    egsdar, Nov 8, 2008
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Saber
    Replies:
    1
    Views:
    2,585
    Saber
    Apr 20, 2006
  2. =?Utf-8?B?bWdvbnphbGVzMw==?=

    GridView Hierarchical View - Gridview in Gridview

    =?Utf-8?B?bWdvbnphbGVzMw==?=, May 9, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    18,009
    =?Utf-8?B?UGhpbGxpcCBXaWxsaWFtcw==?=
    May 9, 2006
  3. mesut
    Replies:
    0
    Views:
    673
    mesut
    Feb 19, 2007
  4. Evan M.
    Replies:
    1
    Views:
    1,222
    Evan M.
    Apr 18, 2007
  5. Stephan Kämper
    Replies:
    1
    Views:
    155
    Assaph Mehr
    Jul 15, 2006
Loading...

Share This Page