Latest developer linksBookmark and Share
 
HomeThis WeekTop MonthTop AlltimeSearchRegisterFAQ
  
 
Submit Your Link
Please login to submit your Link
 

Tip/Trick: Increase your VS screen real estate by disabling HTML Navigation

Posted: Sep/23/2009   By: nikhil   Points:15   Category: .NET  - ASP.Net    Views:139   Vote Up (0)   Vote Down (0)    
Below is a tip/trick I twittered via my Twitter account earlier today. A number of people seemed interested in - so I thought i'd blog it here too.

HTML Navigation Bar in VS 2008
By default, when you are in HTML source-editing mode with VS 2008 and Visual Web Developer 2008 Express edition there is a set of drop-downs that are rendered immediately above the HTML text editor view:

View Complete Post


Comments:
Be the first to comment this post.
 
Post Comment
Please login to post your comment
More Related Resources

ASP.NET, HTML, JavaScript Snippet Support (VS 2010 and .NET 4.0 Series)

  
Visual Studio has supported the concept of "snippets" for VB and C# in previous releases - but not for HTML, ASP.NET markup and JavaScript. With VS 2010 we now support snippets for these content types as well.

Using ASP.NET Snippets
Let's walkthrough how we can use snippets to quickly implement a common security scenario. Specifically, we'll implement the functionality necessary to display either a "[ Login ]" link or a "[ Welcome UserName ]" message at the the top right of a site depending on whether or not the user is logged in:

Easily Extracting Links from a Snippet of HTML with HtmlAgilityPack

  
The HtmlAgilityPack is a powerful library that makes screen scraping in asp.net a breeze. This is the second in a continuing series where I demonstrate a way for you to extract all the links from a snippet of HTML

Create Navigation in asp.net web application

  
Create Navigation in asp.net web application. Create Navigation in asp.net

Calling javascript funtion: Trying to convert a simple example from html to asp.net

  

 I have this javascript function in a javascript file called Bing.js

function onGeocodeClick() {
    myMap.Clear();
    address = document.getElementById("txtWhere").value;
    StartGeocoding(address);
}

function StartGeocoding(address) {
    myMap.Find(null,    // what
              address, // where
              null,    // VEFindType (always VEFindType.Businesses)
              null,    // VEShapeLayer (base by default)
              null,    // start index for results (0 by default)
              null,    // max number of results (default is 10)
              null,    // show results? (default is true)
              null,    // create pushpin for what results? (ignored since what is null)
              null,    // use default disambiguation? (default is true)
              null,    // set best map view? (default is true)
              GeocodeCallback);  // call back function
}

I have this line in my masterpage referencing my javascript file called Bing.js

<head runat="server">
    <title>Geocoding in Bing Maps</title>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
      <link href="~/Styles/Site.css" rel="stylesheet" type="text/css" />
      <script type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.3"></script>
     <script src="Scripts/bingMap.js" type="text/javascript"></script>    <---***bingMap.js        
    <asp:ContentPlaceHolder ID="HeadContent" runat="server">
    </asp:ContentPlaceHolder>
</head>

I have this in my Default.aspx. I have my new asp.net textbox and asp.net button above the htm text and click from the bing example

<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
    <div>
        Address:
        <asp:TextBox ID="txtHere" Width="255px" runat="server" 
            ontextchanged="txtHere_TextChanged"></asp:TextBox>
         
        <asp:Button ID="Button1" runat="server" Text="Button" />
    </div>
    <div style="font-family:Arial; font-size:10pt">
          Address: 
          <input id="txtWhere" type="text" style="width:255px" />
           
          <input type="button" value="Geocode" onclick="onGeocodeClick()" />
       </div>
       <br />
       <div style="position:relative;width:400px;height:400px;" id="mapDiv">
       </div>
       <div id="resultsDiv" style="font-family:Arial;font-size:8pt;position:relative; top:-400px;left:425px;width:400px">
       </div>
</asp:Content>


Then this is my code behind for default.aspx.cs

  
    protected void Button1_Click(object sender, EventArgs e)
    {
        //myMap.Clear();
        //address = document.getElementById("txtWhere").value;
        //StartGeocoding(address);
        string address = txtHere.Text;
        // Get a ClientScriptManager reference from the Page class.
        ClientScriptManager cs = Page.ClientScript;

        // Check to see if the client script is already registered.
        if (!cs.IsClientScriptBlockRegistered(this.GetType(), "StartGeocoding"))
        {
            cs.RegisterClientScriptBlock(this.GetType(), "StartGeocoding", "StartGeocoding(address)");
        }
    }


On Button1_Click(), instead of calling StartGeocoding(address)...it prints the words StartGeocoding(address) at the top of the screen!
Is the ClientScriptBock above suppose to go into Page_Load? How do you make the javaScript call to StartGeocoding(address)?
Thanks, John Feeney



 


Help Need to show html page inside..an aspx page..

  

Hi All,

I trying to show a html file inside my aspx page. I will be greatful for your help.


Change Div Background Onclick (JS, HTML, CSS)

  

 I have only been using HTML/JS/CSS for the last few days, but i am stuck on something that seems like it would be really simple. I have searched through other forums for help but anything i have tried hasn't worked, so I'm guessing there must be something basic i am failing at.

 

Here is a simplified version of my web application (just to demonstrate the bit that wont work): 

 

<%@ Page Language="VB" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Javascript Change Div Background Image</title>

<style type="text/css">

.tab {
background: url('images/blue.gif');
background-repeat:repeat-x;
z-index: 1;
left: 13px;
top: 26px;
position: absolute;
height: 36px;
width: 100px;
}

.fadedtab
{
background: url('images/green.gif');
background-repeat:repeat-x;
z-index: 1;
left: 13px;
top: 26px;
position: absolute;
height: 36px;
width: 100px;
}
ul, li {
list-style-type: none;
}

a:link
{
color:#000000;
text-decoration:none;
}
a:hover
{
color:#ffffff;
text-decoration:underline;
}

</style>

<script type="text/javascript" >

function changeClass(mydiv) {
document.getElementById(mydiv).className = 'fadedtab';
}

</script>

</head>
<body>
<form id="frm_testpage" runat="server">
<div id="div_OrderDetails" class="fadedtab" runat="server">

<ul>
<li style="position:absolute; z-index: 2; top:9px; left:9px;"> <asp:LinkButton ID="lnk_OrderDetails" runat="server"
text="Order Details" onclientclick="changeClass(div_OrderDetails)"/>
</li>
</ul>

</div>
</form>
</body>
</html> 

<%@ Page Language="VB" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Javascript Change Div Background Image</title>

<style type="text/css">

.tab {
background: url('images/blue.gif');
background-repeat:repeat-x;
z-index: 1;
left: 13px;
top: 26px;
position: absolute;
height: 36px;
width: 100px;
}

.fadedtab
{
background: url('images/green.gif');
background-repeat:repeat-x;
z-index: 1;
left: 13px;
top: 26px;
position: absolute;
height: 36px;
width: 100px;
}
ul, li {
list-style-type: none;
}

a:link
{
color:#000000;
text-decoration:none;
}
a:hover
{
color:#ffffff;
text-decoration:underline;
}

</style>

<script type="text/javascript" >

function changeClass(mydiv) {
document.getElementById(mydiv).className = 'fadedtab';
}

</script>

</head>
<body>
<form id="frm_testpage" runat="server">
<div id="div_OrderDetails" class="fadedtab" runat="server">

<ul>
<li style="position:absolute; z-index: 2; top:9px; left:9px;"> <asp:LinkButton ID="lnk_OrderDetails" runat="server"
text="Order Details" onclientclick="changeClass(div_OrderDetails)"/>
</li>
</ul>

</div>
</form>
</body>
</html>

how can we use Strongly Typed Html Helpers in webmatrix?

  

I know we can use the HTML helpers, but how about the strongly typed one's?

Html.LabelFor()


Html.ListBox cannot select multiple items

  

I'm trying to use the ListBox html helper in a simple form.

verhuurPrijzenLst is a simple list that gets put into the ListBox, I think I need "MultiSelectList", but I cannot use it (MVC framework needed)?

I don't know exactly how to do that ( bin folder and @inherits ? )

So it's nice to have a helper at hand, but if you cannot use it properly without using the MVC framework, that is a pity.


   List<SelectListItem> verhuurPrijzenLst = new List<SelectListItem>();
   foreach (string dataLine in verhuurPrijzen) {
        var verhuurPrijslijn = dataLine.Split(delimiterChar)[0].AsDateTime().ToString("dd MMMM") + " - " + dataLine.Split(delimiterChar)[0].AsDateTime().AddDays(7).ToString("dd MMMM") + " ? " + dataLine.Split(delimiterChar)[1] + ",00";
        var selecteer = false;
        if(Request["Huurperiode"] != null)
        {
            if(Request["Huurperiode"].Contains(verhuurPrijslijn))
            {
                selecteer = true;
            }
        }
        verhuurPrijzenLst.Add(new SelectListItem { Text = verhuurPrijslijn, Selected = selecteer });
    }
    @Html.ListBox("Huurperiode",verhuurPrijzenLst,new {size="15", multiple="multiple"});





CreateUserWizard duplicating HTML inside steps?

  
Hello everyone,

I was wondering if anyone has come across what seems like a bug (though I'm fully updated and can't find reference to this anyway) in Visual Studio.

I've a CreateUserWizard and in some of the steps, it appears to be duplicating HTML inside of itself when I switch step views.

Step 2, for example says "please enter your first name", once I view step 2, or 3 etc, step 2 generates "please enter your first nameplease enter your first nameplease enter your first nameplease enter your first name".

This is inside the actual aspx file so is surely an issue with Visual Studio, but I can't work out how to solve it.

I've looked for broken tags or incorrect values that may be confusing it, but can find none.

Anyone else come across this?

Thank you
 
p.s.  This is Visual Studio 2008, incase this affects anything.

 


Disabling ViewState for DropDownList and using AutoPostback with SelectedIndexChanged

  

The sites I mantain are using way too much ViewState and I'd like to reduce that so the size of the page is reduced.  I've done a lot to remedy this but I have an issue relating to DropDown lists that use AutoPostbacks.

I have a dropdown list with a lot of list items and a good part of the ViewState usage is to hold the list item data.  If I disable ViewState and set the AutoPostBack property to true, the page will post back and in the page load I am trying to repopulate the dropdown list with cached data.  However, it seems that the SelectedIndexChanged event doesn't fire when EnableViewState="false".

Is it possible to make this work without enabling ViewState for the drodown list?


 
Categories:
.NET
Java
PHP
C/C++/VC++
HTML/XML
SAP
MainFrames
Data Warehousing
Testing
MySQL
SQL Server
Oracle
Javascript/VB Script
Others
Login
 
 
 
 
 Forgot password
 Contact Us   Terms Of use   Share your knowledge