Hi
I have a gridview that I want to update , using the built in update
for a gridview.
I have everything set up, and it worked well, until it stopped
working.
I don't know what changed, and I know that it does not work because
the value I'm changing does not pass through into the update sql.

I will include the code here, and I hope someone can help me find the
problem.

Thanks :)
Chris


ASPX CODE

<%@ Page Language="VB" MasterPageFile="~/MasterPage2.master"
AutoEventWireup="false"
    CodeFile="report206.aspx.vb" Inherits="report206" Title="Report
206" MaintainScrollPositionOnPostback="true" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1"
runat="Server">
    &nbsp;<br />
    <strong>Drawing-rev: </strong>Editor for drawing-rev
column.&nbsp;<br />
    <br />
    Tips: You may sort the results by clicking on the column name.<br /
>
    <br />
    Narrow down your search results<br />
    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
    <asp:Button ID="Button1" runat="server" Text="Search" />
    <a href="report206.aspx">Reset</a><br />
    <asp:CheckBox ID="CheckBox1" runat="server" AutoPostBack="True"
Text="Show only non-blank drawing rev" Checked="True" /><br />
    <br />
    <asp:GridView ID="GridView1" runat="server" CellPadding="4"
        ForeColor="#333333" GridLines="None" DataKeyNames="lot_no"
AutoGenerateColumns="False" AllowSorting="True"
DataSourceID="SqlDataSource1">
        <RowStyle BackColor="#F7F6F3" ForeColor="#333333"
HorizontalAlign="Left" />
        <FooterStyle BackColor="#5D7B9D" Font-Bold="True"
ForeColor="White" />
        <PagerStyle BackColor="#284775" ForeColor="White"
HorizontalAlign="Center" />
        <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True"
ForeColor="#333333" />
        <HeaderStyle BackColor="#5D7B9D" Font-Bold="True"
ForeColor="White" HorizontalAlign="Left" />
        <EditRowStyle BackColor="#999999" />
        <AlternatingRowStyle BackColor="White" ForeColor="#284775"
HorizontalAlign="Left" />
        <Columns>
            <asp:BoundField DataField="lot_no" HeaderText="lot_no"
ReadOnly="True" SortExpression="lot_no" />
            <asp:BoundField DataField="manu_no" HeaderText="manu_no"
ReadOnly="True" SortExpression="manu_no" />
            <asp:BoundField DataField="item_no" HeaderText="item_no"
ReadOnly="True" SortExpression="item_no" />
            <asp:BoundField DataField="drawing_rev"
HeaderText="drawing_rev" SortExpression="drawing_rev" />
            <asp:CommandField ShowEditButton="True" />
        </Columns>
    </asp:GridView>
    <br />
    <asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:epds01ConnectionString %>"
        UpdateCommand="UPDATE dbo.lot_info SET drawing_rev =
@drawing_rev FROM dbo.lot_info INNER JOIN dbo.lot_hedr ON
dbo.lot_info.li_int_id = dbo.lot_hedr.li_int_id WHERE
dbo.lot_hedr.lot_no = @lot_no" SelectCommand="select lot_no,
lot_hedr.manu_no, lot_hedr.item_no, drawing_rev from lot_hedr inner
join lot_info on lot_hedr.li_int_id=lot_info.li_int_id where
(bal_of_lot > 0) AND ITEM_no like '%' + @mno + '%'&#13;&#10;order by
drawing_rev desc, lot_no"><SelectParameters>
            <asp:ControlParameter ControlID="TextBox1"
DefaultValue="%" Name="mno" PropertyName="Text" />
        </SelectParameters>
        <UpdateParameters>
            <asp:Parameter Name="lot_no" />
            <asp:FormParameter FormField="drawing_rev"
Name="drawing_rev" />
        </UpdateParameters>
    </asp:SqlDataSource>
    &nbsp;&nbsp;
</asp:Content>



VB CODE

Imports System.Drawing
Partial Class report206
    Inherits System.Web.UI.Page
    'base sql below in this file

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
              If CheckBox1.Checked = True Then
            SqlDataSource1.SelectCommand = "select lot_no,
lot_hedr.manu_no, lot_hedr.item_no, drawing_rev from lot_hedr inner
join lot_info on lot_hedr.li_int_id=lot_info.li_int_id where
(bal_of_lot > 0) AND ITEM_no like '%' + @mno + '%' and len(rtrim
(drawing_rev)) > 0 "
            GridView1.DataBind()
        Else
            SqlDataSource1.SelectCommand = "select lot_no,
lot_hedr.manu_no, lot_hedr.item_no, drawing_rev from lot_hedr inner
join lot_info on lot_hedr.li_int_id=lot_info.li_int_id where
(bal_of_lot > 0) AND ITEM_no like '%' + @mno + '%' "
            GridView1.DataBind()
        End If

        'End If
    End Sub
End Class

Reply via email to