Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trying to get a hidden field value, which is inside a Repeater control 1

Status
Not open for further replies.

cesark

Programmer
Dec 20, 2003
621
Somebody knows how can I get a hidden field value inside a repeater control? I mean simply access to hidden field value.

I tried this:
Code:
dim itm as RepeaterItem = Ctype(Ctype(sender, control).NamingContainer, RepeaterItem)
Dim offer_num As Int64
 offer_num = CType(itm.FindControl("of_num"), hidden).Value

But it doesn’ t work, I receive this error:
Type 'hidden' is not defined.
Line 301: offer_num = CType(itm.FindControl("of_num"), hidden).Value


Thank you
 
What do you mean by hidden field? If you want to find the value of a column, use
e.Item.DataItem(<index>).value()
 
I mean for example this hidden field which stores a value: (in bold)
Code:
...  
<td><asp:hyperlink ID="offer_detail" NavigateUrl='<%# "offer_detail.aspx?Id=" & DataBinder.Eval(Container.DataItem, "Offer_id") %>' Text='<%# Server.HtmlEncode(DataBinder.Eval(Container.DataItem, "Offer_title")) %>'
                  runat="server"></asp:hyperlink>[b]<input type="hidden" id="of_num" value='<%# DataBinder.Eval(Container.DataItem, "Offer_id") %>' runat="server" />[/b]</td>
<td><asp:dropdownlist id=”status_options“ DataTextField=”...” DataValueField=”...” runat=”server” /></td>
<td><asp:button id=”save_changes” onClick=”prepare” runat=”server” text=”Update” /></td>

...
  </itemtemplate>
</asp:repeater>

How you would get the value of this hidden field?
In this way? : e.Item.DataItem("of_num").value()

Thank you to answer
 
You can't convert the item to a type of "hidden" as hidden isn't a valid type. If you are trying to convert something to a type of a hidden HTML control, you would have to use:
Code:
CType(WhateverObject, HtmlInputHidden)
but remember, if it's a HTML control you probably don't have a reference to it anyways (unless you have set it to run at the server, which would seem fairly odd anyway).


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
I just thought it sounded odd as I couldn't think of a situation where I would need to use one.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top