在链接按钮上单击,从gridview获取列值 [英] Get Column value from gridview on link button click
本文介绍了在链接按钮上单击,从gridview获取列值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用gridview,并且在那个我8链接按钮.现在在clck链接按钮上,仅此链接按钮被禁用,其他链接被启用,并且该链接按钮通过我插入数据
代码
html代码
I am using gridview and in that I 8 link button. Now on clck Link button only this link buton are disable others are enabled and this link button through i insert data
code
html code
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="reports.aspx.vb" Inherits="ACC_reports" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
<script language="javascript" type="text/javascript" src="../Scripts/calander.js"></script>
</head>
<body leftmargin="0" topmargin="0" bottommargin="0" rightmargin="0" onkeypress="CP()">
<span id="spn1" style="display:none;removed0px;removed:absolute"></span>
<form id="form1" runat="server">
<div>
<table id="tblHeader" width="100%" cellpadding="0" cellspacing="0" border="0" style="background-color:<%=db.headerBG%>;color:<%=db.headerColor%>;font-family:<%=db.headerText%>;font-weight:<%=db.headerWeight%>;font-style:<%=db.headerStyle%>;text-decoration:<%=db.headerDecoration%>;font-size:<%=db.headerSize%>px;text-align:<%=db.headerAlignment%>">
<tr>
<td>Reports</td>
</tr>
</table>
<table width="100%" border="1" cellpadding="0" cellspacing="0" id="tblForm" style="background-color:<%=db.formBG%>;color:<%=db.formColor%>;font-family:<%=db.formText%>;font-weight:<%=db.formWeight%>;font-style:<%=db.formStyle%>;text-decoration:<%=db.formDecoration%>;font-size:<%=db.formSize%>px;text-align:<%=db.formAlignment%>">
<tr>
<td width="25%">Select Executive/SiteOffice</td>
<td><asp:DropDownList ID="Drpoption" runat="server" AutoPostBack="true">
<asp:ListItem Value="0">[Select]</asp:ListItem>
<asp:ListItem Value="1">Executive</asp:ListItem>
<asp:ListItem Value="2">SiteOffice</asp:ListItem>
</asp:DropDownList></td>
<td width="25%"><asp:Label ID="lblselect" runat="server"></asp:Label></td>
<td><asp:DropDownList ID="drpexe" runat="server" Visible="false"></asp:DropDownList></td>
</tr>
<tr>
<td colspan="2">Duration From<asp:TextBox ID="txtfrmDt" runat="server" onpaste="return false;" onkeydown="return checkKey()" oncut="return false;" ToolTip="From Date" MaxLength="40"></asp:TextBox>
<img src="../Images/calander.gif" runat="server" id="img1" önclick="showTBL('txtfrmDt')" alt=""/></td>
<td colspan="2">To <asp:TextBox ID="txtToDt" runat="server" onpaste="return false;" onkeydown="return checkKey()" oncut="return false;" ToolTip="To Date" MaxLength="40"></asp:TextBox>
<img src="../Images/calander.gif" runat="server" id="img2" önclick="showTBL('txtToDt')" alt=""/></td>
</tr>
<tr style="background-color:<%=db.headerBG%>;color:<%=db.headerColor%>;font-family:<%=db.headerText%>;font-weight:<%=db.headerWeight%>;font-style:<%=db.headerStyle%>;text-decoration:<%=db.headerDecoration%>;font-size:<%=db.headerSize%>px;text-align:<%=db.headerAlignment%>">
<td colspan="4"><asp:Button ID="btnsubmit" runat="server" Text="Show" /></td>
</tr>
<tr>
<td colspan="4">
<asp:GridView ID="gvcomm" runat="server" Width="100%" AutoGenerateColumns="false" ShowFooter="true" DataKeyNames="orderitemid">
<Columns>
<asp:TemplateField HeaderText="#">
<ItemTemplate>
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Date">
<ItemTemplate>
<%#Eval("Odate") %>
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Order Code">
<ItemTemplate>
<%#Eval("orderid")%>/ <%#Eval("ordercode")%>
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Prod.">
<ItemTemplate>
<%#Eval("pname")%>
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Qty.">
<ItemTemplate>
<%#eval("quan") %>
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" />
<FooterTemplate>
<asp:Label ID="lbltotal" Text="Total" runat="server"></asp:Label>
</FooterTemplate>
<FooterStyle HorizontalAlign="center" Font-Bold="true" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Rate">
<ItemTemplate>
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Disc.">
<ItemTemplate>
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Action For Order Execution Report">
<ItemTemplate>
<asp:LinkButton ID="lnkShare" runat="server" CommandName="Edit">S</asp:LinkButton>//
<asp:LinkButton ID="lnkDeny" runat="server" CommandName="Update">D</asp:LinkButton>
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" BackColor="DarkGray" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Ord. Exe.">
<ItemTemplate>
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" BackColor="DarkGray" />
<FooterTemplate>
<asp:Label ID="lbltot" runat="server"></asp:Label>
</FooterTemplate>
<FooterStyle HorizontalAlign="center" Font-Bold="true" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Action For Sales Commission Report">
<ItemTemplate>
<asp:LinkButton ID="lnkShare1" runat="server" CommandName="Edit">S</asp:LinkButton>//
<asp:LinkButton ID="lnkDeny1" runat="server" CommandName="Update">D</asp:LinkButton>
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" BackColor="Silver" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Comm.">
<ItemTemplate>
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" BackColor="Silver"/>
</asp:TemplateField>
<asp:TemplateField HeaderText="Action For Proof Execution Charge Report">
<ItemTemplate>
<asp:LinkButton ID="lnkShare2" runat="server" CommandName="Edit">S</asp:LinkButton>//
<asp:LinkButton ID="lnkDeny2" runat="server" CommandName="Update">D</asp:LinkButton>
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" BackColor="DarkGray" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Proof Exe.">
<ItemStyle HorizontalAlign="Center" BackColor="DarkGray" />
<FooterTemplate>
<asp:Label ID="lbltot1" runat="server"></asp:Label>
</FooterTemplate>
<FooterStyle Font-Bold="true" HorizontalAlign="center" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Action For Composition Charge Report">
<ItemTemplate>
<asp:LinkButton ID="lnkShare3" runat="server" CommandName="Edit">S</asp:LinkButton>//
<asp:LinkButton ID="lnkDeny3" runat="server" CommandName="Update">D</asp:LinkButton>
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" BackColor="Silver" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Comp.">
<ItemTemplate>
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" BackColor="Silver" />
<FooterTemplate>
<asp:Label ID="lbltot2" runat="server"></asp:Label>
</FooterTemplate>
<FooterStyle HorizontalAlign="center" Font-Bold="true" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Invoice">
<ItemTemplate>
<a href="java<!-- no -->script:Add_Member=window.open('summaryinvoice.aspx?type=sales&&orderid=<%#Eval("orderid") %> ','Add_Member','width=800,height=400,top=170,left=210,scrollbars=yes');Add_Member.focus();">Orig.</a> //
<a href="java<!-- no -->script:Add_Member=window.open('perfomainvoice.aspx?type=sales&&orderid=<%#Eval("orderid") %> ','Add_Member','width=800,height=400,top=170,left=210,scrollbars=yes');Add_Member.focus();">Perf.</a>
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" />
</asp:TemplateField>
</Columns>
<HeaderStyle HorizontalAlign="center" />
</asp:GridView>
</td>
</tr>
</table>
</form>
</body>
</html>
vb.net代码
vb.net code
Partial Class ACC_reports
Inherits System.Web.UI.Page
Public db As New general
Dim dr, dr1 As Object
Dim cnt As Integer
Dim ds As New Data.DataSet
Dim composition As Double
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If db.checkUser(LCase(Application("users")), LCase(Session("loginName")), LCase(Session.SessionID)) <> "OK" Then
ClientScript.RegisterClientScriptBlock(Me.GetType(), "ddd", "<script>window.parent.location='../timeout.htm';</script>")
End If
db.setLayout(Session("uId"))
If Not IsPostBack Then
db.fillCombo(drpexe, "employee", "empname", "empid", " where 1=2")
End If
End Sub
Protected Sub drpexe_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles drpexe.SelectedIndexChanged
End Sub
Protected Sub Drpoption_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Drpoption.SelectedIndexChanged
If Drpoption.SelectedValue = "1" Then
drpexe.Visible = False
'lblselect.Text = "Select Executive"
'db.fillCombo(drpexe, "employee", "str(empid)+ +empname", "empid", " where empid in (select executiveid from salesorder where exetype=1)")
ElseIf Drpoption.SelectedValue = "2" Then
lblselect.Text = "Select Site Office"
db.fillCombo(drpexe, "siteofficemaster", "sitecode", "siteoffid", " where siteoffid in (select executiveid from salesorder where exetype=2)")
drpexe.Visible = True
End If
gvcomm.DataSource = Nothing
gvcomm.DataBind()
End Sub
Private Sub Show()
Dim status As String = ""
If txtfrmDt.Text <> "" And txtToDt.Text = "" Then status = status & " and convert(smalldatetime,a.dt1) = convert(smalldatetime,'" & txtfrmDt.Text & "')"
If txtfrmDt.Text <> "" And txtToDt.Text <> "" Then status = status & " and convert(smalldatetime,a.dt1) between convert(smalldatetime,'" & txtfrmDt.Text & "') and convert(smalldatetime,'" & txtToDt.Text & "')"
If txtfrmDt.Text = "" And txtToDt.Text = "" Then status = status & ""
If Drpoption.SelectedValue = "1" Then
Dim str As String = "select b.*,a.orderid,a.ordercode,productname as pname,b.qty as quan,a.enqdate as Odate from salesorder as a,salesorderitems as b where a.orderid=b.orderid and exetype=1 " & status & " order by convert(smalldatetime,a.enqdate)"
'Dim str As String = "select b.*,a.orderid,a.ordercode,productcode as pname,a.enqdate as Odate from salesorder as a,salesorderitems as b where a.orderid=b.orderid and exetype=1 and executiveid=" & drpexe.SelectedValue & " " & status & " order by convert(smalldatetime,a.enqdate)"
'Dim str As String = "select b.*,a.orderid,a.ordercode,productname as pname,b.qty as quan,a.enqdate as Odate from salesorder as a,salesorderitems as b where a.orderid=b.orderid and exetype=1 " & status & " order by convert(smalldatetime,a.enqdate)"
'Dim str As String = "select b.*,a.orderid,a.ordercode,productname as pname,b.qty as quan,a.enqdate as Odate from salesorder as a,salesorderitems as b where a.orderid=b.orderid and exetype=1 " & status & " order by convert(smalldatetime,a.enqdate)"
'Dim str As String = "select b.*,a.orderid,a.ordercode,productname as pname,b.qty as quan,a.enqdate as ODate from salesorder as a,salesorderitems as b where a.orderid=b.orderid and exetype=1 " & status & " order by convert(smalldatetime,a.enqdate)"
db.fillReader(str, dr)
ElseIf Drpoption.SelectedValue = "2" Then
Dim str As String = "select b.*,a.orderid,a.ordercode,productname as pname,b.qty as quan,a.enqdate as Odate from salesorder as a,salesorderitems as b where a.orderid=b.orderid and exetype=2 and executiveid=" & drpexe.SelectedValue & " " & status & " order by convert(smalldatetime,a.enqdate)"
db.fillReader(str, dr)
End If
gvcomm.DataSource = dr
gvcomm.DataBind()
End Sub
Protected Sub btnsubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnsubmit.Click
Show()
'While dr.read()
' Dim str1 As String = "select productid,qty,salescomminr,discount from salesorderitems where orderid=" & dr("orderid")
' db.fillReader(str1, dr1)
'End While
End Sub
Protected Sub gvcomm_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles gvcomm.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
e.Row.Cells(0).Text = e.Row.RowIndex + 1
cnt = cnt + 1
Dim com As Double
Dim commission As Double = 0
Dim comid As Integer
Dim compid As Integer
Dim comm As Double
Dim strId As String = gvcomm.DataKeys(e.Row.RowIndex).Value.ToString()
Dim str As String = "select * from salesorderitems where orderitemid=" & strId
db.fillReader(str, dr)
While dr.read()
e.Row.Cells(4).Text = dr("qty")
e.Row.Cells(5).Text = dr("priceINR")
e.Row.Cells(6).Text = dr("distype") & "-" & dr("discount")
If Drpoption.SelectedValue = "1" Then
e.Row.Cells(8).Text = "15"
e.Row.Cells(12).Text = "7"
If dr("qty") >= 100 Then
comid = db.getFieldValue("productmaster", "productid", strId, "salescomminr", True, True)
If dr("discount") > 0 Then
com = db.getFieldValue("salescommissionmaster", "salescommid", comid, "commwd", True, True)
Else
com = db.getFieldValue("salescommissionmaster", "salescommid", comid, "comm", True, True)
End If
commission = com
e.Row.Cells(10).Text = commission
Else
e.Row.Cells(10).Text = "0"
End If
ElseIf Drpoption.SelectedValue = "2" Then
e.Row.Cells(8).Text = "50"
e.Row.Cells(12).Text = "7"
comid = db.getFieldValue("productmaster", "productid", strId, "salescommper", True, True)
If dr("discount") > 0 Then
com = db.getFieldValue("salescommissionmaster", "salescommid", comid, "commwd", True, True)
Else
com = db.getFieldValue("salescommissionmaster", "salescommid", comid, "comm", True, True)
End If
commission = (dr("priceinr") * dr("qty") * com / 100)
e.Row.Cells(10).Text = commission
Else
e.Row.Cells(10).Text = "0"
End If
compid = db.getFieldValue("productmaster", "productid", strId, "compid", True, True)
comm = db.getFieldValue("compchargemaster", "compid", compid, "priceinr", True, True)
composition = composition + comm
e.Row.Cells(14).Text = comm
End While
Dim Share As LinkButton = CType(e.Row.FindControl("lnkShare"), LinkButton)
'AddHandler Share.Click, AddressOf showshare
Dim Deny As LinkButton = CType(e.Row.FindControl("lnkDeny"), LinkButton)
Dim Share1 As LinkButton = CType(e.Row.FindControl("lnkShare2"), LinkButton)
Dim Deny1 As LinkButton = CType(e.Row.FindControl("lnkDeny2"), LinkButton)
Dim Share2 As LinkButton = CType(e.Row.FindControl("lnkShare1"), LinkButton)
Dim Deny2 As LinkButton = CType(e.Row.FindControl("lnkDeny1"), LinkButton)
Dim Share3 As LinkButton = CType(e.Row.FindControl("lnkShare3"), LinkButton)
Dim Deny3 As LinkButton = CType(e.Row.FindControl("lnkDeny3"), LinkButton)
If db.isExists("commissionPostMaster", "orderItemID", strId, True, " and commtype='Order Execution'") = True Then
Share.Enabled = False
Deny.Enabled = False
e.Row.Cells(8).Text = e.Row.Cells(8).Text & "/" & db.getFieldValue("commissionPostMaster", "orderItemId", strId, "amount", True, True, " and plantid=" & Session("plantId") & " and commtype='Order Execution'")
If db.getFieldValue("commissionpostmaster", "orderItemId", strId, "discounttype", True, False, " and commtype='Order Execution'") = "No" Then
e.Row.Cells(8).ForeColor = Drawing.Color.Maroon
e.Row.Cells(8).Font.Bold = True
End If
End If
If db.isExists("commissionPostMaster", "orderItemID", strId, True, " and commtype='Proof Execution'") = True Then
Share1.Enabled = False
Deny1.Enabled = False
e.Row.Cells(12).Text = e.Row.Cells(12).Text & "/" & db.getFieldValue("commissionPostMaster", "orderItemId", strId, "amount", True, True, " and plantid=" & Session("plantId") & " and commtype='Proof Execution'")
If db.getFieldValue("commissionpostmaster", "orderItemId", strId, "discounttype", True, False, " and commtype='Proof Execution'") = "No" Then
e.Row.Cells(12).ForeColor = Drawing.Color.Maroon
e.Row.Cells(12).Font.Bold = True
End If
End If
If db.isExists("commissionPostMaster", "orderItemID", strId, True, " and commtype='Sales Commission'") = True Then
Share2.Enabled = False
Deny2.Enabled = False
e.Row.Cells(10).Text = e.Row.Cells(10).Text & "/" & db.getFieldValue("commissionPostMaster", "orderItemId", strId, "amount", True, True, " and plantid=" & Session("plantId") & " and commtype='Sales Commission'")
If db.getFieldValue("commissionpostmaster", "orderItemId", strId, "discounttype", True, False, " and commtype='Sales Commission'") = "No" Then
e.Row.Cells(10).ForeColor = Drawing.Color.Maroon
e.Row.Cells(10).Font.Bold = True
End If
End If
If db.isExists("commissionPostMaster", "orderItemID", strId, True, " and commtype='Composition Commission'") = True Then
Share3.Enabled = False
Deny3.Enabled = False
e.Row.Cells(14).Text = e.Row.Cells(14).Text & "/" & db.getFieldValue("commissionPostMaster", "orderItemId", strId, "amount", True, True, " and plantid=" & Session("plantId") & " and commtype='Composition Commission'")
If db.getFieldValue("commissionpostmaster", "orderItemId", strId, "discounttype", True, False, " and commtype='Composition Commission'") = "No" Then
e.Row.Cells(14).ForeColor = Drawing.Color.Maroon
e.Row.Cells(14).Font.Bold = True
End If
End If
dr.close()
End If
If e.Row.RowType = DataControlRowType.Footer Then
If Drpoption.SelectedValue = "1" Then
Dim lbl As Label = CType(e.Row.FindControl("lbltot"), Label)
Dim lbl1 As Label = CType(e.Row.FindControl("lbltot1"), Label)
Dim lbl2 As Label = CType(e.Row.FindControl("lbltot2"), Label)
Dim b As Double = 15 * cnt
Dim b1 As Double = 7 * cnt
Dim b2 As Double = composition
lbl.Text = CDbl(b)
lbl1.Text = CDbl(b1)
lbl2.Text = CDbl(b2)
Else
Dim lbl As Label = CType(e.Row.FindControl("lbltot"), Label)
Dim lbl1 As Label = CType(e.Row.FindControl("lbltot1"), Label)
Dim lbl2 As Label = CType(e.Row.FindControl("lbltot2"), Label)
Dim b As Double = 50 * cnt
Dim b1 As Double = 7 * cnt
Dim b2 As Double = composition
lbl.Text = CDbl(b)
lbl1.Text = CDbl(b1)
lbl2.Text = CDbl(b2)
End If
End If
End Sub
Protected Sub showshare(ByVal sender As Object, ByVal e As System.EventArgs)
Dim transType As String = ""
Dim com As Double
Dim commission As Double = 0
Dim comid As Integer
Dim strId As String = gvcomm.DataKeys(e.ToString()).Value.ToString()
'Dim strId As String = gvcomm.DataKeys(e.NewEditIndex).Value.ToString()
Dim commid As Integer = db.getMaxId("commissionPostMaster", "commid")
Dim orderId As String = ""
Dim ordercode As String = ""
Dim orderItemId As String = ""
Dim disType As String = ""
Dim discount As String = ""
Dim Odate As String = ""
Dim priceINR As String = ""
Dim qty As String = ""
Dim a As String
Dim b As String
Dim strqry As String = "select * from salesorderitems where orderitemid=" & strId
db.fillReader(strqry, dr)
While dr.read()
orderId = dr("orderId")
ordercode = dr("orderCode")
orderItemId = strId
disType = dr("distype")
discount = dr("discount")
Odate = db.getFieldValue("salesOrder", "orderId", orderId, "enqdate", True)
priceINR = dr("priceINR")
qty = dr("qty")
End While
dr.close()
Dim dt = Date.Now.ToString("dd-MMM-yyyy")
If Drpoption.SelectedValue = "1" Then
com = "15"
ElseIf Drpoption.SelectedValue = "2" Then
com = "50"
End If
commission = com
transType = "INR"
Dim str As String = "insert into commissionPostMaster values(" & commid & "," & Session("plantId") & "," & _
orderId & "," & orderItemId & ",'" & ordercode & "','Order Execution',0,0,'" & transType & "'," & _
commission & ",'" & Odate & "','Yes'," & Session("uID") & ",'" & dt & "')"
db.executeQuery(str)
End Sub
Protected Sub gvcomm_RowEditing(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewEditEventArgs) Handles gvcomm.RowEditing
gvcomm.EditIndex = e.NewEditIndex
Dim transType As String = ""
Dim com As Double
Dim commission As Double = 0
Dim comid As Integer
Dim strId As String = gvcomm.DataKeys(e.NewEditIndex).Value.ToString()
Dim commid As Integer = db.getMaxId("commissionPostMaster", "commid")
Dim orderId As String = ""
Dim ordercode As String = ""
Dim orderItemId As String = ""
Dim disType As String = ""
Dim discount As String = ""
Dim Odate As String = ""
Dim priceINR As String = ""
Dim qty As String = ""
Dim strqry As String = "select * from salesorderitems where orderitemid=" & strId
db.fillReader(strqry, dr)
While dr.read()
orderId = dr("orderId")
ordercode = dr("orderCode")
orderItemId = strId
disType = dr("distype")
discount = dr("discount")
Odate = db.getFieldValue("salesOrder", "orderId", orderId, "enqdate", True)
priceINR = dr("priceINR")
qty = dr("qty")
End While
dr.close()
Dim dt = Date.Now.ToString("dd-MMM-yyyy")
Dim Share As LinkButton = CType(gvcomm.Rows(e.NewEditIndex).FindControl("lnkShare"), LinkButton)
Dim Share1 As LinkButton = CType(gvcomm.Rows(e.NewEditIndex).FindControl("lnkShare2"), LinkButton)
Dim Share2 As LinkButton = CType(gvcomm.Rows(e.NewEditIndex).FindControl("lnkShare1"), LinkButton)
Dim Share3 As LinkButton = CType(gvcomm.Rows(e.NewEditIndex).FindControl("lnkShare3"), LinkButton)
AddHandler Share.Click, AddressOf showshare
If Drpoption.SelectedValue = "1" Then
com = "15"
ElseIf Drpoption.SelectedValue = "2" Then
com = "50"
End If
commission = com
transType = "INR"
Dim str As String = "insert into commissionPostMaster values(" & commid & "," & Session("plantId") & "," & _
orderId & "," & orderItemId & ",'" & ordercode & "','Order Execution',0,0,'" & transType & "'," & _
commission & ",'" & Odate & "','Yes'," & Session("uID") & ",'" & dt & "')"
db.executeQuery(str)
commission = "7"
transType = "INR"
Dim str1 As String = "insert into commissionPostMaster values(" & commid & "," & Session("plantId") & "," & _
orderId & "," & orderItemId & ",'" & ordercode & "','Proof Execution',0,0,'" & transType & "'," & _
commission & ",'" & Odate & "','Yes'," & Session("uID") & ",'" & dt & "')"
db.executeQuery(str1)
If Drpoption.SelectedValue = "1" Then
If qty >= 100 Then
'"select salescomminr from productmaster where productid=" & dr("productid")
comid = db.getFieldValue("productmaster", "productid", strId, "salescomminr", True, True)
If discount > 0 Then
com = db.getFieldValue("salescommissionmaster", "salescommid", comid, "commwd", True, True)
Else
com = db.getFieldValue("salescommissionmaster", "salescommid", comid, "comm", True, True)
End If
commission = com
Else
commission = "0"
End If
transType = "INR"
ElseIf Drpoption.SelectedValue = "2" Then
comid = db.getFieldValue("productmaster", "productid", strId, "salescommper", True, True)
If discount > 0 Then
com = db.getFieldValue("salescommissionmaster", "salescommid", comid, "commwd", True, True)
Else
com = db.getFieldValue("salescommissionmaster", "salescommid", comid, "comm", True, True)
End If
commission = (priceINR * qty * com / 100)
If disType = "INR" Then
commission = commission - (discount * qty * 0.5)
ElseIf disType = "PER" Then
commission = commission - (((priceINR * qty * discount) / 100) / 2)
End If
transType = "PER"
Else
commission = "0"
End If
Dim str2 As String = "insert into commissionPostMaster values(" & commid & "," & Session("plantId") & "," & _
orderId & "," & orderItemId & ",'" & ordercode & "','Sales Commission'," & Drpoption.SelectedValue & "," & _
drpexe.SelectedValue & ",'" & transType & "'," & commission & ",'" & Odate & "','Yes'," & Session("uID") & ",'" & dt & "')"
db.executeQuery(str2)
comid = db.getFieldValue("productmaster", "productid", strId, "salescomminr", True, True)
If discount > 0 Then
com = db.getFieldValue("compchargemaster", "compid", comid, "priceinr", True, True)
Else
com = db.getFieldValue("compchargemaster", "compid", comid, "priceinr", True, True)
End If
commission = com
transType = "INR"
Dim str3 As String = "insert into commissionPostMaster values(" & commid & "," & Session("plantId") & "," & _
orderId & "," & orderItemId & ",'" & ordercode & "','Composition Commission',0,0,'" & transType & "'," & _
commission & ",'" & Odate & "','Yes'," & Session("uID") & ",'" & dt & "')"
db.executeQuery(str3)
Show()
End Sub
Protected Sub gvcomm_RowUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles gvcomm.RowUpdating
Dim transType As String = ""
Dim com As Double
Dim commission As Double = 0
Dim comid As Integer
Dim strId As String = gvcomm.DataKeys(e.RowIndex).Value.ToString()
Dim commid As Integer = db.getMaxId("commissionPostMaster", "commid")
Dim orderId As String = ""
Dim ordercode As String = ""
Dim orderItemId As String = ""
Dim disType As String = ""
Dim discount As String = ""
Dim Odate As String = ""
Dim priceINR As String = ""
Dim qty As String = ""
'Dim ass = gvcomm.Rows(e.RowIndex).Cells(0).Text
Dim Deny As LinkButton = CType(gvcomm.Rows(e.RowIndex).FindControl("lnkDeny"), LinkButton)
Dim Deny1 As LinkButton = CType(gvcomm.Rows(e.RowIndex).FindControl("lnkDeny2"), LinkButton)
Dim Deny2 As LinkButton = CType(gvcomm.Rows(e.RowIndex).FindControl("lnkDeny1"), LinkButton)
Dim Deny3 As LinkButton = CType(gvcomm.Rows(e.RowIndex).FindControl("lnkDeny3"), LinkButton)
Dim strqry As String = "select * from salesorderitems where orderitemid=" & strId
db.fillReader(strqry, dr)
While dr.read()
orderId = dr("orderId")
ordercode = dr("orderCode")
orderItemId = strId
disType = dr("distype")
discount = dr("discount")
Odate = db.getFieldValue("salesOrder", "orderId", orderId, "enqdate", True)
priceINR = dr("priceINR")
qty = dr("qty")
End While
dr.close()
Dim dt = Date.Now.ToString("dd-MMM-yyyy")
If Drpoption.SelectedValue = "1" Then
com = "0"
ElseIf Drpoption.SelectedValue = "2" Then
com = "0"
End If
transType = "INR"
Dim str As String = "insert into commissionPostMaster values(" & commid & "," & Session("plantId") & "," & _
orderId & "," & orderItemId & ",'" & ordercode & "','Order Execution',0,0,'" & transType & "'," & _
commission & ",'" & Odate & "','No'," & Session("uID") & ",'" & dt & "')"
db.executeQuery(str)
'code for proof execution report
If qty >= 100 Then
comid = db.getFieldValue("compchargemaster", "compid", comid, "priceinr", True, True)
commission = "0"
Else
commission = "0"
End If
transType = "INR"
Dim str1 As String = "insert into commissionPostMaster values(" & commid & "," & Session("plantId") & "," & _
orderId & "," & orderItemId & ",'" & ordercode & "','Proof Execution',0,0,'" & transType & "'," & _
commission & ",'" & Odate & "','No'," & Session("uID") & ",'" & dt & "')"
db.executeQuery(str1)
'code for sales report
If Drpoption.SelectedValue = "1" Then
If qty >= 100 Then
comid = db.getFieldValue("productmaster", "productid", strId, "salescomminr", True, True)
commission = "0"
Else
commission = "0"
End If
transType = "INR"
ElseIf Drpoption.SelectedValue = "2" Then
comid = db.getFieldValue("productmaster", "productid", strId, "salescommper", True, True)
If discount > 0 Then
com = db.getFieldValue("salescommissionmaster", "salescommid", comid, "commwd", True, True)
Else
com = db.getFieldValue("salescommissionmaster", "salescommid", comid, "comm", True, True)
End If
commission = (priceINR * qty * com / 100)
If disType = "INR" Then
commission = commission - (discount * qty)
ElseIf disType = "PER" Then
commission = commission - (((priceINR * qty * discount) / 100))
End If
transType = "PER"
Else
commission = "0"
End If
Dim str2 As String = "insert into commissionPostMaster values(" & commid & "," & Session("plantId") & "," & _
orderId & "," & orderItemId & ",'" & ordercode & "','Sales Commission'," & Drpoption.SelectedValue & "," & _
drpexe.SelectedValue & ",'" & transType & "'," & commission & ",'" & Odate & "','No'," & Session("uID") & ",'" & dt & "')"
db.executeQuery(str2)
'code for composition chrge report
If qty >= 100 Then
comid = db.getFieldValue("compchargemaster", "compid", comid, "priceinr", True, True)
commission = "0"
Else
commission = "0"
End If
transType = "INR"
Dim str3 As String = "insert into commissionPostMaster values(" & commid & "," & Session("plantId") & "," & _
orderId & "," & orderItemId & ",'" & ordercode & "','Composition Commission',0,0,'" & transType & "'," & _
commission & ",'" & Odate & "','No'," & Session("uID") & ",'" & dt & "')"
db.executeQuery(str3)
Show()
End Sub
End Class
推荐答案
This is an annoyingly huge code dump, which tells us you don''t know enough to point out just the relevant code. No-one will read it all. To have a link pass a value, put the value you want, on the URL of the link, so you can read it from the querystring.
Also, when you ask an ASP.NET question, please tag it as such
This is an annoyingly huge code dump, which tells us you don''t know enough to point out just the relevant code. No-one will read it all. To have a link pass a value, put the value you want, on the URL of the link, so you can read it from the querystring.
Also, when you ask an ASP.NET question, please tag it as such
这篇关于在链接按钮上单击,从gridview获取列值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文