Last post Mar 19, 2007 09:04 PM by sharpeeuk
Mar 18, 2007 11:59 AM|sharpeeuk|LINK
On the MemberDetails.aspx page I am trying to use GridView that will show just the details for the user in the link (i.e. James)
On the client side I have some java script to pick off the user name (and some other info perhaps later)
window.onload = getUserName;
One the server side I have:
Member.Text = HiddenControl1.Value.ToString()
with the control specified as:
When the MemberDetails.aspx page is loaded as MemberDetails.aspx?UserName=James then the label
shows up on the loaded page as James. However, the Text property is not set to James. (I checked this with another label id "check" with server script check.Text = HiddenControl1.Value.ToString() this did not appear on the loaded web page)
I am not sure I have understood how the text property is being set. Could someone please help with an explanation and a possible solution.
Mar 18, 2007 01:32 PM|deblendewim|LINK
document.getElementById("Member").innerHTML = value.toString();
Thats wrong. When your set the innerHtml, its the value between the html tags you set. Example. <asp:Label ID="member">This Is InnerHtml Text<asp:Label />
What you need to do is this i think:
document.getElementById("Member").Text = value.toString();
Maybe a better way to get the username on the page with the gridview (MemberDetails.aspx) is like this:
You open the page with an url parameter like this:
Then in the Load of the page MemberDetails you do this:
Dim userName as String = Request.Params("UserName")
Then the string userName will be James, and then on the page MemberDetails you can use that variable to filter the gridview
Hope this helps!
Mar 18, 2007 04:44 PM|NC01|LINK
The Text property is a server-side only property. Client-side (getElementById('<%= yourLabel.ClientID %>')) you have to use either innerHTML or innerText, but one works with all browsers and one only works with IE (I forget which).
BTW, your problem might be that you're using an incorrect ID for the element, if the element is inside of a second container. The example above will work with all possibilities.
Mar 19, 2007 09:04 PM|sharpeeuk|LINK
In the end I used:
Member.Text = userName.ToString
Not sure if this is best, but it worked fine.
Thanks again to both for the great help