add an hidden field to the itemTemplate, and set its id to
"HidMyHidden"
add a button (Button1) in the page (outside FormView1)
change te name of the Partial Class to match your real Class name
Imports System.Text
Partial Class frmReport
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
Dim sb As New StringBuilder()
sb.AppendLine("function alertTheId(trueHiddenId)")
sb.AppendLine("{")
sb.AppendLine(" var hidCtl=
document.getElementById(trueHiddenId);")
sb.AppendLine(" alert(trueHiddenId + ' value= ' +
hidCtl.value);")
sb.AppendLine(" return true;")
sb.AppendLine("}")
If Not
ClientScript.IsClientScriptBlockRegistered("TheTrueID") Then
ClientScript.RegisterClientScriptBlock(Me.GetType(),
"TheTrueID", sb.ToString(), True)
End If
'serverside you have the id you read in code
Dim hidCtl As HiddenField =
FormView1.FindControl("HidMyHidden")
Dim theclientId As String = ""
'be sure you get it, as I added it only in itemTemplate...
If Not hidCtl Is Nothing Then
theclientId = hidCtl.ClientID
Else
theclientId = "Not Found!!"
End If
Button1.OnClientClick = "javascript: return alertTheId('"
& theclientId & "')"
End If
End Sub
On 5 Feb, 10:42, Jamie Fraser <[email protected]> wrote:
> FormView1.FindControl("ShipAddressID")
>
> You are nearly there - what you need to do is fine the ID of the actual
> control you want - although you gave the input an ID of "ShipAddressID",
> you'll find that this is rendered out as something differently - I've seen
> things like
>
> ctl00__formview1__shipaddressId
>
> Dependant on your nesting, use of master pages etc.
>
> Have a look at the rendered HTML to find the actual control name.
>
> btw, off topic, but the phrase you used "user could care less about" is
> wrong, the correct usage is "user couldn't care less about" as they have
> diametric meanings!
>
>
>
> On Thu, Feb 4, 2010 at 1:49 PM, Chatur <[email protected]> wrote:
> > FormView1.FindControl("ShipAddressID")- Nascondi testo citato
>
> - Mostra testo citato -