Showing posts with label multiple. Show all posts
Showing posts with label multiple. Show all posts

Saturday, March 31, 2012

Submitting form with multiple onclick events

Hi

I'm building a custom control which basically takes data from the user
and then submits it. I would use the validator controls but if I
understand correctly (I've been working with .Net for 2 weeks) you
cant 'embed' them in the custom controls. Someone correct me if I'm
wrong (and please point to an example :) )

So, to get around this, I'm using Javascript. In my control, I'm doing

Writer.WriteAttribute("OnClick", "javascript:checkData();" &
Page.GetPostBackEventReference(Me, "Data"))

for an Input item so I get something like

<input type="button" value="Submit"
OnClick="javascript:checkData();__doPostBack('MyControl','D ata')" /
The checkData() function does this:

function checkLogin()
{
if (document.Data.item1.value == "" )
{
alert("Please enter item 1.");
return false;
}

if (document.Data.item2.value == "" )
{
alert("Please enter item 2.");
return false;
}

if (document.Data.item1.value != "" && document.Data.item2.value !=
"" )
{
return true;
}

}

My query is, how do I get the click event to fire correctly so that i
get alerts when there is a problem, and it passes through and submits
the form if there isnt a problem?

Thanks

SamHi,

Your client side script should use cancelBubble and returnValue to
disable event default process and raise alert if error found.

function CallServer()
{
if validate
{
__doPostBack('MyControl','Data');
}
else
{
alert("Error");
window.event.cancelBubble = true;
window.event.returnValue = false;
}
}

HTH

Natty Gur[MVP]

blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)58-888377

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Natty Gur <natty@.dao2com.com> wrote in message news:<uSSwHLhAEHA.3348@.TK2MSFTNGP11.phx.gbl>...
> Hi,
> Your client side script should use cancelBubble and returnValue to
> disable event default process and raise alert if error found.
> function CallServer()
> {
> if validate
> {
> __doPostBack('MyControl','Data');
> }
> else
> {
> alert("Error");
> window.event.cancelBubble = true;
> window.event.returnValue = false;
> }
> }
>
> HTH
> Natty Gur[MVP]
> blog : http://weblogs.asp.net/ngur
> Mobile: +972-(0)58-888377
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!

Thanks Natty

This means I have to create inline javascripts which I'd rather not do
if I can help it. Just as luck would have it, after spending an 'hour
or two' trying to find a solution before posting, 5 mins after posting
I find a solution :( Always the way...

Anyhow, just for reference purposes, what I've done is to validate on
OnMouseDown and postback on OnClick. Works a treat
Hi Samuel,

Its unfortunate that you had to rework validation because of some incorrect
information about validators. The ASP.NET validators work fine within custom
controls. They have one key limitation related to their "location": the
ControlToValidate must be associated with the ID of a control in the same
"naming container". If your custom control impliments INamingContainer,
ControlToValidate can only point to other controls within your custom
control. If not, it can refer to other controls in the same naming container
that your custom control appears. Some types of naming containers: Page,
UserControl, and rows in DataGrid and DataList.

If you wanted to support validation without naming container limits, I wrote
a replacement to Microsoft's validators that overcomes that limitation among
numerous others: Professional Validation And More.
http://www.peterblum.com/vam/home.aspx.

-- Peter Blum
www.PeterBlum.com
Email: PLBlum@.PeterBlum.com
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx

"Samuel Hon" <noreply@.samuelhon.co.uk> wrote in message
news:c8672b7d.0403040703.c458604@.posting.google.co m...
> Hi
> I'm building a custom control which basically takes data from the user
> and then submits it. I would use the validator controls but if I
> understand correctly (I've been working with .Net for 2 weeks) you
> cant 'embed' them in the custom controls. Someone correct me if I'm
> wrong (and please point to an example :) )
> So, to get around this, I'm using Javascript. In my control, I'm doing
> Writer.WriteAttribute("OnClick", "javascript:checkData();" &
> Page.GetPostBackEventReference(Me, "Data"))
> for an Input item so I get something like
> <input type="button" value="Submit"
> OnClick="javascript:checkData();__doPostBack('MyControl','D ata')" />
> The checkData() function does this:
> function checkLogin()
> {
> if (document.Data.item1.value == "" )
> {
> alert("Please enter item 1.");
> return false;
> }
> if (document.Data.item2.value == "" )
> {
> alert("Please enter item 2.");
> return false;
> }
> if (document.Data.item1.value != "" && document.Data.item2.value !=
> "" )
> {
> return true;
> }
> }
> My query is, how do I get the click event to fire correctly so that i
> get alerts when there is a problem, and it passes through and submits
> the form if there isnt a problem?
> Thanks
> Sam
"Peter Blum" <PLBlum@.Blum.info> wrote in message news:<OC#ZP$uAEHA.624@.TK2MSFTNGP10.phx.gbl>...
> Hi Samuel,
> Its unfortunate that you had to rework validation because of some incorrect
> information about validators. The ASP.NET validators work fine within custom
> controls. They have one key limitation related to their "location": the
> ControlToValidate must be associated with the ID of a control in the same
> "naming container". If your custom control impliments INamingContainer,
> ControlToValidate can only point to other controls within your custom
> control. If not, it can refer to other controls in the same naming container
> that your custom control appears. Some types of naming containers: Page,
> UserControl, and rows in DataGrid and DataList.
> If you wanted to support validation without naming container limits, I wrote
> a replacement to Microsoft's validators that overcomes that limitation among
> numerous others: Professional Validation And More.
> http://www.peterblum.com/vam/home.aspx.
> -- Peter Blum
> www.PeterBlum.com
> Email: PLBlum@.PeterBlum.com
> Creator of "Professional Validation And More" at
> http://www.peterblum.com/vam/home.aspx
<snip
Thanks Peter for clearing that up, I will re-investigate

Sam

Monday, March 26, 2012

Suggestions and Help needed for Video report

Hi,

I need to create a web report that contains data and multiple video avi files. The report should able be exported to other formats , e.g. PDF, web archive.

I am thinking to provide a link to the video file, so when the user clicks on the link, the video is played in a pop up IE window which embeds a media player to play the video. And the link points to a Generic Handler file .ashx.
Else I may need to embed many media players in the HTML to play each avi files.

I need to export this report with all data and videos file. How can this be done with asp.net ReportViewer and SSRS ? Is it possible to intercept the export event and copy the video avi files before export ?
Any suggestions and ideas ?

Thanks in advance

Hello,

You can use gridview to show your reports and just use links for you to download avi files.

However, if you still want to use reportview control, here it is:

ReportViewer Sample ASP.NET Server Control

Binding Data to the ReportViewer Control Dynamically in ASP.NET 2.0

Saturday, March 24, 2012

suggestions?

I want to design an asp.net page which will have multiple controls. I want
to fill one of the control when there is some action like selecting
something from its previous control...I want to simulate as if its a windows
based application and the entire page is not refereshed (trip to
server)...other controls are not involved for this task...how can I
smoothly refresh these contols...I was reading about VIEWSTATE, is that the
solution to my problem...
ThanksYou'd use client side javascript for this. Search on dropdown list
and dependent in google for examples.
2005 Microsoft MVP C#
Robbe Morris
http://www.robbemorris.com
http://www.masterado.net/home/listings.aspx
"abcd" <abcd@.abcd.com> wrote in message
news:elV6cUQTFHA.3620@.TK2MSFTNGP09.phx.gbl...
>I want to design an asp.net page which will have multiple controls. I want
>to fill one of the control when there is some action like selecting
>something from its previous control...I want to simulate as if its a
>windows based application and the entire page is not refereshed (trip to
>server)...other controls are not involved for this task...how can I
>smoothly refresh these contols...I was reading about VIEWSTATE, is that the
>solution to my problem...
> Thanks
>

suggestions?

I want to design an asp.net page which will have multiple controls. I want
to fill one of the control when there is some action like selecting
something from its previous control...I want to simulate as if its a windows
based application and the entire page is not refereshed (trip to
server)...other controls are not involved for this task...how can I
smoothly refresh these contols...I was reading about VIEWSTATE, is that the
solution to my problem...

ThanksYou'd use client side javascript for this. Search on dropdown list
and dependent in google for examples.

--
2005 Microsoft MVP C#
Robbe Morris
http://www.robbemorris.com
http://www.masterado.net/home/listings.aspx

"abcd" <abcd@.abcd.com> wrote in message
news:elV6cUQTFHA.3620@.TK2MSFTNGP09.phx.gbl...
>I want to design an asp.net page which will have multiple controls. I want
>to fill one of the control when there is some action like selecting
>something from its previous control...I want to simulate as if its a
>windows based application and the entire page is not refereshed (trip to
>server)...other controls are not involved for this task...how can I
>smoothly refresh these contols...I was reading about VIEWSTATE, is that the
>solution to my problem...
> Thanks