rlowe711 — 2011-05-26T11:21:37-04:00 — #1
I am using the Invoice Id number as a Hyperlink in the gridview ItemTemplate column. I need to get that number when the user checks the checkbox of that row. Problem getting the value of that Hyperlink, which is the invoice id, that I need to complete the C# code. I not understanding how to get the value of the Hyperlink control. I see the code will get me the control itself, but no idea how to get the value of the control.
for (int i = 0; i < gv_ebill.Rows.Count; i++)
GridViewRow row = gv_ebill.Rows[i];
bool isChecked = ((CheckBox)row.FindControl("ck_ebill")).Checked;
// trying to get the invoiceid from the row
int invoiceid = row.FindControl("invoiceId").
invoice = new Invoice(Convert.ToInt32(row.Cells.Text), currentClient.Practice.Id);
<asp:TemplateField HeaderText = "Id" SortExpression="id">
ID="invoiceId" runat="server" NavigateUrl='~/Invoice_Overview.aspx?Id=<%# Eval("Id") %>' ><%# Eval("Id") %></asp:HyperLink>
webcosmo — 2011-05-26T11:28:28-04:00 — #2
Not sure what you mean by value.
You can get a reference to the control like this
then you can use hl to get different aspects of it.
rlowe711 — 2011-05-26T11:34:26-04:00 — #3
I have a column with Invoice Id's like '99009' and it is a hyperlink to let the user look at the invoice. But I need to get the '99009' into my C# code to use it in the program. I can't detect how to get the Hyperlink value as an Int in C#.
wwb_99 — 2011-05-26T14:45:25-04:00 — #4
nightstalker — 2011-05-26T23:34:22-04:00 — #5
As wwb said. You need to parse / convert your hyperlinks text value into and int. Like he suggested above or using Convert.ToInt32(string value);