Showing posts with label button. Show all posts
Showing posts with label button. Show all posts

Saturday, March 31, 2012

SendKeys In A Webform

I have a button to insert text into a field, after inserting the text i would like to set the cursor at the end of that text to then complete the entry
I can set the text and the focus
txtNewPrice.Text ="$"
txtNewPrice.Focus()

But how can i use the send keys to move to the end of that text
In a Windows world i would do this but i dont seem to have that function in the web world
SendKeys.Send("{END}")

you can try using javascript for that


Could you give me an example


Hi

I needed something similar this weekend. Found this and it works fine.

http://www.velocityreviews.com/forums/t70952-set-focus-and-cursor-at-end-of-text.html

Separate code file

Hi

I have a button on a webform. When I double click the button to create click
event it is created in the same file (aspx). How can I tell vs2005 to create
the code in a separate aspx.vb file?

Thanks

RegardsOn Feb 19, 4:54 am, "John" <J...@.nospam.infovis.co.ukwrote:

Quote:

Originally Posted by

Hi
>
I have a button on a webform. When I double click the button to create click
event it is created in the same file (aspx). How can I tell vs2005 to create
the code in a separate aspx.vb file?
>
Thanks
>
Regards


You enable the ASP .NET code-behind feature by adding attributes to
the @.Page directive.

for VB

<%@. Page Language="VB" Inherits="myClass" CodeBehind="myPage.aspx.vb"
%>

for C#

<%@. Page Language="C#" Inherits="myClass" CodeBehind="myPage.aspx.cs"
%>
Does that mean that it is not something one should normally be doing
otherwise it would have been provided by default?

Thanks

Regards

"Alexey Smirnov" <alexey.smirnov@.gmail.comwrote in message
news:1171872789.521209.303890@.v45g2000cwv.googlegr oups.com...

Quote:

Originally Posted by

On Feb 19, 4:54 am, "John" <J...@.nospam.infovis.co.ukwrote:

Quote:

Originally Posted by

>Hi
>>
>I have a button on a webform. When I double click the button to create
>click
>event it is created in the same file (aspx). How can I tell vs2005 to
>create
>the code in a separate aspx.vb file?
>>
>Thanks
>>
>Regards


>
You enable the ASP .NET code-behind feature by adding attributes to
the @.Page directive.
>
for VB
>
<%@. Page Language="VB" Inherits="myClass" CodeBehind="myPage.aspx.vb"
%>
>
for C#
>
<%@. Page Language="C#" Inherits="myClass" CodeBehind="myPage.aspx.cs"
%>
>


On Feb 19, 3:56 pm, "John" <J...@.nospam.infovis.co.ukwrote:

Quote:

Originally Posted by

Does that mean that it is not something one should normally be doing
otherwise it would have been provided by default?
>


VS creates that by default, when you add a new WebForm into project.
How do you created it?
Hi

I suspect I copied from another predone webform. I have now added this line
at the top;

<%@. Page Language="VB" MasterPageFile="MyMaster.master"
AutoEventWireup="false" CodeFile="MyPage.aspx.vb"
Inherits="Events_Settings_MyPage" Title="My Title" %>

and it says 'file '/Events/Settings/MyPage.aspx.vb' does not exist.' which
of course is true as the page did not have code behind to start with. How
can I now get vs to create the MyPage.aspx.vb file and link to the webform?

Thanks

Regards

"Alexey Smirnov" <alexey.smirnov@.gmail.comwrote in message
news:1171897535.364021.46260@.l53g2000cwa.googlegro ups.com...

Quote:

Originally Posted by

On Feb 19, 3:56 pm, "John" <J...@.nospam.infovis.co.ukwrote:

Quote:

Originally Posted by

>Does that mean that it is not something one should normally be doing
>otherwise it would have been provided by default?
>>


>
VS creates that by default, when you add a new WebForm into project.
How do you created it?
>


On Feb 19, 5:25 pm, "John" <J...@.nospam.infovis.co.ukwrote:

Quote:

Originally Posted by

Hi
>
I suspect I copied from another predone webform. I have now added this line
at the top;
>


Well, I think the best way is to add a new webform to your project. VS
will create aspx and the one for code-behind. Then you can copy your
code to this new webform, or use created code-behind *.vb as an
example.

Separate code file

Hi
I have a button on a webform. When I double click the button to create click
event it is created in the same file (aspx). How can I tell vs2005 to create
the code in a separate aspx.vb file?
Thanks
RegardsOn Feb 19, 4:54 am, "John" <J...@.nospam.infovis.co.uk> wrote:
> Hi
> I have a button on a webform. When I double click the button to create cli
ck
> event it is created in the same file (aspx). How can I tell vs2005 to crea
te
> the code in a separate aspx.vb file?
> Thanks
> Regards
You enable the ASP .NET code-behind feature by adding attributes to
the @.Page directive.
for VB
<%@. Page Language="VB" Inherits="myClass" CodeBehind="myPage.aspx.vb"
%>
for C#
<%@. Page Language="C#" Inherits="myClass" CodeBehind="myPage.aspx.cs"
%>
Does that mean that it is not something one should normally be doing
otherwise it would have been provided by default?
Thanks
Regards
"Alexey Smirnov" <alexey.smirnov@.gmail.com> wrote in message
news:1171872789.521209.303890@.v45g2000cwv.googlegroups.com...
> On Feb 19, 4:54 am, "John" <J...@.nospam.infovis.co.uk> wrote:
> You enable the ASP .NET code-behind feature by adding attributes to
> the @.Page directive.
> for VB
> <%@. Page Language="VB" Inherits="myClass" CodeBehind="myPage.aspx.vb"
> %>
> for C#
> <%@. Page Language="C#" Inherits="myClass" CodeBehind="myPage.aspx.cs"
> %>
>
On Feb 19, 3:56 pm, "John" <J...@.nospam.infovis.co.uk> wrote:
> Does that mean that it is not something one should normally be doing
> otherwise it would have been provided by default?
>
VS creates that by default, when you add a new WebForm into project.
How do you created it?
Hi
I suspect I copied from another predone webform. I have now added this line
at the top;
<%@. Page Language="VB" MasterPageFile="MyMaster.master"
AutoEventWireup="false" CodeFile="MyPage.aspx.vb"
Inherits="Events_Settings_MyPage" Title="My Title" %>
and it says 'file '/Events/Settings/MyPage.aspx.vb' does not exist.' which
of course is true as the page did not have code behind to start with. How
can I now get vs to create the MyPage.aspx.vb file and link to the webform?
Thanks
Regards
"Alexey Smirnov" <alexey.smirnov@.gmail.com> wrote in message
news:1171897535.364021.46260@.l53g2000cwa.googlegroups.com...
> On Feb 19, 3:56 pm, "John" <J...@.nospam.infovis.co.uk> wrote:
> VS creates that by default, when you add a new WebForm into project.
> How do you created it?
>
On Feb 19, 5:25 pm, "John" <J...@.nospam.infovis.co.uk> wrote:
> Hi
> I suspect I copied from another predone webform. I have now added this lin
e
> at the top;
>
Well, I think the best way is to add a new webform to your project. VS
will create aspx and the one for code-behind. Then you can copy your
code to this new webform, or use created code-behind *.vb as an
example.

Thursday, March 29, 2012

Sequence of events

Hi all,

I've got an aspx page with a Web user control and (among other things) a
submit button. When the form is submitted, the same page is to be served
back up, but with some items changed, mainly a panel visible that had not
been and a setting in the user control. The problem I'm having is figuring
out how to manipulate the flagging values as the submit's handler doesn't
fire until the page and controls' load methods. I'm a bit fuzzy on the
firing order of methods between objects, but am I better off moving such
code to the PreRender methods?

TIA,

JohnYour button click event handler should contain the code to flip the
visibility of the panel. The Page_Load code should only contain code that
should execute no matter what.

"John Spiegel" <jspiegel@.YETANOTHERSPAMHATERc-comld.com> wrote in message
news:OgWT8hZ8EHA.1452@.TK2MSFTNGP11.phx.gbl...
> Hi all,
> I've got an aspx page with a Web user control and (among other things) a
> submit button. When the form is submitted, the same page is to be served
> back up, but with some items changed, mainly a panel visible that had not
> been and a setting in the user control. The problem I'm having is
figuring
> out how to manipulate the flagging values as the submit's handler doesn't
> fire until the page and controls' load methods. I'm a bit fuzzy on the
> firing order of methods between objects, but am I better off moving such
> code to the PreRender methods?
> TIA,
> John
>
Yes, moving the code to PreRender is a good idea. It is not always possible,
especially if what has been clicked affects databinding, but, if it is not a
case, go for it. You can't change event sequence.

Eliyahu

"John Spiegel" <jspiegel@.YETANOTHERSPAMHATERc-comld.com> wrote in message
news:OgWT8hZ8EHA.1452@.TK2MSFTNGP11.phx.gbl...
> Hi all,
> I've got an aspx page with a Web user control and (among other things) a
> submit button. When the form is submitted, the same page is to be served
> back up, but with some items changed, mainly a panel visible that had not
> been and a setting in the user control. The problem I'm having is
figuring
> out how to manipulate the flagging values as the submit's handler doesn't
> fire until the page and controls' load methods. I'm a bit fuzzy on the
> firing order of methods between objects, but am I better off moving such
> code to the PreRender methods?
> TIA,
> John
>
Hi John,

I keep the following bookmark handy, when I need to work more closely with
the execution lifecycle:

http://msdn.microsoft.com/library/d...onLifecycle.asp

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.

"John Spiegel" <jspiegel@.YETANOTHERSPAMHATERc-comld.com> wrote in message
news:OgWT8hZ8EHA.1452@.TK2MSFTNGP11.phx.gbl...
> Hi all,
> I've got an aspx page with a Web user control and (among other things) a
> submit button. When the form is submitted, the same page is to be served
> back up, but with some items changed, mainly a panel visible that had not
> been and a setting in the user control. The problem I'm having is
> figuring
> out how to manipulate the flagging values as the submit's handler doesn't
> fire until the page and controls' load methods. I'm a bit fuzzy on the
> firing order of methods between objects, but am I better off moving such
> code to the PreRender methods?
> TIA,
> John
>
Thanks, all! One problem down, 3.2 million to go <g>.

"John Spiegel" <jspiegel@.YETANOTHERSPAMHATERc-comld.com> wrote in message
news:OgWT8hZ8EHA.1452@.TK2MSFTNGP11.phx.gbl...
> Hi all,
> I've got an aspx page with a Web user control and (among other things) a
> submit button. When the form is submitted, the same page is to be served
> back up, but with some items changed, mainly a panel visible that had not
> been and a setting in the user control. The problem I'm having is
figuring
> out how to manipulate the flagging values as the submit's handler doesn't
> fire until the page and controls' load methods. I'm a bit fuzzy on the
> firing order of methods between objects, but am I better off moving such
> code to the PreRender methods?
> TIA,
> John
>

Sequence of events

Hi all,
I've got an aspx page with a Web user control and (among other things) a
submit button. When the form is submitted, the same page is to be served
back up, but with some items changed, mainly a panel visible that had not
been and a setting in the user control. The problem I'm having is figuring
out how to manipulate the flagging values as the submit's handler doesn't
fire until the page and controls' load methods. I'm a bit fuzzy on the
firing order of methods between objects, but am I better off moving such
code to the PreRender methods?
TIA,
JohnYour button click event handler should contain the code to flip the
visibility of the panel. The Page_Load code should only contain code that
should execute no matter what.
"John Spiegel" <jspiegel@.YETANOTHERSPAMHATERc-comld.com> wrote in message
news:OgWT8hZ8EHA.1452@.TK2MSFTNGP11.phx.gbl...
> Hi all,
> I've got an aspx page with a Web user control and (among other things) a
> submit button. When the form is submitted, the same page is to be served
> back up, but with some items changed, mainly a panel visible that had not
> been and a setting in the user control. The problem I'm having is
figuring
> out how to manipulate the flagging values as the submit's handler doesn't
> fire until the page and controls' load methods. I'm a bit fuzzy on the
> firing order of methods between objects, but am I better off moving such
> code to the PreRender methods?
> TIA,
> John
>
>
Yes, moving the code to PreRender is a good idea. It is not always possible,
especially if what has been clicked affects databinding, but, if it is not a
case, go for it. You can't change event sequence.
Eliyahu
"John Spiegel" <jspiegel@.YETANOTHERSPAMHATERc-comld.com> wrote in message
news:OgWT8hZ8EHA.1452@.TK2MSFTNGP11.phx.gbl...
> Hi all,
> I've got an aspx page with a Web user control and (among other things) a
> submit button. When the form is submitted, the same page is to be served
> back up, but with some items changed, mainly a panel visible that had not
> been and a setting in the user control. The problem I'm having is
figuring
> out how to manipulate the flagging values as the submit's handler doesn't
> fire until the page and controls' load methods. I'm a bit fuzzy on the
> firing order of methods between objects, but am I better off moving such
> code to the PreRender methods?
> TIA,
> John
>
>
Hi John,
I keep the following bookmark handy, when I need to work more closely with
the execution lifecycle:
http://msdn.microsoft.com/library/d...onLifecycle.asp
HTH,
Kevin Spencer
Microsoft MVP
.Net Developer
Neither a follower nor a lender be.
"John Spiegel" <jspiegel@.YETANOTHERSPAMHATERc-comld.com> wrote in message
news:OgWT8hZ8EHA.1452@.TK2MSFTNGP11.phx.gbl...
> Hi all,
> I've got an aspx page with a Web user control and (among other things) a
> submit button. When the form is submitted, the same page is to be served
> back up, but with some items changed, mainly a panel visible that had not
> been and a setting in the user control. The problem I'm having is
> figuring
> out how to manipulate the flagging values as the submit's handler doesn't
> fire until the page and controls' load methods. I'm a bit fuzzy on the
> firing order of methods between objects, but am I better off moving such
> code to the PreRender methods?
> TIA,
> John
>
>
Thanks, all! One problem down, 3.2 million to go <g>.
"John Spiegel" <jspiegel@.YETANOTHERSPAMHATERc-comld.com> wrote in message
news:OgWT8hZ8EHA.1452@.TK2MSFTNGP11.phx.gbl...
> Hi all,
> I've got an aspx page with a Web user control and (among other things) a
> submit button. When the form is submitted, the same page is to be served
> back up, but with some items changed, mainly a panel visible that had not
> been and a setting in the user control. The problem I'm having is
figuring
> out how to manipulate the flagging values as the submit's handler doesn't
> fire until the page and controls' load methods. I'm a bit fuzzy on the
> firing order of methods between objects, but am I better off moving such
> code to the PreRender methods?
> TIA,
> John
>
>

Thursday, March 22, 2012

Serious and stupid problem..

Hi.

I'm using ASP.NET 1 .1 with C#..

My problem is very weird..I have a listbox and a button ,both are WebControls..

When I clicked on an item in Listbox code fires ListBox_SelectedItemChanged event and navigates to a new page. Until this part it works fine.

When I goto back by browsers BACK button anc click the Button ListBox_SelectedItemChanged fires again.Strange isn' t it??

Has anyone had this problem before?

I have checked the event handlar declarations and they are correct.

tguclu,

It is not strange behaviour. If you use BACK button , the page view comes from IE history. When you do a postback this page ( Buton click..etc..) ,SelectedItemChangedevent will fire because there is a change in index after intial load.

To avoid the problem, you can try this..

In page_Load..

if (!IsPostBack)

{

//***** Reset the Listbox selected index *********

MyListBox.SelectedIndex= 0;

}

Tuesday, March 13, 2012

Server and Javascript client

This is a bit of a tricky one.

I have a button placed in the footer of a datalist control in ASP.NET
I am going to apply an attribute to this button, to pretty much disable the button once clicked upon to prevent the user from clicking several times.

Question is, since I need to give the script (javascript) the ID of the button, how will this work since the button is actually in the datalist control in the footer? It is easily done if the button was outside but since its inside the control...im a bit stuck!nevermind, sorted! (get the ClientID of the button in the footer)