Showing posts with label users. Show all posts
Showing posts with label users. Show all posts

Thursday, March 29, 2012

set date on calendar in a FormView template

Hi,

My calendar is inside a FormView template as users are entering new dates.

I want the month shown to be the same as the last one they entered, but after an Insert, the control revert back to the current month.

I can fetch the moth via SQL or stoer in a cookie, but I don't know how to access the control, as it's embedded in the FormVIew.

Thanks if you can help.

NEIL

1protected void myFormView_DataBound(object sender, EventArgs e)2 {3 Calendar myCal = (Calendar)myFormView.FindControl("myCalendar");4// set the Visible Date in the calendar to the Current Month5 myCal.VisibleDate = DateTime.Now();6 }

Line 3 finds the Calendar Control within the FormView.

Line 5 sets the VisibleDate property of the calendar to the Current Month, or whatever date you want to place on the right side of the =.


Hi,

I'm writing in VB, can you translate?

Cheers,

NEIL


1Protected Sub FormView1_DataBound(ByVal senderAs Object,ByVal eAs System.EventArgs)Handles FormView1.DataBound2Dim myCalAs Calendar =CType(FormView1.FindControl("myCalendar"), Calendar)3 myCal.VisibleDate = DateTime.Now4End Sub
 
If this is what you needed, please mark it as your answer...Thanks!!
 

Saturday, March 24, 2012

set focus in a ASP.NET webpage

Hello,

I would like to know if it is possible in ASP.NET to set the focus to a

control. I would like to make it possible for users to fill in a form. The

form contains textboxes and dropdownlists. When the user makes a selection

in a dropdownlist, certain default-values in textboxes are set. I use the

AutoPostBack=True property in the dropdownlist, but after the page has been

transferred back to the server, the control has also lost it's focus. That's

annoying for users, especially when there are more than 1 dropdownlists that

postback to the server.

Greetings,

Christian.The most reliable way is client side javascript:

MyControl.focus();

Here's more info:
http://wp.netscape.com/eng/mozilla/...f_f-g.htm#59872

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
Hire top-notch developers at http://www.able-consulting.com

"Remco Groot Beumer" <info@.rgbplus.nl> wrote in message
news:bp0k6q$pao$1@.news4.tilbu1.nb.home.nl...
> Hello,
> I would like to know if it is possible in ASP.NET to set the focus to a
> control. I would like to make it possible for users to fill in a form. The
> form contains textboxes and dropdownlists. When the user makes a selection
> in a dropdownlist, certain default-values in textboxes are set. I use the
> AutoPostBack=True property in the dropdownlist, but after the page has
been
> transferred back to the server, the control has also lost it's focus.
That's
> annoying for users, especially when there are more than 1 dropdownlists
that
> postback to the server.
> Greetings,
> Christian.
When an ASP.NET page is processing its code, it's doing so on the server.
And, that is well before the client actually receives the page.

Setting focus should really be done with traditional client-side scripting
(JavaScript).

"Remco Groot Beumer" <info@.rgbplus.nl> wrote in message
news:bp0k6q$pao$1@.news4.tilbu1.nb.home.nl...
> Hello,
> I would like to know if it is possible in ASP.NET to set the focus to a
> control. I would like to make it possible for users to fill in a form. The
> form contains textboxes and dropdownlists. When the user makes a selection
> in a dropdownlist, certain default-values in textboxes are set. I use the
> AutoPostBack=True property in the dropdownlist, but after the page has
been
> transferred back to the server, the control has also lost it's focus.
That's
> annoying for users, especially when there are more than 1 dropdownlists
that
> postback to the server.
> Greetings,
> Christian.

Set focus on the field (Form validation in ASP.NET)

Hi,
I have a problem and really need your help. In my web page ASPX, I have
some text fields to accept data from users. I did form validation like this
:
<td class="dataTD" style="HEIGHT: 30px" width="100">
<asp:TextBox id="txtFUEL_ISSUED1" style="Z-INDEX: 100; POSITION: absolute"
runat="server" Width="107px" BorderColor="Transparent"
autoPostback="true"
OnTextChanged="txtFUEL_ISSUED1_TextChanged"></asp:TextBox>
</td>
<td class="dataTD" style="HEIGHT: 30px" width="100">
<asp:CompareValidator id="CompareValidator1"
runat="server" Width="90px" ControlToValidate="txtFUEL_ISSUED1"
ForeColor="LightCoral" ErrorMessage="Please enter a number!"
Operator="DataTypeCheck" Type="Double"></asp:CompareValidator>
</td>
In the txtFUEL_ISSUED1_TextChanged, I checked if data on this field is valid
or not. If it's valid then I add this value in the TOTAL field. I'd to to
set focus on the next field when this data IS VALID, OR focus on this field
when data IS NOT valid . Can you help me ? Thanks in advanceI suggest you upgrade to ASP.NET 2.0, which has new features that satisfy
all your requests.
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"bienwell" <bienwell@.hotmail.com> wrote in message
news:%23O5W3po9FHA.476@.TK2MSFTNGP15.phx.gbl...
> Hi,
> I have a problem and really need your help. In my web page ASPX, I have
> some text fields to accept data from users. I did form validation like
> this :
> <td class="dataTD" style="HEIGHT: 30px" width="100">
> <asp:TextBox id="txtFUEL_ISSUED1" style="Z-INDEX: 100; POSITION:
> absolute" runat="server" Width="107px" BorderColor="Transparent"
> autoPostback="true"
> OnTextChanged="txtFUEL_ISSUED1_TextChanged"></asp:TextBox>
> </td>
> <td class="dataTD" style="HEIGHT: 30px" width="100">
> <asp:CompareValidator id="CompareValidator1"
> runat="server" Width="90px" ControlToValidate="txtFUEL_ISSUED1"
> ForeColor="LightCoral" ErrorMessage="Please enter a number!"
> Operator="DataTypeCheck" Type="Double"></asp:CompareValidator>
> </td>
>
> In the txtFUEL_ISSUED1_TextChanged, I checked if data on this field is
> valid or not. If it's valid then I add this value in the TOTAL field. I'd
> to to set focus on the next field when this data IS VALID, OR focus on
> this field when data IS NOT valid . Can you help me ? Thanks in advance
>
Steve,
I have some questions:
1- There are some versions ASP.NET 2.0 from the www.asp.net web site :
a- .NET Framework 2.0 SDK x86,
b- .NET Framework Version 2.0 Redistributable Package (x86)
c- .NET Framework 2.0 SDK x64
d- .NET Framework Version 2.0 Redistributable Package x64 (64
Bit)
e- .NET Framework 2.0 SDK IA64
f- .NET Framework Version 2.0 Redistributable Package IA64
(64 Bit)
Which one do you suggest me to download ?
2- After downloading, do you think this code will work OR I should
change something ?
Sub txtFUEL_ISSUED1_TextChanged(sender As Object, e As EventArgs)
Dim strScript As String = "<script language=JavaScript>"
If IsNumeric(txtFUEL_ISSUED1.text) OR
txtFUEL_ISSUED1.text="" Then
Dim aValue as double=0.0
If IsNumeric(txtFUEL_ISSUED1.text) Then
aValue=CDBL(txtFUEL_ISSUED1.Text)
End If
' ADD the value to the TOTAL field
ViewState("FUEL_ISSUED_Total") =
ViewState("FUEL_ISSUED_Total") + aValue - ViewState("FUEL_ISSUED1")
txtFUEL_ISSUED_Total.text=FormatNumber(ViewState("FUEL_ISSUED_Total"),
2, , ,TriState.True)
ViewState("FUEL_ISSUED1") = aValue
strScript = strScript &
"document.form1.txtFUEL_ISSUED2.focus();" 'FOCUS on the next field
Else 'FOCUS on the current field
strScript = strScript &
"document.form1.txtFUEL_ISSUED1.focus();"
End If
strScript = strScript & "<" & "/script>"
If (Not Page.IsStartupScriptRegistered("clientScript")) Then
Page.RegisterStartupScript("clientScript", strScript)
End If
End Sub
========================================
===========
"Steve C. Orr [MVP, MCSD]" <Steve@.Orr.net> wrote in message
news:%23Tibhzt9FHA.1288@.TK2MSFTNGP09.phx.gbl...
>I suggest you upgrade to ASP.NET 2.0, which has new features that satisfy
>all your requests.
> --
> I hope this helps,
> Steve C. Orr, MCSD, MVP
> http://SteveOrr.net
>
> "bienwell" <bienwell@.hotmail.com> wrote in message
> news:%23O5W3po9FHA.476@.TK2MSFTNGP15.phx.gbl...
>
If you have a 32-bit machine ( a standard Intel or AMD )...
If you want the very minimum necessary to run ASP.NET 2.0,
get .NET Framework Version 2.0 Redistributable Package (x86)
If you want the QuickStart Tutorials, extra tools *and* ASP.NET 2.0,
get .NET Framework 2.0 SDK x86
If you have a 64-bit machine, your choice may vary depending on the cpu.
The code you posted should run on any of the 5 choices.
Juan T. Llibre
ASP.NET.FAQ : http://asp.net.do/faq/
ASPNETFAQ.COM : http://www.aspnetfaq.com/
Foros de ASP.NET en Espaol : http://asp.net.do/foros/
======================================
"bienwell" <bienwell@.hotmail.com> wrote in message news:%23KAB7j09FHA.1140@.tk2msftngp13.phx
.gbl...
> Steve,
> I have some questions:
> 1- There are some versions ASP.NET 2.0 from the www.asp.net web site
:
> a- .NET Framework 2.0 SDK x86,
> b- .NET Framework Version 2.0 Redistributable Package (x86)
> c- .NET Framework 2.0 SDK x64
> d- .NET Framework Version 2.0 Redistributable Package x64 (64
Bit)
> e- .NET Framework 2.0 SDK IA64
> f- .NET Framework Version 2.0 Redistributable Package IA64 (
64 Bit)
> Which one do you suggest me to download ?
>
> 2- After downloading, do you think this code will work OR I should cha
nge something ?
> Sub txtFUEL_ISSUED1_TextChanged(sender As Object, e As EventArgs)
> Dim strScript As String = "<script language=JavaScript>"
> If IsNumeric(txtFUEL_ISSUED1.text) OR txtFUEL_ISSUED1.tex
t="" Then
> Dim aValue as double=0.0
> If IsNumeric(txtFUEL_ISSUED1.text) Then
> aValue=CDBL(txtFUEL_ISSUED1.Text)
> End If
> ' ADD the value to the TOTAL field
> ViewState("FUEL_ISSUED_Total") = ViewState("FUEL_ISS
UED_Total") + aValue -
> ViewState("FUEL_ISSUED1")
> txtFUEL_ISSUED_Total.text=FormatNumber(ViewState("F
UEL_ISSUED_Total"), 2, ,
> ,TriState.True)
> ViewState("FUEL_ISSUED1") = aValue
> strScript = strScript & "document.form1.txtFUEL_ISS
UED2.focus();"
> 'FOCUS on the next field
> Else 'FOCUS on the current field
> strScript = strScript & "document.form1.txtFUEL_IS
SUED1.focus();"
> End If
> strScript = strScript & "<" & "/script>"
> If (Not Page.IsStartupScriptRegistered("clientScript")) Then
> Page.RegisterStartupScript("clientScript", strScript)
> End If
> End Sub
> ========================================
===========
> "Steve C. Orr [MVP, MCSD]" <Steve@.Orr.net> wrote in message
> news:%23Tibhzt9FHA.1288@.TK2MSFTNGP09.phx.gbl...
Thank you very much for your advices.
bienwell
==============================
"Juan T. Llibre" <nomailreplies@.nowhere.com> wrote in message
news:eZ$7KP19FHA.904@.TK2MSFTNGP09.phx.gbl...
> If you have a 32-bit machine ( a standard Intel or AMD )...
> If you want the very minimum necessary to run ASP.NET 2.0,
> get .NET Framework Version 2.0 Redistributable Package (x86)
>
> If you want the QuickStart Tutorials, extra tools *and* ASP.NET 2.0,
> get .NET Framework 2.0 SDK x86
> If you have a 64-bit machine, your choice may vary depending on the cpu.
> The code you posted should run on any of the 5 choices.
>
> Juan T. Llibre
> ASP.NET.FAQ : http://asp.net.do/faq/
> ASPNETFAQ.COM : http://www.aspnetfaq.com/
> Foros de ASP.NET en Espaol : http://asp.net.do/foros/
> ======================================
> "bienwell" <bienwell@.hotmail.com> wrote in message
> news:%23KAB7j09FHA.1140@.tk2msftngp13.phx.gbl...
>
>
>

Tuesday, March 13, 2012

Set Postback or Session Timeout

Hi All.
I have a page that users enter information in text boxes...and
sometimes it's a lot of information. There are times that these folks
either take their time entering the info or do other things before they
submit the page. Unfortunately, if they do take their time, there are
times where the session times out and they can no longer submit their
information, resulting in an error and pretty peeved users.
What I'm asking for help on is...can, possibly through a timer or
something either reset the session or do a postback? This would be to
cover in case the user would take too much time to submit the
information....it would happen automatically. I do have a popup box
that warns them they are about to time out, but it might not be seen.
So far, I have tried a timer to redirect the page to itself, try to go
through the page_load and try to set the session.timeout, but none of
it looks to work. I did see some __doPostBack and Page.GetPostBackEvent
articles, but didn't see how to put them to use. They get mentioned,
but I don't see how to make them function on my page. I need some way
to try to keep the session alive and not timeout. Sorry if it's
something that's easy that I don't see. I'm still a bit (ok, well very)
new at this I have searched Google high and low and found nothing that
looks to work.
Thanks for any help you can be!!
kurtYou can:
1. Extend the length of the session timeout.
2. Store your information in ViewState instead.
"kurt" <kbaker@.granitemicrosystems.com> wrote in message
news:1115834747.970410.207850@.o13g2000cwo.googlegroups.com...
> Hi All.
> I have a page that users enter information in text boxes...and
> sometimes it's a lot of information. There are times that these folks
> either take their time entering the info or do other things before they
> submit the page. Unfortunately, if they do take their time, there are
> times where the session times out and they can no longer submit their
> information, resulting in an error and pretty peeved users.
> What I'm asking for help on is...can, possibly through a timer or
> something either reset the session or do a postback? This would be to
> cover in case the user would take too much time to submit the
> information....it would happen automatically. I do have a popup box
> that warns them they are about to time out, but it might not be seen.
> So far, I have tried a timer to redirect the page to itself, try to go
> through the page_load and try to set the session.timeout, but none of
> it looks to work. I did see some __doPostBack and Page.GetPostBackEvent
> articles, but didn't see how to put them to use. They get mentioned,
> but I don't see how to make them function on my page. I need some way
> to try to keep the session alive and not timeout. Sorry if it's
> something that's easy that I don't see. I'm still a bit (ok, well very)
> new at this I have searched Google high and low and found nothing that
> looks to work.
> Thanks for any help you can be!!
> kurt
>
kurt wrote:
> Hi All.
> I have a page that users enter information in text boxes...and
> sometimes it's a lot of information. There are times that these folks
> either take their time entering the info or do other things before
> they submit the page. Unfortunately, if they do take their time,
> there are times where the session times out and they can no longer
> submit their information, resulting in an error and pretty peeved
> users.
> What I'm asking for help on is...can, possibly through a timer or
> something either reset the session or do a postback? This would be to
> cover in case the user would take too much time to submit the
> information....it would happen automatically. I do have a popup box
> that warns them they are about to time out, but it might not be seen.
>
Maybe you can use a (small) iframe that refreshes itself every few minutes,
to keep the session alive but without submitting the entire page
(and losing scroll-position and focus).
Hans Kesting
Sorry I didn't get back sooner, but I was out for a while. I'm not
sure extending the timeout would work. If I set it to 30 minutes,
they'll probably go 31...and so on. I also wasn't sure that the
viewstate would be usable and last either. But, I did try the iframe
and so far it looks to do exactly as I needed. I also have been trying
it out and I don't look to lose focus from the control I'm currently
using when the iframe refreshes. Thanks for all the input!!
Kurt

Set Postback or Session Timeout

Hi All.
I have a page that users enter information in text boxes...and
sometimes it's a lot of information. There are times that these folks
either take their time entering the info or do other things before they
submit the page. Unfortunately, if they do take their time, there are
times where the session times out and they can no longer submit their
information, resulting in an error and pretty peeved users.

What I'm asking for help on is...can, possibly through a timer or
something either reset the session or do a postback? This would be to
cover in case the user would take too much time to submit the
information....it would happen automatically. I do have a popup box
that warns them they are about to time out, but it might not be seen.

So far, I have tried a timer to redirect the page to itself, try to go
through the page_load and try to set the session.timeout, but none of
it looks to work. I did see some __doPostBack and Page.GetPostBackEvent
articles, but didn't see how to put them to use. They get mentioned,
but I don't see how to make them function on my page. I need some way
to try to keep the session alive and not timeout. Sorry if it's
something that's easy that I don't see. I'm still a bit (ok, well very)
new at this I have searched Google high and low and found nothing that
looks to work.

Thanks for any help you can be!!

kurtYou can:
1. Extend the length of the session timeout.
2. Store your information in ViewState instead.

"kurt" <kbaker@.granitemicrosystems.com> wrote in message
news:1115834747.970410.207850@.o13g2000cwo.googlegr oups.com...
> Hi All.
> I have a page that users enter information in text boxes...and
> sometimes it's a lot of information. There are times that these folks
> either take their time entering the info or do other things before they
> submit the page. Unfortunately, if they do take their time, there are
> times where the session times out and they can no longer submit their
> information, resulting in an error and pretty peeved users.
> What I'm asking for help on is...can, possibly through a timer or
> something either reset the session or do a postback? This would be to
> cover in case the user would take too much time to submit the
> information....it would happen automatically. I do have a popup box
> that warns them they are about to time out, but it might not be seen.
> So far, I have tried a timer to redirect the page to itself, try to go
> through the page_load and try to set the session.timeout, but none of
> it looks to work. I did see some __doPostBack and Page.GetPostBackEvent
> articles, but didn't see how to put them to use. They get mentioned,
> but I don't see how to make them function on my page. I need some way
> to try to keep the session alive and not timeout. Sorry if it's
> something that's easy that I don't see. I'm still a bit (ok, well very)
> new at this I have searched Google high and low and found nothing that
> looks to work.
> Thanks for any help you can be!!
> kurt
kurt wrote:
> Hi All.
> I have a page that users enter information in text boxes...and
> sometimes it's a lot of information. There are times that these folks
> either take their time entering the info or do other things before
> they submit the page. Unfortunately, if they do take their time,
> there are times where the session times out and they can no longer
> submit their information, resulting in an error and pretty peeved
> users.
> What I'm asking for help on is...can, possibly through a timer or
> something either reset the session or do a postback? This would be to
> cover in case the user would take too much time to submit the
> information....it would happen automatically. I do have a popup box
> that warns them they are about to time out, but it might not be seen.

Maybe you can use a (small) iframe that refreshes itself every few minutes,
to keep the session alive but without submitting the entire page
(and losing scroll-position and focus).

Hans Kesting
Sorry I didn't get back sooner, but I was out for a while. I'm not
sure extending the timeout would work. If I set it to 30 minutes,
they'll probably go 31...and so on. I also wasn't sure that the
viewstate would be usable and last either. But, I did try the iframe
and so far it looks to do exactly as I needed. I also have been trying
it out and I don't look to lose focus from the control I'm currently
using when the iframe refreshes. Thanks for all the input!!

Kurt