what I am trying to do is that to capture the value of the value of the contract id from the returned rows and pass to the procedure. when the user click the link in the gridview the value of the contract id is passed to the procedur.
how can I do this.right now as you can see in the code I hard code the value in the procedure for testing. thank you for the help here is the hardcoded value "8826-63
how can I do this.right now as you can see in the code I hard code the value in the procedure for testing. thank you for the help here is the hardcoded value "8826-63
Code:
<asp:GridView ID="gvabstract" runat="server"
AutoGenerateColumns="False"
GridLines="None"
CssClass="mGrid"
HorizontalAlign="Left"
OnRowDataBound = "gvabstract_RowDataBound"
AlternatingRowStyle-CssClass="alt" Width="100%"
>
<Columns>
<asp:BoundField DataField="lettingdate" HeaderText="Letting Date" >
<HeaderStyle Wrap="False" />
<ItemStyle Wrap="False" />
</asp:BoundField>
<asp:TemplateField HeaderText="View Abstract">
<ItemTemplate>
<asp:HyperLink ID="lnkUrl" runat="server" Target="_blank" Text='<%# Eval("contractid","Abstract (PDF)") %>' > </asp:HyperLink>
</ItemTemplate>
<HeaderStyle Wrap="False" />
<ItemStyle Wrap="False" />
</asp:TemplateField>
<asp:TemplateField HeaderText="View Abstract ">
<ItemTemplate>
<asp:LinkButton ID="lnk_CustomerID" Text='<%# Bind("contractid","Abstract (CSV)" )%>' runat="server" OnClick="abstract_Click"></asp:LinkButton>
</ItemTemplate>
<HeaderStyle Wrap="False" />
<ItemStyle Wrap="False" />
</asp:TemplateField>
<asp:BoundField DataField="contractid" HeaderText="Contract Id" >
<HeaderStyle Wrap="False" />
<ItemStyle Wrap="False" />
</asp:BoundField>
<asp:BoundField DataField="projectnumber" HeaderText="S.P Number" >
<HeaderStyle Wrap="False" />
<ItemStyle Wrap="False" />
</asp:BoundField>
<asp:BoundField DataField="routenumber" HeaderText="Route Number" >
<HeaderStyle Wrap="False" />
<ItemStyle Wrap="False" />
</asp:BoundField>
<asp:BoundField DataField="statusdate" HeaderText="Posted Date" >
<HeaderStyle Wrap="False" />
<ItemStyle Wrap="False" />
</asp:BoundField>
<asp:BoundField DataField="jobdescription" HeaderText="Job Description" >
<HeaderStyle Wrap="False" />
</asp:BoundField>
<asp:BoundField DataField="LOCATION" HeaderText="Location" >
<HeaderStyle Wrap="False" />
</asp:BoundField>
</Columns>
<FooterStyle CssClass="alt" />
<AlternatingRowStyle CssClass="alt"></AlternatingRowStyle>
</asp:GridView>
Code:
Protected Sub abstract_Click(ByVal sender As Object, ByVal e As System.EventArgs)
oOracleConn.Open()
bidderItemPrice()
Dim filename As String
filename = "abstract.csv"
Response.ContentType = "Application/x-csv"
Response.AddHeader("content-disposition", "attachment;filename=""" & filename & """")
Response.Write(sb.ToString)
Response.End()
oOracleConn.Close()
End Sub
Sub bidderItemPrice()
Dim drbidderItemPrice As OracleDataReader
Dim j As Integer = 0
Dim cmdbidderItemPrice As OracleCommand = New OracleCommand()
cmdbidderItemPrice.Connection = oOracleConn
cmdbidderItemPrice.CommandType = CommandType.Text
With cmdbidderItemPrice
.Connection = oOracleConn
.CommandText = "bid_items_price_quote"
.CommandType = CommandType.StoredProcedure
.Parameters.Clear()
End With
cmdbidderItemPrice.Parameters.Add(New OracleParameter("p_spnumber", OracleDbType.Varchar2)).Value = "8826-63"
cmdbidderItemPrice.Parameters.Add(New OracleParameter("p_result", OracleDbType.RefCursor)).Direction = ParameterDirection.Output
drbidderItemPrice = cmdbidderItemPrice.ExecuteReader()
'For field name
For j = 0 To drbidderItemPrice.FieldCount - 1
If j < (drbidderItemPrice.FieldCount - 1) Then
sb.Append(Chr(34) & drbidderItemPrice.GetName(j) & Chr(34) & ",")
Else
sb.Append(Chr(34) & drbidderItemPrice.GetName(j) & Chr(34) & vbCrLf)
End If
Next
'For field value
While drbidderItemPrice.Read()
For j = 0 To drbidderItemPrice.FieldCount - 1
If j < (drbidderItemPrice.FieldCount - 1) Then
sb.Append(Chr(34) & drbidderItemPrice.GetValue(j).ToString.Replace(Chr(34), Chr(34) & Chr(34)) & Chr(34) & ",")
Else
sb.Append(Chr(34) & drbidderItemPrice.GetValue(j).ToString & Chr(34) & vbCrLf)
End If
Next
End While
sb.Append(vbCrLf)
End Sub