dmatos 0 Newbie Poster

Hello all

i'm having a hard time trying to pass parameters to a gridview while updating.
lets say that when i try to update, i use the RowUpdating method of the gridview to pass the values i want manually, Why? because there are 3 fields i'm not showing the user when he/she is using the page. So i want to update those 3 fields and i cant.

Here is my Code to explain my self better:

VB.NET CODE:

Try

            'Dim codigo As String = GridView1.SelectedRow.Cells(1).ToString
            Dim fechaMod As DateTime = Date.Now
            Dim usuarioMod As String = "yomimo"

            'SqlDataSource1.UpdateParameters("catFechaCreacion").DefaultValue = SIDCafeteria.Classes.Herramientas.Fecha(codigo)

            SqlDataSource1.UpdateParameters("catCodigo").DefaultValue = GridView1.Rows().Item(1).
            'SqlDataSource1.UpdateParameters("catFechaCreacion").DefaultValue = DateTime.Now
            'SqlDataSource1.UpdateParameters("catUltModificacion").DefaultValue = Convert.ToDateTime(DateTime.Now)
            'SqlDataSource1.UpdateParameters("catModificadoPor").DefaultValue = usuarioMod.ToString()
            SqlDataSource1.Update()

        Catch ex As Exception

            Session("Exception") = ex
            Response.Redirect("ErrorPage.aspx")

        End Try

Sql Datasource Page Code:[/U][/B]

<asp:SqlDataSource ID="SqlDataSource1"  runat="server"   
        ConnectionString="<%$ ConnectionStrings:CafeteriaSIDConnectionString %>"   
        SelectCommand="SELECT [catCodigo],[catDescripcion], [catSite] FROM [Categorias]"
        UpdateCommand="insertUpdate_categorias"   
        UpdateCommandType="StoredProcedure">  
        <SelectParameters>  
            <asp:SessionParameter DefaultValue="0" Name="SiteID" SessionField="SiteID"   
                Type="Int32" />  
            <asp:SessionParameter DefaultValue="0" Name="SectorID" SessionField="SectorID"   
                Type="Int32" />  
        </SelectParameters>  
        <UpdateParameters>
            <asp:Parameter name="catFechaCreacion" Type="DATETIME" />    
            <asp:Parameter Name="catUltModificacion" Type="DATETIME" />  
            <asp:Parameter Name="catModificadoPor" Type="String" ConvertEmptyStringToNull="true" />   
        </UpdateParameters>  
    </asp:SqlDataSource>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.