0
我想在aspx頁面上欄添加和值是來自不同勢查詢不同勢查詢和獲取參數值,輸入值項目模板,在GridView
是我的ASPX的datagridview:
<asp:Panel ID="pnlGrid" runat="server" align="center">
<asp:Label ID="lbldgTime" runat="server" Text=" "></asp:Label><br />
<asp:GridView ID="gvData" runat="server" AllowPaging="True" AutoGenerateColumns="False"
EmptyDataText="No data available." CellPadding="4" DataKeyNames="PayId" Font-Size="13px"
ForeColor="Black" PageSize="20" Width="100%" Style="text-align: center">
<Columns>
<asp:TemplateField>
<ItemStyle HorizontalAlign="Center" Width="20px" />
<FooterStyle HorizontalAlign="Left" />
<ItemTemplate>
<asp:ImageButton ID="imgbtn" ImageUrl="~/Img/view.png" runat="server" Width="25"
Height="25" OnClick="imgbtn_Click" />
</ItemTemplate>
<EditItemTemplate>
</EditItemTemplate>
<FooterTemplate>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="No Account">
<ItemStyle HorizontalAlign="Center" Width="100px" />
<FooterStyle HorizontalAlign="Left" />
<ItemTemplate>
<asp:Label ID="lblNoaccount" runat="server" Text='<%# Bind("PayAccount") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
</EditItemTemplate>
<FooterTemplate>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Customer Name">
<ItemStyle HorizontalAlign="Center" Width="150px" />
<FooterStyle HorizontalAlign="Left" />
<ItemTemplate>
<asp:Label ID="lblCustName" runat="server" Text='<%# Bind("PayCustName") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Amount">
<ItemStyle HorizontalAlign="Center" Width="20px" />
<FooterStyle HorizontalAlign="Left" />
<ItemTemplate>
<asp:Label ID="lblAmount" runat="server" Text='<%# Bind("PayAmount") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Amount Paid">
<ItemStyle HorizontalAlign="Center" Width="40px" />
<FooterStyle HorizontalAlign="Left" />
<ItemTemplate>
<asp:Label ID="lblRefNo" runat="server" Text='<%# Bind("PayRefNo") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Response">
<ItemStyle HorizontalAlign="Center" Width="70px" />
<FooterStyle HorizontalAlign="Center" />
<ItemTemplate>
<asp:Label ID="lblResponse" runat="server" Text='<%# Bind("PayResponse") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
領域:
<asp:TemplateField HeaderText="Response">
<ItemStyle HorizontalAlign="Center" Width="70px" />
<FooterStyle HorizontalAlign="Center" />
<ItemTemplate>
<asp:Label ID="lblResponse" runat="server" Text='<%# Bind("PayResponse") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
值是來自不同勢查詢時佔滿DataGrid,
,這裏是我的DataGrid的背後代碼:
Sub FillData()
Try
Dim dt As New DataTable
Me.lbleMessage.Text = ""
If txtDate.Text = "__/__/____" Then
txtDate.Text = ""
End If
If CPayment.SearchPayment(txtAccount.Text.Trim, txtCustName.Text.Trim, txtAmount.Text, txtAmountPaid.Text, dropResponse.SelectedValue.ToString, txtRefNo.Text.Trim, txtDate.Text) Then
dt = CPayment.DT
Else
eMessage("System failure: ", CPayment.eMsg)
End If
Dim RC As Integer = dt.Rows.Count
totalrows = RC
If RC = 0 Then
'dt.Rows.Add()
dt.Clear()
gvData.DataSource = dt.DefaultView
gvData.DataBind()
eMessage("", "There are no row to display.")
Else
gvData.DataSource = dt.DefaultView
gvData.DataBind()
gvData.BottomPagerRow.Visible = True
End If
Catch ex As Exception
eMessage("Load Data failure: ", ex.ToString())
End Try
End Sub
,這裏是爲響應字段的查詢:
Public Function Revstatus(ByVal PayRefNo As String) As Boolean
Dim strsql As String = " Select COUNT(*) from payment(Pay) inner(Join) Reversal(Rev) on Pay.PayRefNo = Rev.PayRefNo where Pay.PayRefNo ='%" & PayResponse & "%'"
Return runQuery(strsql)
End Function
的ByVal PayRefNo As String
參數來自
<asp:TemplateField HeaderText="Amount Paid">
<ItemStyle HorizontalAlign="Center" Width="40px" />
<FooterStyle HorizontalAlign="Left" />
<ItemTemplate>
<asp:Label ID="lblRefNo" runat="server" Text='<%# Bind("PayRefNo") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
是有可能在填充數據網格時在數據網格上輸入不同的查詢?