.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

body onload

Posted By:      Posted Date: September 24, 2010    Points: 0   Category :ASP.Net

Hi everyone,

i have a gridview in which user insert the equipId and i am using the body onload event to pop up the message saying you have the same id exist once the user click ok it goes back to the page and focuses on the text box inside the gridview, till here its fine but after user enter different id and try to insert it into the girdview, it inserts fine but it pops up that message again. any idea here is my code for it

Body.Attributes.Add("onload", "javascript:alert('Same Equipment Code Found.Please enter different Equipment Code');");

View Complete Post

More Related Resource Links

getting the body onload event in a Contentplaceholder


Dear Friends,

I am displaying a map on a aspx web page using Mapserver and openlayers.
The map was being displayed fine on a normal aspx page.
Then I added a Masterpage to it and with it came 2 ContentPlaceholders.
I put the Div for displaying the map in one of the ContentPlaceholders.

But the problem is that map is no longer displayed.
For displaying the map I need to call a JS function init() in the body onload event.
But there is no body onload event in ContentPlaceholders.
I tried putting like this:

<script type="text/javascript" language="javascript">

body.onload = init();

function init()


But I get error.

How to tackle this problem?

Thanks for your responses.

document.body.onload = ("javascript:initialize()")




    var geocoder, location1, location2, location3, gDir;
    function initialize() {
        geocoder = new GClientGeocoder();
        gDir = new GDirections();
        GEvent.addListener(gDir, "load", function () {
            var drivingDistanceMiles = gDir.getDistance().meters / 1609.344;
            var drivingDistanceKilometers = gDir.getDistance().meters / 1000;
            document.getElementById("Button2").value = drivingDistanceKilometers.toFixed(0);

Not work:

<script type="text/javascript">
            document.body.onload = ("javascript:initialize()")


Error in Microsoft JScript: 'document.body' has the value "null" or not an object

What's wrong?



<body onload="javascript:initialize()">

statement cannot appear outside of a method body


hi all,

  i am posting my vb.net problem .plz tell me how to resolve this :-

Dim conn As String = ConfigurationManager.ConnectionStrings("NorthwindConnectionString").ConnectionString
    'Dim mysqlconnection As New SqlConnection(conn)
    'If mysqlconnection.State=ConnectionState.closed Then mysqlconnection.Open();
    'Dim mySqlcommand As New SqlCommand("select CategoryId,CategoryName from Categories", mysqlconnection)
    'Dim mySqlDataAdapter As New SqlDataAdapter(mySqlcommand)
    'Dim mydataSet As New DataSet()

    'if mysqlconnection.State=ConnectionState.closed Then mysqlconnection.Open();

i m getting 5 errors in this code

declaration expected in mySqlDataAdapter.Fill method; Gridview1.DataSource=ds; Gridview1.DataBind();

Announcements with Image in Body, displayed via CQWP


I feel like I've set this up to be as difficult as possible for my non-programmer users ;) There's GOT to be a better way. Any guidance much appreciated.

I have an Announcements-type list on a NEWS subsite, with fields for Title, Body, and Summary (body with image plus first few sentences of Body). I have a separate Picture Library to store the images they'll use in the Body and Summary.

The Title and Summary are displayed on the Site Collection HOME using a CQWP.

My instructions for users are as follows

1. place image in http://site/subsite/imagelibrary/Forms/AllItems.aspx
2. right click on image and select Copy
3. go to http://site/subsite/announcementspage.aspx
4. Click New > New Item.
5. In "Body", click CTRL+V.
6. Add Title, Body, and Summary text.
7. In HTML, add align="left" insite <img> tag.

Adding to http://site/subsite/announcementspage.aspx automatically gets picked up by the CQWP on the home page.

Like I said, it's pretty ugly, esp considering that my users don't know HTML. Recommendations warmly appreciated.

how to embed image in mail body while sending mail in c#.net uisng Exchange2007_SP1.



I am uisng ExchangeVersion.Exchange2007_SP1 EWS to send mail through my c#.net application. I want to embed image in mail body so tht user can see body message along with image in its inbox mail .currently I am uisng image tag to show image but in the email body its just showing image url instead of image.

IFrame onload event


The code below I am having problems with. I have a page with multiple views. When the 2nd view loads up I want an animated gif to appear untill the pages loads up in the iFrame.

In the onload event inside the iframe I try to call a javascript function. I get the following error when I try to call the javascript function:

'ASP.applications_onlinebillpay_payment_aspx' does not contain a definition for 'hideLoading' and no extension method 'hideLoading' accepting a first argument of type 'ASP.applications_onlinebillpay_payment_aspx' could be found (are you missing a using directive or an assembly reference?)

If I take out the runat="server" part it will work but I need to assign the src of the iframe in my c# code.

The code is:

<asp:View ID="View2" runat="server">
         <script type="text/javascript">
            function hideLoading() {

body tag's header and footer problem

Hiii Coders, I have made all the pages of my wesite centered aligned using the following code in masterpage:<body background="Images/bg2.gif"> <form id="form1" runat="server"> <table style="width:960px; margin-left:auto; margin-right:auto; background-color:White;"> my content </table> No doubt, it works fine ut still it shows body background from top and bottom. I don't want to show it from top and bottom. Means that website should be centered align from left and right sides only whereas should display my form/webpage fron top and bottom. plz helpand provide some code snippet thanx and regards 

need regular expression to get message body

I have text like this: <tr class="NormalRow_Small"> <td colspan=2>&nbsp;</td> <td colspan=3> </td> </tr> <tr class="NormalRow_Small"> <!--description--> <td colspan="5"> <font size="2">Hi All,<div><!br /></div><div>I'm glad to introduce ...</div><div><!br /></div><div>Actually we already have ... <font size=1>(see link for full text)</font></font><br> <font size="1"> </td> </tr> <tr> <td colspan=5><hr /></td> </tr>   I want to get bold text, please help me.   Thanks, Alex.

Best regex for email body on contact form?

I'm not sure the best way to do a regex for the body section of an email contact form.  I want to use the regex to prevent more than 150 characters from being entered.  I assume this is sufficient, I may need more.  I also want it to help guard against sql injection attacks. The more I think about it the more characters I can think of that should be allowed.  I want to allow punctuation since it's for an email and people should be using full sentences.  These are some other things that make sense to allow: " , ', : , ; , $ , . , ! , ? , - , _ , @ , & , ( , ). They cover situations when someone may put an email address or phone number in the body section for the email.  I also want to allow letters and numbers.    I'm not sure if it's best to allow the characters I mentioned or not allow characters that pose a potential threat.  I think allowing the ones I want is the best way, but I'm not sure.  Can someone please give an example and/or suggestions?  Are there other characters that should be allowed?  I don't have much yet: "^(?i)[a-z0-9\s]{1,150}$"

Sign outgoing body from client with custom endpoing behavior defined in code

I'm trying to sign (and sign only) the body of every outgoing message that uses this custom endpoint behavior.  When I first created this it was for signing a custom SOAP header.  We are moving away from that and going to just sign the body.  We have some applications that have 10+ web service references.  We don't want to touch the reference.cs for anything.  Below is the code I had before for signing the custom soap header.  I'm trying to modify it to just sign the body.  My modified code is below, and the error I get. Private Class CustomHeaderBehavior Implements ServiceModel.Description.IEndpointBehavior Public Sub New() End Sub Private Sub AddBindingParameters( _ ByVal endpoint As ServiceModel.Description.ServiceEndpoint, _ ByVal bindingParameters As ServiceModel.Channels.BindingParameterCollection) _ Implements ServiceModel.Description.IEndpointBehavior.AddBindingParameters Dim body As New Xml.XmlQualifiedName("Body", "http://schemas.xmlsoap.org/soap/envelope/") Dim BodyMsgPartSpec As New ServiceModel.Security.MessagePartSpecification() BodyMsgPartSpec.IsBodyIncluded = True Dim requirements As ServiceModel.Security.ChannelProtectionRequirements = bindingParameters.Remove(Of ServiceModel.Security.ChannelProtectionRequirements)() requirements

does SPD support filtering of the mail title/body we send to a list/library?

for example, if we send a mail with the title of "%hostname% %ipaddress%" to a list. can SPD WF filter the title and get %hostname% to a new variable? the reason to ask this is i want to send a well-formated mail to sharepoint and the automatical WF can recognize the change of the list items and update the relevant columns by the filtered content from mail title or body. thanks!

SQL Server Tables and Exchange Web Services sample does not include email body

I've sucessfuly implemented the above, very useful example. However, I cannot work out how to include the Body of the email with the reast of the data. Can anyone shed some light for me? Thanks Robert

Immediate alert email body is truncated intermittently in MOSS 2007

Hi All, I  am facing one issue with Alert. We have one Posts list in one of the Blog where Alert Me generates immediate alert for the users who have subscribed to the Blogs. Whenever any new Post added, edited or deleted they used to get alerts. But in the alert email, the body of the alert which normally contains the Post decsription gets truncated intermittently. Sometimes it is truncated with less than 2048 characters in the Body filed and some times with more than 4098 characters. I found in some articles that the limitation is 2048 characters in one line after whcih the new line is expected , else the text will be truncated. I am not able to find the logic behind this truncation in default sharepoint alert functionality. Could you please give some more insights on this front? Thnaks:)  

ListView extends beyond body

I have a ListView with 4 images across each line, and each cell is 200px wide.  Allowing for miscellanious other items on the page, the width of the page is over 800px. When I view the page with sufficiently high screen resolution (over 800px width) it looks good.  When I view the page on a low resolution screen (say 800x600), the form's body ends as I scroll right, but the images continue to the right.  It looks rediculous. Is there a way to have the body adjust its width automaticallty to allow for lower resolution screens? By the way - any ideas on what is the most common resolution out there?   Help would be most appreciated.

Signing The Body of a Web Service Request (From Client)

Hello, I attempting to consume a webservice, which has numerous security factors, one of which is SSL. I am using WS-Security and attempting to sign the body of my request.  Right now it is only currently signing the timestamp and to: (endpoint).  I've been scouring the forums, but seem to come to a dead end with threads dying off... http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/034f71cd-408e-447c-a95c-e0cf4baa5742 I'm assuming I will have to modify the reference.cs file or maybe even the WSDL, but here's some of the code I've done for the binding..is this on the right track? WSHttpBinding myBinding = new WSHttpBinding(); myBinding.Security.Mode = SecurityMode.TransportWithMessageCredential; myBinding.Security.Message.ClientCredentialType = MessageCredentialType.Certificate; myBinding.Security.Message.NegotiateServiceCredential = false; myBinding.Security.Message.EstablishSecurityContext = false;

Access an IFrame's body tag in javascript

I want to dynamically set some attributes in an IFrame (like textAlign).  I keep getting "undefined" for all the different things I try.  When I inspect the element, it seems as though I should be able to access the html > body tag from the iFrame object, but that is not the case:var myIFrame = document.getElementById("myIFrame"); alert(myIFrame.childNodes[0]); //Expecting "Html Node", getting "undefined" myIFrame.style.textAlign = "right"; //this does nothing even though I can set the style.textAlign attribute without the javascript failing, it doesn't do anything.  Looking at Chrome's element inspector, I'm able to get the desired result by placing an inline style on the body tag within the iFrame tag.

Right align image in header with matrix in body

I need to have a logo image right aligned in the header, yet the body of the report consists of a matrix that fills the report horizontally. The page size is 11in / 8.5in, yet the designed size is 5in wide, because the matrix takes up this amount. If I increase the design width to 11, I get blank pages because I believe that the matrix it pushing to page to overflow. Leaving the design width to 5, I place the logo in the upper right, when previewd, it is fixed in this position, in the center of the header. How can I get the image to flow and right align and follow to the end of the matrix on the page? I have tried placing it in a text box, but this does not work. I have tried to pad the image, and that does not work either. Is there an expression that can be used to align this to the right? TIA Rick
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend