Skip to main content

Microsoft Silverlight

Answered Question HtmlElement Question:RSS Feed

(0)

TehShlock
TehShlock

Member

Member

74 points

34 Posts

HtmlElement Question:

Hey Guys,

I've only just started using Silverlight, and I have a quick question. On my .xaml page I have a simple login routine written w/ silverlight. Now my 2 HTML elements are input boxes, UID & PID (Username, Password) and I have 2 buttons, a Submit (which works fine) and a Reset (which dosen't work at all.) Now here's my question:

I'm want my ResetMethod to clear the contents of the UID & PID input fields. I've tried using .Remove :

UID.GetAttribute("value").Remove
PID.GetAttribute("value").Remove(1,30);

My issue is, I don't know the correct syntax for Remove, and I tried my best and failed, so I'm asking for some help with my code.

Thanks in advance to anyone that can help me out. I'm positive someone out there has done this before or at least knows how.

Sopheap Ly
Sopheap Ly

Participant

Participant

902 points

205 Posts

Answered Question

Re: HtmlElement Question:

Try this: 

UID.SetAttribute("value", String.Empty)

PID.SetAttribute("value", String.Empty)

The GetAttribute() didn't work because it returns a String which is passed by value. The Remove() is a member of String, so it only modifies the string. I suggest you look up "pass by reference" and "pass by value".

If this answers your question, please click "Mark as Answer" 

TehShlock
TehShlock

Member

Member

74 points

34 Posts

Re: Re: HtmlElement Question:

Thanks, that did work. I wasn't even thinking about the GetAttribute tag, I was focusing on what to do with the value that was being returned. *_*

Sopheap Ly
Sopheap Ly

Participant

Participant

902 points

205 Posts

Re: Re: Re: HtmlElement Question:

You're welcome, mate.

If this answers your question, please click "Mark as Answer" 

  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities