Re: Code to "click" a button -- is this possible?



Sorry, I guess I forgot to paste my exact code line aswell...here it is:

(Page.FindControl("btnTest") as Button).Click.Invoke(this, new EventArgs());

And I am recieving the error as described by my last post.

Thanks again for all the help! Hopefully this will be resolved soon.
Ben



"Nate" wrote:

Ben,

I would not be C# code. It would be javascript. Once the client receives
the HTML output from the ASP.NET page, C# no longer has any control (its all
on the client now). It is important to understand the distinction between
server-side and client-side which is inherit in all dynamic web applications.
The server sends HTML, CSS, and javascript (or jscript or vbscript) to the
client. The client (an Internet Browser, like IE or FireFox) then decides
what to do with the HTML, CSS, and script that was sent to it. One way to
look at is that the web server simply makes a suggestion to the browser. It
suggests it should render certain UI elements and run certain client-side
scripts. Its up to the browser to comply. It doesn't have to. The web
server can't control the actions of the browser. For instance, if a browser
has scripting disabled or isn't compliant with all the CSS that was sent to
it... then it will look and act very differently than it was designed to.
There are ways around this, but it involves detecting the capabilities of the
browser that made a request for the page.

Now, to answer your question. Here is the javascript used to reload a iframe:

<iframe name='content'></iframe>
<script language='javascript'>
parent.frames.item('content').location.href = 'mypage.aspx';
</script>

"Ben" wrote:

could you please supply the code that can be called from the C# method that
will refresh another frame called "Main"?

thanks. I am not familiar with javascripting.

ben

"Ignacio Machin ( .NET/ C# MVP )" wrote:

Hi,

"Ben" <ben_1_ AT hotmail DOT com> wrote in message
news:8407364A-FDA4-424C-B268-C2E80EB9094F@xxxxxxxxxxxxxxxx
Hello

I have frames set up in an asp.net application and need one frame to
refresh
another. Seeing as events need to be registered at the time the page is
sent
from the server, I was wondering if I could place a hidden button in a
frame
that would have the attribute to refresh the other. I would need code to
"invoke" the onclick event (ie i need code to click the button).

is this possible?

you can refresh any of the frames using javascript, you can either Refresh
the frame, submit the form , or call a method to a control (like button
click ) these actions will refresh the form


--
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation




.