Showing posts with label inside. Show all posts
Showing posts with label inside. Show all posts

Saturday, March 31, 2012

Set A Parameter Without Redirecting A Page?

can somebody tell me how to set a parameter of my current URL

without using response.redirect?

I am trying to set a parameter - ResponseId = 4 inside a while loop. is
this possible?

also, is it possible to replace the value of the ResponseId parameter
to, say "5" in the same way?

thanks!Querystring parameters cannot be reset dynamically as they represent a
read-only collection of items in the url.

Of course, something else you could do would be to have a series of local
variables or protected properties that would initially populate from this
list, then change the variable in postback. This would work nicely if you're
using AJAX because then you wouldn't be posting back the whole page. If
you're not using AJAX, then using a response.redirect doesn't effect you
much because you'll have a full page postback and might as well do the
redirect to avoid worrying about keeping parameter updates in a viewstate.

--

Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199?-2006

"pbd22" <dushkin@.gmail.comwrote in message
news:1167335417.354465.213040@.n51g2000cwc.googlegr oups.com...

Quote:

Originally Posted by

can somebody tell me how to set a parameter of my current URL
>
without using response.redirect?
>
I am trying to set a parameter - ResponseId = 4 inside a while loop. is
this possible?
>
also, is it possible to replace the value of the ResponseId parameter
to, say "5" in the same way?
>
thanks!
>


ok, thanks mark.

i dont think this will work as the updated parameter is created in a
while
loop that outputs many values - this is a count.

what i have done is pass my url querystring through a hidden iframe
from
the referring page (i am uploading files). now, what i want to do is
send a
count back to the referring page (the count represents upload time). i
thought i might be able to do this in the querystring but this would
cause
numerous postbacks in sequence - not pretty.

since it looks like doing it via the querystring is a no-go, do you
have any ideas how
i might send the upload count back to the referring page? is it
possible to send an ajax response from the server when the client does
not initiate the call?

thanks.
peter

Mark Fitzpatrick wrote:

Quote:

Originally Posted by

Querystring parameters cannot be reset dynamically as they represent a
read-only collection of items in the url.
>
Of course, something else you could do would be to have a series of local
variables or protected properties that would initially populate from this
list, then change the variable in postback. This would work nicely if you're
using AJAX because then you wouldn't be posting back the whole page. If
you're not using AJAX, then using a response.redirect doesn't effect you
much because you'll have a full page postback and might as well do the
redirect to avoid worrying about keeping parameter updates in a viewstate.
>
>
--
>
Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199?-2006
>
>
>
"pbd22" <dushkin@.gmail.comwrote in message
news:1167335417.354465.213040@.n51g2000cwc.googlegr oups.com...

Quote:

Originally Posted by

can somebody tell me how to set a parameter of my current URL

without using response.redirect?

I am trying to set a parameter - ResponseId = 4 inside a while loop. is
this possible?

also, is it possible to replace the value of the ResponseId parameter
to, say "5" in the same way?

thanks!

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!!
 

Monday, March 26, 2012

Set DIV text in code behind

if i want to set the text inside a div (or other properties like "class") from my code behind, as what to i declare it? htmlgenericcontrol? If so, what attribute do i set.

html:
<div id="divtest" runat=server></div>
code behind:
protected System.Web.UI.HtmlControls.WHAT?? divtest;
...
...
divtest.WHAT?? = "seems to work";Html part is fine. After you've created it, look at it in the design view, save the page, then go to the codebehind, you should be able to see an html div control (some name)... set its innerText property.
hmmm...not so sure

I always have to code the "protected htmlcontrol whatever mycontrol" myself in my project. VS never do it for me. SOMETIMES, VS will add this for me for asp.net controls though.

Maybe something to do with the fact I ALWAYS hand code my pages...never drag and drop onto form...

...aaah...stupid me..let me drag some html controls onto the form and see what VS do for me... sorry..always talk to myself huh?
It's a VS 2003 bug that I discovered much to my consternation when VS 2003 had just come out. Surprisingly, it was addressed by nobody. Everyone thought it was a feature rather than a bug, I even asked MS developers about it, and they did fix it in VS 2005 but they mentioned that very few people ever brought it up regarding VS 2003.

The workaround was that you have to save the ASPX page before going to the codebehind so that the control's code was added to the codebehind file.

Set Focus

Does anyone have any idea how to set focus on any control inside of a user
control?
Any help appreciated.
LeonLeon wrote:
> Does anyone have any idea how to set focus on any control inside of a user
> control?
Leon, you can use Andy Smith's FirstFocus control
[http://metabuilders.com/Tools/FirstFocus.aspx], or read up on how to do
it yourself, through server-side code, in my article:
Working with Client-Side Script
http://tinyurl.com/3w474
Essentially you need to get the ID from the control you want to set
focus to using the control's ClientID property, and then a small bit of
client-side JavaScript is needed to put focus on that control.
Happy Programming!
Scott Mitchell
mitchell@.4guysfromrolla.com
http://www.4GuysFromRolla.com
* When you think ASP.NET, think 4GuysFromRolla.com!

Set Focus

Does anyone have any idea how to set focus on any control inside of a user
control?

Any help appreciated.

LeonLeon wrote:
> Does anyone have any idea how to set focus on any control inside of a user
> control?

Leon, you can use Andy Smith's FirstFocus control
[http://metabuilders.com/Tools/FirstFocus.aspx], or read up on how to do
it yourself, through server-side code, in my article:

Working with Client-Side Script
http://tinyurl.com/3w474

Essentially you need to get the ID from the control you want to set
focus to using the control's ClientID property, and then a small bit of
client-side JavaScript is needed to put focus on that control.

Happy Programming!

--

Scott Mitchell
mitchell@.4guysfromrolla.com
http://www.4GuysFromRolla.com

* When you think ASP.NET, think 4GuysFromRolla.com!

Saturday, March 24, 2012

Set Focus inside of user control

Hi Everybody.
Can someone prompt me how to set Focus on any control inside of a user
control?
Thanks in advance
LeonWe use this:
Public Shared Sub Set_Focus(ByVal strControlName As String)
Dim strScript As String
strScript = "<script language=javascript>
document.all.item(""" & strControlName & """).focus() </script>"
RegisterStartupScript("focus", strScript)
Then on the page which has the user control:
Set_Focus("uscLogin_txtUsername")
Set_Focus("uscUserControlName_ctlControlName")
For example, if the user control is call uscLoging and you have a textbox
txtUsername:
"Leon" wrote:

> Hi Everybody.
> Can someone prompt me how to set Focus on any control inside of a user
> control?
> Thanks in advance
> Leon

Set Focus inside of user control

Hi Everybody.

Can someone prompt me how to set Focus on any control inside of a user
control?

Thanks in advance

LeonWe use this:
Public Shared Sub Set_Focus(ByVal strControlName As String)

Dim strScript As String
strScript = "<script language=javascript>
document.all.item(""" & strControlName & """).focus() </script>"
RegisterStartupScript("focus", strScript)

Then on the page which has the user control:
Set_Focus("uscLogin_txtUsername")

Set_Focus("uscUserControlName_ctlControlName")

For example, if the user control is call uscLoging and you have a textbox
txtUsername:

"Leon" wrote:

> Hi Everybody.
> Can someone prompt me how to set Focus on any control inside of a user
> control?
> Thanks in advance
> Leon

Set focus to a control inside a Updatepanel in Atlas

After a postback, how do I set focus onto a control that is inside an
updatepanel?Hello Ssflynn,

As for the ATLAS updatepanel setfocus function you mentioned, I've
performed some local tests, it seems the Page.SetFocus method or
Page.ClientScript.RegisterXXXX methods will work only if the
"scriptmanager" is configured as "enablepartialrendering=false". However,
in such mode, the whole page will be rerender when we perform postback.

<atlas:Scriptmanager id="ScriptManager" runat="server"
enablepartialrendering="true" />

Currently, I'm doing some further research to see whether we can find a way
to set control focus when use "partialrendering" mode for updatable. I'll
update you as soon as I've got any finding.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscript...ault.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscript...rt/default.aspx.

==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
Hello Ssflynn,

How are you doing on this issue? After further discussion with some
production engineer, so far there is no built-in API or interface that will
control focus in atlas udpatepanel. However, In Atlas 1.0 and future
versions we'll have built-in control focus support (e.g.
ScriptManager.SetFocus(Control), etc.).

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

This posting is provided "AS IS" with no warranties, and confers no rights.
Is there any built-in API or interface that will
control focus in atlas udpatepanel?

Is there any Patch available for ScriptManager.SetFocus(control) , after the Partial Postback is completed?

Thanks in Advance
Hi Venkat,

Thanks for your input.

So far what I've got the from the product team is that the focus control
(ATLAS specific) will be provided in the 1.0 release only).

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

This posting is provided "AS IS" with no warranties, and confers no rights.
I still would like to be able to do this, I've given up on it so far.

Has the Atlas 1.0 been released yet?

"Steven Cheng[MSFT]" <stcheng@.online.microsoft.comwrote in message
news:5M3xoE71GHA.4280@.TK2MSFTNGXA01.phx.gbl...

Quote:

Originally Posted by

Hello Ssflynn,
>
How are you doing on this issue? After further discussion with some
production engineer, so far there is no built-in API or interface that
will
control focus in atlas udpatepanel. However, In Atlas 1.0 and future
versions we'll have built-in control focus support (e.g.
ScriptManager.SetFocus(Control), etc.).
>
Sincerely,
>
Steven Cheng
>
Microsoft MSDN Online Support Lead
>
>
This posting is provided "AS IS" with no warranties, and confers no
rights.
>


Thanks for your followup Ssflynn,

So far the available ATLAS package is still the CTP version. We haven't got
the definite date of the relase of ATLAS 1.0. Anyway, you can keep
monitoring on the www.asp.net ATLAS home on any new update.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

This posting is provided "AS IS" with no warranties, and confers no rights.