|
|
|
บางคอลัมน์ใน gridview ผมมีปัญหา นี่ กริดวิวผม <asp:GridView ID="dgvShipList" runat="server |
|
|
|
|
|
|
|
นี่ กริดวิวผม
<asp:GridView ID="dgvShipList" runat="server" AutoGenerateColumns="False"
CellPadding="4" ForeColor="#333333" GridLines="None" Width="686px">
<RowStyle BackColor="#EFF3FB" />
<Columns>
<asp:BoundField HeaderText="Barcode" ReadOnly="True" DataField="ProdBarcode" >
<HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="80px" />
</asp:BoundField>
<asp:BoundField HeaderText="Order ID" ReadOnly="True" DataField="OrderID" >
<HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="80px" />
</asp:BoundField>
<asp:BoundField HeaderText="Name" ReadOnly="True" DataField="ProdName" >
<HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="80px" />
</asp:BoundField>
<asp:BoundField HeaderText="Category" ReadOnly="True"
DataField="ProdCategory" >
<HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="100px" />
</asp:BoundField>
<asp:BoundField DataField="ProdPackSize" HeaderText="Pack Size">
<HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
</asp:BoundField>
<asp:BoundField DataField="WHP" HeaderText="Warehouse Position" ReadOnly="True">
<HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="80px" />
</asp:BoundField>
<asp:BoundField HeaderText="Shipped Qty" ReadOnly="True"
DataField="QtyShipped" >
<HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="60px" />
</asp:BoundField>
<asp:BoundField DataField="QtyInStock" HeaderText="InStock Qty" ReadOnly="True">
<HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="60px" />
</asp:BoundField>
<asp:TemplateField HeaderText="Qty">
<ItemTemplate>
<asp:Label ID="lblQty" runat="server"></asp:Label>
</ItemTemplate>
<HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
<ItemStyle HorizontalAlign="Right" VerticalAlign="Middle" Width="30px" />
</asp:TemplateField>
</Columns>
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<EditRowStyle BackColor="#2461BF" />
<AlternatingRowStyle BackColor="White" />
</asp:GridView>
อันนี้ เป็นตัว คิวรี่ กับ binding ผม
Session["Quantity"] = txtQty.Text;
sb.Append("SELECT tranProductOrder.Prod_Barcode as ProdBarcode, ");
sb.Append("tranProductOrder.Order_ID as OrderID, ");
sb.Append("masProduct.Prod_Name as ProdName, ");
sb.Append("tabCategory.Category_Name as ProdCategory, ");
sb.Append("tabPackageSize.Pack_Size as ProdPackSize, ");
sb.Append("masWarehousePosition.WHP_ID as WHP, ");
sb.Append("tranProductOrder.PO_ProdQty_Shipped as QtyShipped, ");
sb.Append("masStock.Prod_QtyInStock as QtyInStock ");
sb.Append("FROM tranProductOrder, masBarcode, masStock, masWarehousePosition, ");
sb.Append("masProduct, tabCategory, tabPackageSize ");
sb.Append("WHERE tranProductOrder.Prod_Barcode = masBarcode.Prod_Barcode ");
sb.Append("AND masBarcode.Prod_ID = masProduct.Prod_ID ");
sb.Append("AND masProduct.Category_ID = tabCategory.Category_ID ");
sb.Append("AND masBarcode.Prod_Barcode = masStock.Prod_Barcode ");
sb.Append("AND masBarcode.Pack_ID = tabPackageSize.Pack_ID ");
sb.Append("AND tranProductOrder.Prod_Barcode = @Barcode ");
sb.Append("AND tranProductOrder.Order_ID = @OrdID ");
sb.Append("AND masWarehousePosition.WHP_ID = @WHPid ");
string sqlShip = sb.ToString();
SqlCommand com = new SqlCommand();
com.CommandType = CommandType.Text;
com.CommandText = sqlShip;
com.Parameters.Clear();
com.Parameters.Add("@Barcode", SqlDbType.VarChar).Value = txtBarcode.Text;
com.Parameters.Add("@OrdID", SqlDbType.VarChar).Value = Session["tempOrderID"].ToString();
com.Parameters.Add("@WHPid", SqlDbType.VarChar).Value = ddlWHP.SelectedValue.ToString() ;
com.Connection = Conn;
SqlDataReader dr;
dr = com.ExecuteReader();
if (dr.HasRows)
{
if (Session["dtShipping"] != null)
{
DataTable dtShipList = (DataTable)Session["dtShipping"];
dtShipList.Load(dr);
Session["dtShipping"] = dtShipList;
dgvShipList.DataSource = Session["dtShipping"];
dgvShipList.DataBind();
dgvShipList.Visible = true;
txtBarcode.Text = "";
ddlWHP.SelectedValue = "0000000000";
txtOrderID.Text = "";
txtQty.Text = "";
txtBarcode.Enabled = true;
ddlWHP.Enabled = false;
txtOrderID.Enabled = false;
txtQty.Enabled = false;
btnClear.Enabled = true;
btnSubmit.Enabled = true;
txtBarcode.Focus();
}
else
{
dtShipList.Load(dr);
Session["dtShipping"] = dtShipList;
dgvShipList.DataSource = Session["dtShipping"];
dgvShipList.DataBind();
dgvShipList.Visible = true;
}
}
dr.Close();
Barcode || Order ID || Name || Category || Pack Size || Warehouse Position || Shipped Qty || InStock Qty || Qty
แต่ไอ้ช่อง Qty ผมมันไม่โชว์จาก เทกซ์บอกที่ให้ user ใส่อะ
ช่วยผมแก้โค้ดจะดีมากมากเลยครับ
Tag : - - - -
|
|
|
|
|
|
Date :
2009-02-10 21:09:09 |
By :
mixarstudio |
View :
1753 |
Reply :
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 05
|