Search Results

Search found 1705 results on 69 pages for 'runat'.

Page 1/69 | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • ASP.NET Podcast Show #148 - ASP.NET WebForms to build a Mobile Web Application

    - by Wallym
    Check the podcast site for the original url. This is the video and source code for an ASP.NET WebForms app that I wrote that is optimized for the iPhone and mobile environments.  Subscribe to everything. Subscribe to WMV. Subscribe to M4V for iPhone/iPad. Subscribe to MP3. Download WMV. Download M4V for iPhone/iPad. Download MP3. Link to iWebKit. Source Code: <%@ Page Title="MapSplore" Language="C#" MasterPageFile="iPhoneMaster.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="AT_iPhone_Default" %> <asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server"></asp:Content><asp:Content ID="Content2" ContentPlaceHolderID="Content" Runat="Server" ClientIDMode="Static">    <asp:ScriptManager ID="sm" runat="server"         EnablePartialRendering="true" EnableHistory="false" EnableCdn="true" />    <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script>    <script  language="javascript"  type="text/javascript">    <!--    Sys.WebForms.PageRequestManager.getInstance().add_endRequest(endRequestHandle);    function endRequestHandle(sender, Args) {        setupMapDiv();        setupPlaceIveBeen();    }    function setupPlaceIveBeen() {        var mapPlaceIveBeen = document.getElementById('divPlaceIveBeen');        if (mapPlaceIveBeen != null) {            var PlaceLat = document.getElementById('<%=hdPlaceIveBeenLatitude.ClientID %>').value;            var PlaceLon = document.getElementById('<%=hdPlaceIveBeenLongitude.ClientID %>').value;            var PlaceTitle = document.getElementById('<%=lblPlaceIveBeenName.ClientID %>').innerHTML;            var latlng = new google.maps.LatLng(PlaceLat, PlaceLon);            var myOptions = {                zoom: 14,                center: latlng,                mapTypeId: google.maps.MapTypeId.ROADMAP            };            var map = new google.maps.Map(mapPlaceIveBeen, myOptions);            var marker = new google.maps.Marker({                position: new google.maps.LatLng(PlaceLat, PlaceLon),                map: map,                title: PlaceTitle,                clickable: false            });        }    }    function setupMapDiv() {        var mapdiv = document.getElementById('divImHere');        if (mapdiv != null) {            var PlaceLat = document.getElementById('<%=hdPlaceLat.ClientID %>').value;            var PlaceLon = document.getElementById('<%=hdPlaceLon.ClientID %>').value;            var PlaceTitle = document.getElementById('<%=hdPlaceTitle.ClientID %>').value;            var latlng = new google.maps.LatLng(PlaceLat, PlaceLon);            var myOptions = {                zoom: 14,                center: latlng,                mapTypeId: google.maps.MapTypeId.ROADMAP            };            var map = new google.maps.Map(mapdiv, myOptions);            var marker = new google.maps.Marker({                position: new google.maps.LatLng(PlaceLat, PlaceLon),                map: map,                title: PlaceTitle,                clickable: false            });        }     }    -->    </script>    <asp:HiddenField ID="Latitude" runat="server" />    <asp:HiddenField ID="Longitude" runat="server" />    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js%22%3E%3C/script>    <script language="javascript" type="text/javascript">        $(document).ready(function () {            GetLocation();            setupMapDiv();            setupPlaceIveBeen();        });        function GetLocation() {            if (navigator.geolocation != null) {                navigator.geolocation.getCurrentPosition(getData);            }            else {                var mess = document.getElementById('<%=Message.ClientID %>');                mess.innerHTML = "Sorry, your browser does not support geolocation. " +                    "Try the latest version of Safari on the iPhone, Android browser, or the latest version of FireFox.";            }        }        function UpdateLocation_Click() {            GetLocation();        }        function getData(position) {            var latitude = position.coords.latitude;            var longitude = position.coords.longitude;            var hdLat = document.getElementById('<%=Latitude.ClientID %>');            var hdLon = document.getElementById('<%=Longitude.ClientID %>');            hdLat.value = latitude;            hdLon.value = longitude;        }    </script>    <asp:Label ID="Message" runat="server" />    <asp:UpdatePanel ID="upl" runat="server">        <ContentTemplate>    <asp:Panel ID="pnlStart" runat="server" Visible="true">    <div id="topbar">        <div id="title">MapSplore</div>    </div>    <div id="content">        <ul class="pageitem">            <li class="menu">                <asp:LinkButton ID="lbLocalDeals" runat="server" onclick="lbLocalDeals_Click">                <asp:Image ID="imLocalDeals" runat="server" ImageUrl="~/Images/ArtFavor_Money_Bag_Icon.png" Height="30" />                <span class="name">Local Deals.</span>                <span class="arrow"></span>                </asp:LinkButton>                </li>            <li class="menu">                <asp:LinkButton ID="lbLocalPlaces" runat="server" onclick="lbLocalPlaces_Click">                <asp:Image ID="imLocalPlaces" runat="server" ImageUrl="~/Images/Andy_Houses_on_the_horizon_-_Starburst_remix.png" Height="30" />                <span class="name">Local Places.</span>                <span class="arrow"></span>                </asp:LinkButton>                </li>            <li class="menu">                <asp:LinkButton ID="lbWhereIveBeen" runat="server" onclick="lbWhereIveBeen_Click">                <asp:Image ID="imImHere" runat="server" ImageUrl="~/Images/ryanlerch_flagpole.png" Height="30" />                <span class="name">I've been here.</span>                <span class="arrow"></span>                </asp:LinkButton>                </li>            <li class="menu">                <asp:LinkButton ID="lbMyStats" runat="server">                <asp:Image ID="imMyStats" runat="server" ImageUrl="~/Images/Anonymous_Spreadsheet.png" Height="30" />                <span class="name">My Stats.</span>                <span class="arrow"></span>                </asp:LinkButton>                </li>            <li class="menu">                <asp:LinkButton ID="lbAddAPlace" runat="server" onclick="lbAddAPlace_Click">                <asp:Image ID="imAddAPlace" runat="server" ImageUrl="~/Images/jean_victor_balin_add.png" Height="30" />                <span class="name">Add a Place.</span>                <span class="arrow"></span>                </asp:LinkButton>                </li>            <li class="button">                <input type="button" value="Update Your Current Location" onclick="UpdateLocation_Click()">                </li>        </ul>    </div>    </asp:Panel>    <div>    <asp:Panel ID="pnlCoupons" runat="server" Visible="false">        <div id="topbar">        <div id="title">MapSplore</div>        <div id="leftbutton">            <asp:LinkButton runat="server" Text="Return"                 ID="ReturnFromDeals" OnClick="ReturnFromDeals_Click" /></div></div>    <div class="content">    <asp:ListView ID="lvCoupons" runat="server">        <LayoutTemplate>            <ul class="pageitem" runat="server">                <asp:PlaceHolder ID="itemPlaceholder" runat="server" />            </ul>        </LayoutTemplate>        <ItemTemplate>            <li class="menu">                <asp:LinkButton ID="lbBusiness" runat="server" Text='<%#Eval("Place.Name") %>' OnClick="lbBusiness_Click">                    <span class="comment">                    <asp:Label ID="lblAddress" runat="server" Text='<%#Eval("Place.Address1") %>' />                    <asp:Label ID="lblDis" runat="server" Text='<%# Convert.ToString(Convert.ToInt32(Eval("Place.Distance"))) + " meters" %>' CssClass="smallText" />                    <asp:HiddenField ID="hdPlaceId" runat="server" Value='<%#Eval("PlaceId") %>' />                    <asp:HiddenField ID="hdGeoPromotionId" runat="server" Value='<%#Eval("GeoPromotionId") %>' />                    </span>                    <span class="arrow"></span>                </asp:LinkButton></li></ItemTemplate></asp:ListView><asp:GridView ID="gvCoupons" runat="server" AutoGenerateColumns="false">            <HeaderStyle BackColor="Silver" />            <AlternatingRowStyle BackColor="Wheat" />            <Columns>                <asp:TemplateField AccessibleHeaderText="Business" HeaderText="Business">                    <ItemTemplate>                        <asp:Image ID="imPlaceType" runat="server" Text='<%#Eval("Type") %>' ImageUrl='<%#Eval("Image") %>' />                        <asp:LinkButton ID="lbBusiness" runat="server" Text='<%#Eval("Name") %>' OnClick="lbBusiness_Click" />                        <asp:LinkButton ID="lblAddress" runat="server" Text='<%#Eval("Address1") %>' CssClass="smallText" />                        <asp:Label ID="lblDis" runat="server" Text='<%# Convert.ToString(Convert.ToInt32(Eval("Distance"))) + " meters" %>' CssClass="smallText" />                        <asp:HiddenField ID="hdPlaceId" runat="server" Value='<%#Eval("PlaceId") %>' />                        <asp:HiddenField ID="hdGeoPromotionId" runat="server" Value='<%#Eval("GeoPromotionId") %>' />                        <asp:Label ID="lblInfo" runat="server" Visible="false" />                    </ItemTemplate>                </asp:TemplateField>            </Columns>        </asp:GridView>    </div>    </asp:Panel>    <asp:Panel ID="pnlPlaces" runat="server" Visible="false">    <div id="topbar">        <div id="title">            MapSplore</div><div id="leftbutton">            <asp:LinkButton runat="server" Text="Return"                 ID="ReturnFromPlaces" OnClick="ReturnFromPlaces_Click" /></div></div>        <div id="content">        <asp:ListView ID="lvPlaces" runat="server">            <LayoutTemplate>                <ul id="ulPlaces" class="pageitem" runat="server">                    <asp:PlaceHolder ID="itemPlaceholder" runat="server" />                    <li class="menu">                        <asp:LinkButton ID="lbNotListed" runat="server" CssClass="name"                            OnClick="lbNotListed_Click">                            Place not listed                            <span class="arrow"></span>                            </asp:LinkButton>                    </li>                </ul>            </LayoutTemplate>            <ItemTemplate>            <li class="menu">                <asp:LinkButton ID="lbImHere" runat="server" CssClass="name"                     OnClick="lbImHere_Click">                <%#DisplayName(Eval("Name")) %>&nbsp;                <%# Convert.ToString(Convert.ToInt32(Eval("Distance"))) + " meters" %>                <asp:HiddenField ID="hdPlaceId" runat="server" Value='<%#Eval("PlaceId") %>' />                <span class="arrow"></span>                </asp:LinkButton></li></ItemTemplate></asp:ListView>    </div>    </asp:Panel>    <asp:Panel ID="pnlImHereNow" runat="server" Visible="false">        <div id="topbar">        <div id="title">            MapSplore</div><div id="leftbutton">            <asp:LinkButton runat="server" Text="Places"                 ID="lbImHereNowReturn" OnClick="lbImHereNowReturn_Click" /></div></div>            <div id="rightbutton">            <asp:LinkButton runat="server" Text="Beginning"                ID="lbBackToBeginning" OnClick="lbBackToBeginning_Click" />            </div>        <div id="content">        <ul class="pageitem">        <asp:HiddenField ID="hdPlaceId" runat="server" />        <asp:HiddenField ID="hdPlaceLat" runat="server" />        <asp:HiddenField ID="hdPlaceLon" runat="server" />        <asp:HiddenField ID="hdPlaceTitle" runat="server" />        <asp:Button ID="btnImHereNow" runat="server"             Text="I'm here" OnClick="btnImHereNow_Click" />             <asp:Label ID="lblPlaceTitle" runat="server" /><br />        <asp:TextBox ID="txtWhatsHappening" runat="server" TextMode="MultiLine" Rows="2" style="width:300px" /><br />        <div id="divImHere" style="width:300px; height:300px"></div>        </div>        </ul>    </asp:Panel>    <asp:Panel runat="server" ID="pnlIveBeenHere" Visible="false">        <div id="topbar">        <div id="title">            Where I've been</div><div id="leftbutton">            <asp:LinkButton ID="lbIveBeenHereBack" runat="server" Text="Back" OnClick="lbIveBeenHereBack_Click" /></div></div>        <div id="content">        <asp:ListView ID="lvWhereIveBeen" runat="server">            <LayoutTemplate>                <ul id="ulWhereIveBeen" class="pageitem" runat="server">                    <asp:PlaceHolder ID="itemPlaceholder" runat="server" />                </ul>            </LayoutTemplate>            <ItemTemplate>            <li class="menu" runat="server">                <asp:LinkButton ID="lbPlaceIveBeen" runat="server" OnClick="lbPlaceIveBeen_Click" CssClass="name">                    <asp:Label ID="lblPlace" runat="server" Text='<%#Eval("PlaceName") %>' /> at                    <asp:Label ID="lblTime" runat="server" Text='<%#Eval("ATTime") %>' CssClass="content" />                    <asp:HiddenField ID="hdATID" runat="server" Value='<%#Eval("ATID") %>' />                    <span class="arrow"></span>                </asp:LinkButton>            </li>            </ItemTemplate>        </asp:ListView>        </div>        </asp:Panel>    <asp:Panel runat="server" ID="pnlPlaceIveBeen" Visible="false">        <div id="topbar">        <div id="title">            I've been here        </div>        <div id="leftbutton">            <asp:LinkButton ID="lbPlaceIveBeenBack" runat="server" Text="Back" OnClick="lbPlaceIveBeenBack_Click" />        </div>        <div id="rightbutton">            <asp:LinkButton ID="lbPlaceIveBeenBeginning" runat="server" Text="Beginning" OnClick="lbPlaceIveBeenBeginning_Click" />        </div>        </div>        <div id="content">            <ul class="pageitem">            <li>            <asp:HiddenField ID="hdPlaceIveBeenPlaceId" runat="server" />            <asp:HiddenField ID="hdPlaceIveBeenLatitude" runat="server" />            <asp:HiddenField ID="hdPlaceIveBeenLongitude" runat="server" />            <asp:Label ID="lblPlaceIveBeenName" runat="server" /><br />            <asp:Label ID="lblPlaceIveBeenAddress" runat="server" /><br />            <asp:Label ID="lblPlaceIveBeenCity" runat="server" />,             <asp:Label ID="lblPlaceIveBeenState" runat="server" />            <asp:Label ID="lblPlaceIveBeenZipCode" runat="server" /><br />            <asp:Label ID="lblPlaceIveBeenCountry" runat="server" /><br />            <div id="divPlaceIveBeen" style="width:300px; height:300px"></div>            </li>            </ul>        </div>                </asp:Panel>         <asp:Panel ID="pnlAddPlace" runat="server" Visible="false">                <div id="topbar"><div id="title">MapSplore</div><div id="leftbutton"><asp:LinkButton ID="lbAddPlaceReturn" runat="server" Text="Back" OnClick="lbAddPlaceReturn_Click" /></div><div id="rightnav"></div></div><div id="content">    <ul class="pageitem">        <li id="liPlaceAddMessage" runat="server" visible="false">        <asp:Label ID="PlaceAddMessage" runat="server" />        </li>        <li class="bigfield">        <asp:TextBox ID="txtPlaceName" runat="server" placeholder="Name of Establishment" />        </li>        <li class="bigfield">        <asp:TextBox ID="txtAddress1" runat="server" placeholder="Address 1" />        </li>        <li class="bigfield">        <asp:TextBox ID="txtCity" runat="server" placeholder="City" />        </li>        <li class="select">        <asp:DropDownList ID="ddlProvince" runat="server" placeholder="Select State" />          <span class="arrow"></span>              </li>        <li class="bigfield">        <asp:TextBox ID="txtZipCode" runat="server" placeholder="Zip Code" />        </li>        <li class="select">        <asp:DropDownList ID="ddlCountry" runat="server"             onselectedindexchanged="ddlCountry_SelectedIndexChanged" />        <span class="arrow"></span>        </li>        <li class="bigfield">        <asp:TextBox ID="txtPhoneNumber" runat="server" placeholder="Phone Number" />        </li>        <li class="checkbox">            <span class="name">You Here Now:</span> <asp:CheckBox ID="cbYouHereNow" runat="server" Checked="true" />        </li>        <li class="button">        <asp:Button ID="btnAdd" runat="server" Text="Add Place"             onclick="btnAdd_Click" />        </li>    </ul></div>        </asp:Panel>        <asp:Panel ID="pnlImHere" runat="server" Visible="false">            <asp:TextBox ID="txtImHere" runat="server"                 TextMode="MultiLine" Rows="3" Columns="40" /><br />            <asp:DropDownList ID="ddlPlace" runat="server" /><br />            <asp:Button ID="btnHere" runat="server" Text="Tell Everyone I'm Here"                 onclick="btnHere_Click" /><br />        </asp:Panel>     </div>    </ContentTemplate>    </asp:UpdatePanel> </asp:Content> Code Behind .cs file: using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.HtmlControls;using System.Web.UI.WebControls;using LocationDataModel; public partial class AT_iPhone_Default : ViewStatePage{    private iPhoneDevice ipd;     protected void Page_Load(object sender, EventArgs e)    {        LocationDataEntities lde = new LocationDataEntities();        if (!Page.IsPostBack)        {            var Countries = from c in lde.Countries select c;            foreach (Country co in Countries)            {                ddlCountry.Items.Add(new ListItem(co.Name, co.CountryId.ToString()));            }            ddlCountry_SelectedIndexChanged(ddlCountry, null);            if (AppleIPhone.IsIPad())                ipd = iPhoneDevice.iPad;            if (AppleIPhone.IsIPhone())                ipd = iPhoneDevice.iPhone;            if (AppleIPhone.IsIPodTouch())                ipd = iPhoneDevice.iPodTouch;        }    }    protected void btnPlaces_Click(object sender, EventArgs e)    {    }    protected void btnAdd_Click(object sender, EventArgs e)    {        bool blImHere = cbYouHereNow.Checked;        string Place = txtPlaceName.Text,            Address1 = txtAddress1.Text,            City = txtCity.Text,            ZipCode = txtZipCode.Text,            PhoneNumber = txtPhoneNumber.Text,            ProvinceId = ddlProvince.SelectedItem.Value,            CountryId = ddlCountry.SelectedItem.Value;        int iProvinceId, iCountryId;        double dLatitude, dLongitude;        DataAccess da = new DataAccess();        if ((!String.IsNullOrEmpty(ProvinceId)) &&            (!String.IsNullOrEmpty(CountryId)))        {            iProvinceId = Convert.ToInt32(ProvinceId);            iCountryId = Convert.ToInt32(CountryId);            if (blImHere)            {                dLatitude = Convert.ToDouble(Latitude.Value);                dLongitude = Convert.ToDouble(Longitude.Value);                da.StorePlace(Place, Address1, String.Empty, City,                    iProvinceId, ZipCode, iCountryId, PhoneNumber,                    dLatitude, dLongitude);            }            else            {                da.StorePlace(Place, Address1, String.Empty, City,                    iProvinceId, ZipCode, iCountryId, PhoneNumber);            }            liPlaceAddMessage.Visible = true;            PlaceAddMessage.Text = "Awesome, your place has been added. Add Another!";            txtPlaceName.Text = String.Empty;            txtAddress1.Text = String.Empty;            txtCity.Text = String.Empty;            ddlProvince.SelectedIndex = -1;            txtZipCode.Text = String.Empty;            txtPhoneNumber.Text = String.Empty;        }        else        {            liPlaceAddMessage.Visible = true;            PlaceAddMessage.Text = "Please select a State and a Country.";        }    }    protected void ddlCountry_SelectedIndexChanged(object sender, EventArgs e)    {        string CountryId = ddlCountry.SelectedItem.Value;        if (!String.IsNullOrEmpty(CountryId))        {            int iCountryId = Convert.ToInt32(CountryId);            LocationDataModel.LocationDataEntities lde = new LocationDataModel.LocationDataEntities();            var prov = from p in lde.Provinces where p.CountryId == iCountryId                        orderby p.ProvinceName select p;                        ddlProvince.Items.Add(String.Empty);            foreach (Province pr in prov)            {                ddlProvince.Items.Add(new ListItem(pr.ProvinceName, pr.ProvinceId.ToString()));            }        }        else        {            ddlProvince.Items.Clear();        }    }    protected void btnImHere_Click(object sender, EventArgs e)    {        int i = 0;        DataAccess da = new DataAccess();        double Lat = Convert.ToDouble(Latitude.Value),            Lon = Convert.ToDouble(Longitude.Value);        List<Place> lp = da.NearByLocations(Lat, Lon);        foreach (Place p in lp)        {            ListItem li = new ListItem(p.Name, p.PlaceId.ToString());            if (i == 0)            {                li.Selected = true;            }            ddlPlace.Items.Add(li);            i++;        }        pnlAddPlace.Visible = false;        pnlImHere.Visible = true;    }    protected void lbImHere_Click(object sender, EventArgs e)    {        string UserName = Membership.GetUser().UserName;        ListViewItem lvi = (ListViewItem)(((LinkButton)sender).Parent);        HiddenField hd = (HiddenField)lvi.FindControl("hdPlaceId");        long PlaceId = Convert.ToInt64(hd.Value);        double dLatitude = Convert.ToDouble(Latitude.Value);        double dLongitude = Convert.ToDouble(Longitude.Value);        DataAccess da = new DataAccess();        Place pl = da.GetPlace(PlaceId);        pnlImHereNow.Visible = true;        pnlPlaces.Visible = false;        hdPlaceId.Value = PlaceId.ToString();        hdPlaceLat.Value = pl.Latitude.ToString();        hdPlaceLon.Value = pl.Longitude.ToString();        hdPlaceTitle.Value = pl.Name;        lblPlaceTitle.Text = pl.Name;    }    protected void btnHere_Click(object sender, EventArgs e)    {        string UserName = Membership.GetUser().UserName;        string WhatsH = txtImHere.Text;        long PlaceId = Convert.ToInt64(ddlPlace.SelectedValue);        double dLatitude = Convert.ToDouble(Latitude.Value);        double dLongitude = Convert.ToDouble(Longitude.Value);        DataAccess da = new DataAccess();        da.StoreUserAT(UserName, PlaceId, WhatsH,            dLatitude, dLongitude);    }    protected void btnLocalCoupons_Click(object sender, EventArgs e)    {        double dLatitude = Convert.ToDouble(Latitude.Value);        double dLongitude = Convert.ToDouble(Longitude.Value);        DataAccess da = new DataAccess();     }    protected void lbBusiness_Click(object sender, EventArgs e)    {        string UserName = Membership.GetUser().UserName;        GridViewRow gvr = (GridViewRow)(((LinkButton)sender).Parent.Parent);        HiddenField hd = (HiddenField)gvr.FindControl("hdPlaceId");        string sPlaceId = hd.Value;        Int64 PlaceId;        if (!String.IsNullOrEmpty(sPlaceId))        {            PlaceId = Convert.ToInt64(sPlaceId);        }    }    protected void lbLocalDeals_Click(object sender, EventArgs e)    {        double dLatitude = Convert.ToDouble(Latitude.Value);        double dLongitude = Convert.ToDouble(Longitude.Value);        DataAccess da = new DataAccess();        pnlCoupons.Visible = true;        pnlStart.Visible = false;        List<GeoPromotion> lgp = da.NearByDeals(dLatitude, dLongitude);        lvCoupons.DataSource = lgp;        lvCoupons.DataBind();    }    protected void lbLocalPlaces_Click(object sender, EventArgs e)    {        DataAccess da = new DataAccess();        double Lat = Convert.ToDouble(Latitude.Value);        double Lon = Convert.ToDouble(Longitude.Value);        List<LocationDataModel.Place> places = da.NearByLocations(Lat, Lon);        lvPlaces.DataSource = places;        lvPlaces.SelectedIndex = -1;        lvPlaces.DataBind();        pnlPlaces.Visible = true;        pnlStart.Visible = false;    }    protected void ReturnFromPlaces_Click(object sender, EventArgs e)    {        pnlPlaces.Visible = false;        pnlStart.Visible = true;    }    protected void ReturnFromDeals_Click(object sender, EventArgs e)    {        pnlCoupons.Visible = false;        pnlStart.Visible = true;    }    protected void btnImHereNow_Click(object sender, EventArgs e)    {        long PlaceId = Convert.ToInt32(hdPlaceId.Value);        string UserName = Membership.GetUser().UserName;        string WhatsHappening = txtWhatsHappening.Text;        double UserLat = Convert.ToDouble(Latitude.Value);        double UserLon = Convert.ToDouble(Longitude.Value);        DataAccess da = new DataAccess();        da.StoreUserAT(UserName, PlaceId, WhatsHappening,             UserLat, UserLon);    }    protected void lbImHereNowReturn_Click(object sender, EventArgs e)    {        pnlImHereNow.Visible = false;        pnlPlaces.Visible = true;    }    protected void lbBackToBeginning_Click(object sender, EventArgs e)    {        pnlStart.Visible = true;        pnlImHereNow.Visible = false;    }    protected void lbWhereIveBeen_Click(object sender, EventArgs e)    {        string UserName = Membership.GetUser().UserName;        pnlStart.Visible = false;        pnlIveBeenHere.Visible = true;        DataAccess da = new DataAccess();        lvWhereIveBeen.DataSource = da.UserATs(UserName, 0, 15);        lvWhereIveBeen.DataBind();    }    protected void lbIveBeenHereBack_Click(object sender, EventArgs e)    {        pnlIveBeenHere.Visible = false;        pnlStart.Visible = true;    }     protected void lbPlaceIveBeen_Click(object sender, EventArgs e)    {        LinkButton lb = (LinkButton)sender;        ListViewItem lvi = (ListViewItem)lb.Parent.Parent;        HiddenField hdATID = (HiddenField)lvi.FindControl("hdATID");        Int64 ATID = Convert.ToInt64(hdATID.Value);        DataAccess da = new DataAccess();        pnlIveBeenHere.Visible = false;        pnlPlaceIveBeen.Visible = true;        var plac = da.GetPlaceViaATID(ATID);        hdPlaceIveBeenPlaceId.Value = plac.PlaceId.ToString();        hdPlaceIveBeenLatitude.Value = plac.Latitude.ToString();        hdPlaceIveBeenLongitude.Value = plac.Longitude.ToString();        lblPlaceIveBeenName.Text = plac.Name;        lblPlaceIveBeenAddress.Text = plac.Address1;        lblPlaceIveBeenCity.Text = plac.City;        lblPlaceIveBeenState.Text = plac.Province.ProvinceName;        lblPlaceIveBeenZipCode.Text = plac.ZipCode;        lblPlaceIveBeenCountry.Text = plac.Country.Name;    }     protected void lbNotListed_Click(object sender, EventArgs e)    {        SetupAddPoint();        pnlPlaces.Visible = false;    }     protected void lbAddAPlace_Click(object sender, EventArgs e)    {        SetupAddPoint();    }     private void SetupAddPoint()    {        double lat = Convert.ToDouble(Latitude.Value);        double lon = Convert.ToDouble(Longitude.Value);        DataAccess da = new DataAccess();        var zip = da.WhereAmIAt(lat, lon);        if (zip.Count > 0)        {            var z0 = zip[0];            txtCity.Text = z0.City;            txtZipCode.Text = z0.ZipCode;            ddlProvince.ClearSelection();            if (z0.ProvinceId.HasValue == true)            {                foreach (ListItem li in ddlProvince.Items)                {                    if (li.Value == z0.ProvinceId.Value.ToString())                    {                        li.Selected = true;                        break;                    }                }            }        }        pnlAddPlace.Visible = true;        pnlStart.Visible = false;    }    protected void lbAddPlaceReturn_Click(object sender, EventArgs e)    {        pnlAddPlace.Visible = false;        pnlStart.Visible = true;        liPlaceAddMessage.Visible = false;        PlaceAddMessage.Text = String.Empty;    }    protected void lbPlaceIveBeenBack_Click(object sender, EventArgs e)    {        pnlIveBeenHere.Visible = true;        pnlPlaceIveBeen.Visible = false;            }    protected void lbPlaceIveBeenBeginning_Click(object sender, EventArgs e)    {        pnlPlaceIveBeen.Visible = false;        pnlStart.Visible = true;    }    protected string DisplayName(object val)    {        string strVal = Convert.ToString(val);         if (AppleIPhone.IsIPad())        {            ipd = iPhoneDevice.iPad;        }        if (AppleIPhone.IsIPhone())        {            ipd = iPhoneDevice.iPhone;        }        if (AppleIPhone.IsIPodTouch())        {            ipd = iPhoneDevice.iPodTouch;        }        return (iPhoneHelper.DisplayContentOnMenu(strVal, ipd));    }} iPhoneHelper.cs file: using System;using System.Collections.Generic;using System.Linq;using System.Web; public enum iPhoneDevice{    iPhone, iPodTouch, iPad}/// <summary>/// Summary description for iPhoneHelper/// </summary>/// public class iPhoneHelper{ public iPhoneHelper() {  //  // TODO: Add constructor logic here  // } // This code is stupid in retrospect. Use css to solve this problem      public static string DisplayContentOnMenu(string val, iPhoneDevice ipd)    {        string Return = val;        string Elipsis = "...";        int iPadMaxLength = 30;        int iPhoneMaxLength = 15;        if (ipd == iPhoneDevice.iPad)        {            if (Return.Length > iPadMaxLength)            {                Return = Return.Substring(0, iPadMaxLength - Elipsis.Length) + Elipsis;            }        }        else        {            if (Return.Length > iPhoneMaxLength)            {                Return = Return.Substring(0, iPhoneMaxLength - Elipsis.Length) + Elipsis;            }        }        return (Return);    }}  Source code for the ViewStatePage: using System;using System.Data;using System.Data.SqlClient;using System.Configuration;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Web.UI.HtmlControls; /// <summary>/// Summary description for BasePage/// </summary>#region Base class for a page.public class ViewStatePage : System.Web.UI.Page{     PageStatePersisterToDatabase myPageStatePersister;        public ViewStatePage()        : base()    {        myPageStatePersister = new PageStatePersisterToDatabase(this);    }     protected override PageStatePersister PageStatePersister    {        get        {            return myPageStatePersister;        }    } }#endregion #region This class will override the page persistence to store page state in a database.public class PageStatePersisterToDatabase : PageStatePersister{    private string ViewStateKeyField = "__VIEWSTATE_KEY";    private string _exNoConnectionStringFound = "No Database Configuration information is in the web.config.";     public PageStatePersisterToDatabase(Page page)        : base(page)    {    }     public override void Load()    {         // Get the cache key from the web form data        System.Int64 key = Convert.ToInt64(Page.Request.Params[ViewStateKeyField]);         Pair state = this.LoadState(key);         // Abort if cache object is not of type Pair        if (state == null)            throw new ApplicationException("Missing valid " + ViewStateKeyField);         // Set view state and control state        ViewState = state.First;        ControlState = state.Second;    }     public override void Save()    {         // No processing needed if no states available        if (ViewState == null && ControlState != null)            return;         System.Int64 key;        IStateFormatter formatter = this.StateFormatter;        Pair statePair = new Pair(ViewState, ControlState);         // Serialize the statePair object to a string.        string serializedState = formatter.Serialize(statePair);         // Save the ViewState and get a unique identifier back.        key = SaveState(serializedState);         // Register hidden field to store cache key in        // Page.ClientScript does not work properly with Atlas.        //Page.ClientScript.RegisterHiddenField(ViewStateKeyField, key.ToString());        ScriptManager.RegisterHiddenField(this.Page, ViewStateKeyField, key.ToString());    }     private System.Int64 SaveState(string PageState)    {        System.Int64 i64Key = 0;        string strConn = String.Empty,            strProvider = String.Empty;         string strSql = "insert into tblPageState ( SerializedState ) values ( '" + SqlEscape(PageState) + "');select scope_identity();";        SqlConnection sqlCn;        SqlCommand sqlCm;        try        {            GetDBConnectionString(ref strConn, ref strProvider);            sqlCn = new SqlConnection(strConn);            sqlCm = new SqlCommand(strSql, sqlCn);            sqlCn.Open();            i64Key = Convert.ToInt64(sqlCm.ExecuteScalar());            if (sqlCn.State != ConnectionState.Closed)            {                sqlCn.Close();            }            sqlCn.Dispose();            sqlCm.Dispose();        }        finally        {            sqlCn = null;            sqlCm = null;        }        return i64Key;    }     private Pair LoadState(System.Int64 iKey)    {        string strConn = String.Empty,            strProvider = String.Empty,            SerializedState = String.Empty,            strMinutesInPast = GetMinutesInPastToDelete();        Pair PageState;        string strSql = "select SerializedState from tblPageState where tblPageStateID=" + iKey.ToString() + ";" +            "delete from tblPageState where DateUpdated<DateAdd(mi, " + strMinutesInPast + ", getdate());";        SqlConnection sqlCn;        SqlCommand sqlCm;        try        {            GetDBConnectionString(ref strConn, ref strProvider);            sqlCn = new SqlConnection(strConn);            sqlCm = new SqlCommand(strSql, sqlCn);             sqlCn.Open();            SerializedState = Convert.ToString(sqlCm.ExecuteScalar());            IStateFormatter formatter = this.StateFormatter;             if ((null == SerializedState) ||                (String.Empty == SerializedState))            {                throw (new ApplicationException("No ViewState records were returned."));            }             // Deserilize returns the Pair object that is serialized in            // the Save method.            PageState = (Pair)formatter.Deserialize(SerializedState);             if (sqlCn.State != ConnectionState.Closed)            {                sqlCn.Close();            }            sqlCn.Dispose();            sqlCm.Dispose();        }        finally        {            sqlCn = null;            sqlCm = null;        }        return PageState;    }     private string SqlEscape(string Val)    {        string ReturnVal = String.Empty;        if (null != Val)        {            ReturnVal = Val.Replace("'", "''");        }        return (ReturnVal);    }    private void GetDBConnectionString(ref string ConnectionStringValue, ref string ProviderNameValue)    {        if (System.Configuration.ConfigurationManager.ConnectionStrings.Count > 0)        {            ConnectionStringValue = System.Configuration.ConfigurationManager.ConnectionStrings["ApplicationServices"].ConnectionString;            ProviderNameValue = System.Configuration.ConfigurationManager.ConnectionStrings["ApplicationServices"].ProviderName;        }        else        {            throw new ConfigurationErrorsException(_exNoConnectionStringFound);        }    }    private string GetMinutesInPastToDelete()    {        string strReturn = "-60";        if (null != System.Configuration.ConfigurationManager.AppSettings["MinutesInPastToDeletePageState"])        {            strReturn = System.Configuration.ConfigurationManager.AppSettings["MinutesInPastToDeletePageState"].ToString();        }        return (strReturn);    }}#endregion AppleiPhone.cs file: using System;using System.Collections.Generic;using System.Linq;using System.Web; /// <summary>/// Summary description for AppleIPhone/// </summary>public class AppleIPhone{ public AppleIPhone() {  //  // TODO: Add constructor logic here  // }     static public bool IsIPhoneOS()    {        return (IsIPad() || IsIPhone() || IsIPodTouch());    }     static public bool IsIPhone()    {        return IsTest("iPhone");    }     static public bool IsIPodTouch()    {        return IsTest("iPod");    }     static public bool IsIPad()    {        return IsTest("iPad");    }     static private bool IsTest(string Agent)    {        bool bl = false;        string ua = HttpContext.Current.Request.UserAgent.ToLower();        try        {            bl = ua.Contains(Agent.ToLower());        }        catch { }        return (bl);        }} Master page .cs: using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.UI;using System.Web.UI.HtmlControls;using System.Web.UI.WebControls; public partial class MasterPages_iPhoneMaster : System.Web.UI.MasterPage{    protected void Page_Load(object sender, EventArgs e)    {            HtmlHead head = Page.Header;            HtmlMeta meta = new HtmlMeta();            if (AppleIPhone.IsIPad() == true)            {                meta.Content = "width=400,user-scalable=no";                head.Controls.Add(meta);             }            else            {                meta.Content = "width=device-width, user-scalable=no";                meta.Attributes.Add("name", "viewport");            }            meta.Attributes.Add("name", "viewport");            head.Controls.Add(meta);            HtmlLink cssLink = new HtmlLink();            HtmlGenericControl script = new HtmlGenericControl("script");            script.Attributes.Add("type", "text/javascript");            script.Attributes.Add("src", ResolveUrl("~/Scripts/iWebKit/javascript/functions.js"));            head.Controls.Add(script);            cssLink.Attributes.Add("rel", "stylesheet");            cssLink.Attributes.Add("href", ResolveUrl("~/Scripts/iWebKit/css/style.css") );            cssLink.Attributes.Add("type", "text/css");            head.Controls.Add(cssLink);            HtmlGenericControl jsLink = new HtmlGenericControl("script");            //jsLink.Attributes.Add("type", "text/javascript");            //jsLink.Attributes.Add("src", ResolveUrl("~/Scripts/jquery-1.4.1.min.js") );            //head.Controls.Add(jsLink);            HtmlLink appleIcon = new HtmlLink();            appleIcon.Attributes.Add("rel", "apple-touch-icon");            appleIcon.Attributes.Add("href", ResolveUrl("~/apple-touch-icon.png"));            HtmlMeta appleMobileWebAppStatusBarStyle = new HtmlMeta();            appleMobileWebAppStatusBarStyle.Attributes.Add("name", "apple-mobile-web-app-status-bar-style");            appleMobileWebAppStatusBarStyle.Attributes.Add("content", "black");            head.Controls.Add(appleMobileWebAppStatusBarStyle);    }     internal string FindPath(string Location)    {        string Url = Server.MapPath(Location);        return (Url);    }}

    Read the article

  • Diff between <head id="Head1" runat="server"> and <asp:ContentPlaceHolder runat="server" ID="HeadCon

    - by justSteve
    Looking for an better understanding of how an mvc project should define javascript and css includes. I'm working with sample code where includes are defined like: <head id="Head1" runat="server"> <title><asp:ContentPlaceHolder ID="TitleContent" runat="server" />Affiliate Checkout</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <meta http-equiv="pragma" content="no-cache"> <script type="text/javascript" src="/Scripts/jquery.js"></script> <script type="text/javascript" src="/Scripts/jquery-ui-1.7.2.custom.min.js"></script> . . . <asp:ContentPlaceHolder runat="server" ID="HeadContent"></asp:ContentPlaceHolder> </head> I'm reading that to be that _all pages looking at this MasterPage will get jquery and jqueryUI and, additionally, each page will have the opportunity to add head elements thankx to the content placeholder HeadContent tag. The specific problem i'm troubleshooting is an instance where my rendered page is not including the 'prama no-cache' tag - as you see, it's defined in the upper level header section. Other .js and .css elements are making it into the rendered page so it very confusing to see that the no-cache tag isn't. When execute a 'View Generated Source' - the 'charset' is present the 'no-cache' is not.

    Read the article

  • implementing runat in HtmlTextWriterAttribute

    - by user525116
    Hi dear friends, I have a custom asp.net control. public class Window : WebControl { protected override void RenderContents(HtmlTextWriter wr) { wr.AddAttribute("runat", "server",true); wr.AddAttribute("id", this.UniqueID, false); wr.RenderBeginTag(HtmlTextWriterTag.Div); wr.RenderEndTag(); wr.WriteLine(); base.RenderContents(wr); } } And this is my result after compile and use the control: <cc1:Window ID="Window1" runat="server" /> Use standard definition DIV with standard format: <div runat="server" id="aaaa"></div> After compile my web page to use this web custom control, this is render browser source of my web page: <span id="Window1"><div runat="server" id="Window1"></div></span> <div id="aaaa"></div>

    Read the article

  • ASP: runat=server for dynamic control

    - by Jan
    In the Page_Load method I create a couple of controls, based on various conditions. I would like to register server side code with those controls. However, for the last part I need to declare my controls as server controls. This is normally done by runat=server, but I don't know how to set this attribute in the C# code. myControl.Attributes.Add("runat", "server") does not do the trick. This one works, meaning that the "test" method is called when I click on it: <asp:LinkButton ID="LinkButton1" runat="server" OnClick="test">testtext</asp:LinkButton> This one does not work: LinkButton lb = new LinkButton(); lb.ID = "LinkButton1"; lb.OnClientClick = "test"; lb.Text = "testtext"; lb.Attributes.Add("runat", "server"); I can click on it, and the page is loaded, but the test-method is not called. Any hints?

    Read the article

  • Create Resume problem

    - by ar31an
    hello mates, i am working on a project of online resume management system and i am encountering an exception while creating resume. [b] Exception: Data type mismatch in criteria expression. [/b] here is my code for Create Resume-1.aspx.cs using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Data.OleDb; public partial class _Default : System.Web.UI.Page { string sql, sql2, sql3, sql4, sql5, sql6, sql7, sql8, sql9, sql10, sql11, sql12; string conString = "Provider=Microsoft.ACE.OLEDB.12.0; Data Source=D:\\Deliverable4.accdb"; protected OleDbConnection rMSConnection; protected OleDbCommand rMSCommand; protected OleDbDataAdapter rMSDataAdapter; protected DataSet dataSet; protected DataTable dataTable; protected DataRow dataRow; protected void Page_Load(object sender, EventArgs e) { } protected void Button1_Click(object sender, EventArgs e) { string contact1 = TextBox1.Text; string contact2 = TextBox2.Text; string cellphone = TextBox3.Text; string address = TextBox4.Text; string city = TextBox5.Text; string addqualification = TextBox18.Text; //string SecondLastDegreeGrade = TextBox17.Text; //string SecondLastDegreeInstitute = TextBox16.Text; //string SecondLastDegreeNameOther = TextBox15.Text; string LastDegreeNameOther = TextBox11.Text; string LastDegreeInstitute = TextBox12.Text; string LastDegreeGrade = TextBox13.Text; string tentativeFromDate = (DropDownList4.SelectedValue + " " + DropDownList7.SelectedValue + " " + DropDownList8.SelectedValue); try { sql6 = "select CountryID from COUNTRY"; rMSConnection = new OleDbConnection(conString); rMSDataAdapter = new OleDbDataAdapter(sql6, rMSConnection); dataSet = new DataSet("cID"); rMSDataAdapter.Fill(dataSet, "COUNTRY"); dataTable = dataSet.Tables["COUNTRY"]; int cId = (int)dataTable.Rows[0][0]; rMSConnection.Close(); sql4 = "select PersonalDetailID from PERSONALDETAIL"; rMSConnection = new OleDbConnection(conString); rMSDataAdapter = new OleDbDataAdapter(sql4, rMSConnection); dataSet = new DataSet("PDID"); rMSDataAdapter.Fill(dataSet, "PERSONALDETAIL"); dataTable = dataSet.Tables["PERSONALDETAIL"]; int PDId = (int)dataTable.Rows[0][0]; rMSConnection.Close(); sql5 = "update PERSONALDETAIL set Phone1 ='" + contact1 + "' , Phone2 = '" + contact2 + "', CellPhone = '" + cellphone + "', Address = '" + address + "', City = '" + city + "', CountryID = '" + cId + "' where PersonalDetailID = '" + PDId + "'"; rMSConnection = new OleDbConnection(conString); rMSConnection.Open(); rMSCommand = new OleDbCommand(sql5, rMSConnection); rMSCommand.ExecuteNonQuery(); rMSConnection.Close(); sql3 = "select DesignationID from DESIGNATION"; rMSConnection = new OleDbConnection(conString); rMSDataAdapter = new OleDbDataAdapter(sql3, rMSConnection); dataSet = new DataSet("DesID"); rMSDataAdapter.Fill(dataSet, "DESIGNATION"); dataTable = dataSet.Tables["DESIGNATION"]; int desId = (int)dataTable.Rows[0][0]; rMSConnection.Close(); sql2 = "select DepartmentID from DEPARTMENT"; rMSConnection = new OleDbConnection(conString); rMSDataAdapter = new OleDbDataAdapter(sql2, rMSConnection); dataSet = new DataSet("DID"); rMSDataAdapter.Fill(dataSet, "DEPARTMENT"); dataTable = dataSet.Tables["DEPARTMENT"]; int dId = (int)dataTable.Rows[0][0]; rMSConnection.Close(); sql7 = "select ResumeID from RESUME"; rMSConnection = new OleDbConnection(conString); rMSDataAdapter = new OleDbDataAdapter(sql7, rMSConnection); dataSet = new DataSet("rID"); rMSDataAdapter.Fill(dataSet, "RESUME"); dataTable = dataSet.Tables["RESUME"]; int rId = (int)dataTable.Rows[0][0]; rMSConnection.Close(); sql = "update RESUME set PersonalDetailID ='" + PDId + "' , DesignationID = '" + desId + "', DepartmentID = '" + dId + "', TentativeFromDate = '" + tentativeFromDate + "', AdditionalQualification = '" + addqualification + "' where ResumeID = '" + rId + "'"; rMSConnection = new OleDbConnection(conString); rMSConnection.Open(); rMSCommand = new OleDbCommand(sql, rMSConnection); rMSCommand.ExecuteNonQuery(); rMSConnection.Close(); sql8 = "insert into INSTITUTE (InstituteName) values ('" + LastDegreeInstitute + "')"; rMSConnection = new OleDbConnection(conString); rMSConnection.Open(); rMSCommand = new OleDbCommand(sql8, rMSConnection); rMSCommand.ExecuteNonQuery(); rMSConnection.Close(); sql9 = "insert into DEGREE (DegreeName) values ('" + LastDegreeNameOther + "')"; rMSConnection = new OleDbConnection(conString); rMSConnection.Open(); rMSCommand = new OleDbCommand(sql9, rMSConnection); rMSCommand.ExecuteNonQuery(); rMSConnection.Close(); sql11 = "select InstituteID from INSTITUTE"; rMSConnection = new OleDbConnection(conString); rMSDataAdapter = new OleDbDataAdapter(sql11, rMSConnection); dataSet = new DataSet("insID"); rMSDataAdapter.Fill(dataSet, "INSTITUTE"); dataTable = dataSet.Tables["INSTITUTE"]; int insId = (int)dataTable.Rows[0][0]; rMSConnection.Close(); sql12 = "select DegreeID from DEGREE"; rMSConnection = new OleDbConnection(conString); rMSDataAdapter = new OleDbDataAdapter(sql12, rMSConnection); dataSet = new DataSet("degID"); rMSDataAdapter.Fill(dataSet, "DEGREE"); dataTable = dataSet.Tables["DEGREE"]; int degId = (int)dataTable.Rows[0][0]; rMSConnection.Close(); sql10 = "insert into QUALIFICATION (Grade, ResumeID, InstituteID, DegreeID) values ('" + LastDegreeGrade + "', '" + rId + "', '" + insId + "', '" + degId + "')"; rMSConnection = new OleDbConnection(conString); rMSConnection.Open(); rMSCommand = new OleDbCommand(sql10, rMSConnection); rMSCommand.ExecuteNonQuery(); rMSConnection.Close(); Response.Redirect("Applicant.aspx"); } catch (Exception exp) { rMSConnection.Close(); Label1.Text = "Exception: " + exp.Message; } } protected void Button2_Click(object sender, EventArgs e) { } } And for Create Resume-1.aspx <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Create Resume-1.aspx.cs" Inherits="_Default" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Untitled Page</title> </head> <body> <form id="form1" runat="server"> <div><center> <strong><span style="font-size: 16pt"></span></strong>&nbsp;</center> <center> &nbsp;</center> <center style="background-color: silver"> &nbsp;</center> <center> <strong><span style="font-size: 16pt">Step 1</span></strong></center> <center style="background-color: silver"> &nbsp;</center> <center> &nbsp;</center> <center> &nbsp;</center> <center> <asp:Label ID="PhoneNo1" runat="server" Text="Contact No 1*"></asp:Label> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="Items marked with '*' cannot be left blank." ControlToValidate="TextBox1"></asp:RequiredFieldValidator><br /> <asp:Label ID="PhoneNo2" runat="server" Text="Contact No 2"></asp:Label> <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox><br /> <asp:Label ID="CellNo" runat="server" Text="Cell Phone No"></asp:Label> <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox><br /> <asp:Label ID="Address" runat="server" Text="Street Address*"></asp:Label> <asp:TextBox ID="TextBox4" runat="server"></asp:TextBox> <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="Items marked with '*' cannot be left blank." ControlToValidate="TextBox4"></asp:RequiredFieldValidator><br /> <asp:Label ID="City" runat="server" Text="City*"></asp:Label> <asp:TextBox ID="TextBox5" runat="server"></asp:TextBox> <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ErrorMessage="Items marked with '*' cannot be left blank." ControlToValidate="TextBox5"></asp:RequiredFieldValidator><br /> <asp:Label ID="Country" runat="server" Text="Country of Origin*"></asp:Label> <asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="SqlDataSource1" DataTextField="CountryName" DataValueField="CountryID"> </asp:DropDownList><asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString7 %>" DeleteCommand="DELETE FROM [COUNTRY] WHERE (([CountryID] = ?) OR ([CountryID] IS NULL AND ? IS NULL))" InsertCommand="INSERT INTO [COUNTRY] ([CountryID], [CountryName]) VALUES (?, ?)" ProviderName="<%$ ConnectionStrings:ConnectionString7.ProviderName %>" SelectCommand="SELECT * FROM [COUNTRY]" UpdateCommand="UPDATE [COUNTRY] SET [CountryName] = ? WHERE (([CountryID] = ?) OR ([CountryID] IS NULL AND ? IS NULL))"> <DeleteParameters> <asp:Parameter Name="CountryID" Type="Int32" /> </DeleteParameters> <UpdateParameters> <asp:Parameter Name="CountryName" Type="String" /> <asp:Parameter Name="CountryID" Type="Int32" /> </UpdateParameters> <InsertParameters> <asp:Parameter Name="CountryID" Type="Int32" /> <asp:Parameter Name="CountryName" Type="String" /> </InsertParameters> </asp:SqlDataSource> <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ErrorMessage="Items marked with '*' cannot be left blank." ControlToValidate="DropDownList1"></asp:RequiredFieldValidator><br /> <asp:Label ID="DepartmentOfInterest" runat="server" Text="Department of Interest*"></asp:Label> <asp:DropDownList ID="DropDownList2" runat="server" DataSourceID="SqlDataSource2" DataTextField="DepartmentName" DataValueField="DepartmentID"> </asp:DropDownList><asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString7 %>" DeleteCommand="DELETE FROM [DEPARTMENT] WHERE [DepartmentID] = ?" InsertCommand="INSERT INTO [DEPARTMENT] ([DepartmentID], [DepartmentName]) VALUES (?, ?)" ProviderName="<%$ ConnectionStrings:ConnectionString7.ProviderName %>" SelectCommand="SELECT * FROM [DEPARTMENT]" UpdateCommand="UPDATE [DEPARTMENT] SET [DepartmentName] = ? WHERE [DepartmentID] = ?"> <DeleteParameters> <asp:Parameter Name="DepartmentID" Type="Int32" /> </DeleteParameters> <UpdateParameters> <asp:Parameter Name="DepartmentName" Type="String" /> <asp:Parameter Name="DepartmentID" Type="Int32" /> </UpdateParameters> <InsertParameters> <asp:Parameter Name="DepartmentID" Type="Int32" /> <asp:Parameter Name="DepartmentName" Type="String" /> </InsertParameters> </asp:SqlDataSource> <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ErrorMessage="Items marked with '*' cannot be left blank." ControlToValidate="DropDownList2"></asp:RequiredFieldValidator><br /> <asp:Label ID="DesignationAppliedFor" runat="server" Text="Position Applied For*"></asp:Label> <asp:DropDownList ID="DropDownList3" runat="server" DataSourceID="SqlDataSource3" DataTextField="DesignationName" DataValueField="DesignationID"> </asp:DropDownList><asp:SqlDataSource ID="SqlDataSource3" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString7 %>" DeleteCommand="DELETE FROM [DESIGNATION] WHERE [DesignationID] = ?" InsertCommand="INSERT INTO [DESIGNATION] ([DesignationID], [DesignationName], [DesignationStatus]) VALUES (?, ?, ?)" ProviderName="<%$ ConnectionStrings:ConnectionString7.ProviderName %>" SelectCommand="SELECT * FROM [DESIGNATION]" UpdateCommand="UPDATE [DESIGNATION] SET [DesignationName] = ?, [DesignationStatus] = ? WHERE [DesignationID] = ?"> <DeleteParameters> <asp:Parameter Name="DesignationID" Type="Int32" /> </DeleteParameters> <UpdateParameters> <asp:Parameter Name="DesignationName" Type="String" /> <asp:Parameter Name="DesignationStatus" Type="String" /> <asp:Parameter Name="DesignationID" Type="Int32" /> </UpdateParameters> <InsertParameters> <asp:Parameter Name="DesignationID" Type="Int32" /> <asp:Parameter Name="DesignationName" Type="String" /> <asp:Parameter Name="DesignationStatus" Type="String" /> </InsertParameters> </asp:SqlDataSource> <asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" ErrorMessage="Items marked with '*' cannot be left blank." ControlToValidate="DropDownList3"></asp:RequiredFieldValidator><br /> <asp:Label ID="TentativeFromDate" runat="server" Text="Can Join From*"></asp:Label> <asp:DropDownList ID="DropDownList4" runat="server"> <asp:ListItem>1</asp:ListItem> <asp:ListItem>2</asp:ListItem> <asp:ListItem>3</asp:ListItem> <asp:ListItem>4</asp:ListItem> <asp:ListItem>5</asp:ListItem> <asp:ListItem>6</asp:ListItem> <asp:ListItem>7</asp:ListItem> <asp:ListItem>8</asp:ListItem> <asp:ListItem>9</asp:ListItem> <asp:ListItem>10</asp:ListItem> <asp:ListItem>11</asp:ListItem> <asp:ListItem>12</asp:ListItem> </asp:DropDownList>&nbsp;<asp:DropDownList ID="DropDownList7" runat="server"> <asp:ListItem>1</asp:ListItem> <asp:ListItem>2</asp:ListItem> <asp:ListItem>3</asp:ListItem> <asp:ListItem>4</asp:ListItem> <asp:ListItem>5</asp:ListItem> <asp:ListItem>6</asp:ListItem> <asp:ListItem>7</asp:ListItem> <asp:ListItem>8</asp:ListItem> <asp:ListItem>9</asp:ListItem> <asp:ListItem>10</asp:ListItem> <asp:ListItem>11</asp:ListItem> <asp:ListItem>12</asp:ListItem> <asp:ListItem>13</asp:ListItem> <asp:ListItem>14</asp:ListItem> <asp:ListItem>15</asp:ListItem> <asp:ListItem>16</asp:ListItem> <asp:ListItem>17</asp:ListItem> <asp:ListItem>18</asp:ListItem> <asp:ListItem>19</asp:ListItem> <asp:ListItem>20</asp:ListItem> <asp:ListItem>21</asp:ListItem> <asp:ListItem>22</asp:ListItem> <asp:ListItem>23</asp:ListItem> <asp:ListItem>24</asp:ListItem> <asp:ListItem>25</asp:ListItem> <asp:ListItem>26</asp:ListItem> <asp:ListItem>27</asp:ListItem> <asp:ListItem>28</asp:ListItem> <asp:ListItem>29</asp:ListItem> <asp:ListItem>30</asp:ListItem> <asp:ListItem>31</asp:ListItem> </asp:DropDownList> <asp:DropDownList ID="DropDownList8" runat="server"> <asp:ListItem>2010</asp:ListItem> </asp:DropDownList> <asp:RequiredFieldValidator ID="RequiredFieldValidator7" runat="server" ErrorMessage="Items marked with '*' cannot be left blank." ControlToValidate="DropDownList4"></asp:RequiredFieldValidator></center> <center> <br /> <asp:Label ID="LastDegreeName" runat="server" Text="Last Degree*"></asp:Label> <asp:DropDownList ID="DropDownList5" runat="server" DataSourceID="SqlDataSource5" DataTextField="DegreeName" DataValueField="DegreeID"> </asp:DropDownList><asp:SqlDataSource ID="SqlDataSource5" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString7 %>" DeleteCommand="DELETE FROM [DEGREE] WHERE [DegreeID] = ?" InsertCommand="INSERT INTO [DEGREE] ([DegreeID], [DegreeName]) VALUES (?, ?)" ProviderName="<%$ ConnectionStrings:ConnectionString7.ProviderName %>" SelectCommand="SELECT * FROM [DEGREE]" UpdateCommand="UPDATE [DEGREE] SET [DegreeName] = ? WHERE [DegreeID] = ?"> <DeleteParameters> <asp:Parameter Name="DegreeID" Type="Int32" /> </DeleteParameters> <UpdateParameters> <asp:Parameter Name="DegreeName" Type="String" /> <asp:Parameter Name="DegreeID" Type="Int32" /> </UpdateParameters> <InsertParameters> <asp:Parameter Name="DegreeID" Type="Int32" /> <asp:Parameter Name="DegreeName" Type="String" /> </InsertParameters> </asp:SqlDataSource> <asp:RequiredFieldValidator ID="RequiredFieldValidator8" runat="server" ErrorMessage="Items marked with '*' cannot be left blank." ControlToValidate="DropDownList5"></asp:RequiredFieldValidator><br /> <asp:Label ID="LastDegreeNameOther" runat="server" Text="Other"></asp:Label> <asp:TextBox ID="TextBox11" runat="server"></asp:TextBox><br /> <asp:Label ID="LastDegreeInstitute" runat="server" Text="Institute Name*"></asp:Label> <asp:TextBox ID="TextBox12" runat="server"></asp:TextBox> <asp:RequiredFieldValidator ID="RequiredFieldValidator9" runat="server" ErrorMessage="Items marked with '*' cannot be left blank." ControlToValidate="TextBox12"></asp:RequiredFieldValidator><br /> <asp:Label ID="LastDegreeGrade" runat="server" Text="Marks / Grade*"></asp:Label> <asp:TextBox ID="TextBox13" runat="server"></asp:TextBox> <asp:RequiredFieldValidator ID="RequiredFieldValidator10" runat="server" ErrorMessage="Items marked with '*' cannot be left blank." ControlToValidate="TextBox13"></asp:RequiredFieldValidator></center> <center> &nbsp;</center> <center> <br /> <asp:Label ID="SecondLastDegreeName" runat="server" Text="Second Last Degree*"></asp:Label> <asp:DropDownList ID="DropDownList6" runat="server" DataSourceID="SqlDataSource4" DataTextField="DegreeName" DataValueField="DegreeID"> </asp:DropDownList><asp:SqlDataSource ID="SqlDataSource4" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString7 %>" DeleteCommand="DELETE FROM [DEGREE] WHERE [DegreeID] = ?" InsertCommand="INSERT INTO [DEGREE] ([DegreeID], [DegreeName]) VALUES (?, ?)" ProviderName="<%$ ConnectionStrings:ConnectionString7.ProviderName %>" SelectCommand="SELECT * FROM [DEGREE]" UpdateCommand="UPDATE [DEGREE] SET [DegreeName] = ? WHERE [DegreeID] = ?"> <DeleteParameters> <asp:Parameter Name="DegreeID" Type="Int32" /> </DeleteParameters> <UpdateParameters> <asp:Parameter Name="DegreeName" Type="String" /> <asp:Parameter Name="DegreeID" Type="Int32" /> </UpdateParameters> <InsertParameters> <asp:Parameter Name="DegreeID" Type="Int32" /> <asp:Parameter Name="DegreeName" Type="String" /> </InsertParameters> </asp:SqlDataSource> <asp:RequiredFieldValidator ID="RequiredFieldValidator11" runat="server" ErrorMessage="Items marked with '*' cannot be left blank." ControlToValidate="DropDownList6"></asp:RequiredFieldValidator><br /> <asp:Label ID="SecondLastDegreeNameOther" runat="server" Text="Other"></asp:Label> <asp:TextBox ID="TextBox15" runat="server"></asp:TextBox><br /> <asp:Label ID="SecondLastDegreeInstitute" runat="server" Text="Institute Name*"></asp:Label> <asp:TextBox ID="TextBox16" runat="server"></asp:TextBox> <asp:RequiredFieldValidator ID="RequiredFieldValidator12" runat="server" ErrorMessage="Items marked with '*' cannot be left blank." ControlToValidate="TextBox16"></asp:RequiredFieldValidator><br /> <asp:Label ID="SecondLastDegreeGrade" runat="server" Text="Marks / Grade*"></asp:Label> <asp:TextBox ID="TextBox17" runat="server"></asp:TextBox> <asp:RequiredFieldValidator ID="RequiredFieldValidator13" runat="server" ErrorMessage="Items marked with '*' cannot be left blank." ControlToValidate="TextBox17"></asp:RequiredFieldValidator></center> <center> <br /> <asp:Label ID="AdditionalQualification" runat="server" Text="Additional Qualification"></asp:Label> <asp:TextBox ID="TextBox18" runat="server" TextMode="MultiLine"></asp:TextBox></center> <center> &nbsp;</center> <center> <asp:Button ID="Button1" runat="server" Text="Save and Exit" OnClick="Button1_Click" /> &nbsp;&nbsp; <asp:Button ID="Button2" runat="server" Text="Next" OnClick="Button2_Click" /></center> <center> &nbsp;</center> <center> <asp:Label ID="Label1" runat="server"></asp:Label>&nbsp;</center> <center> &nbsp;</center> <center style="background-color: silver"> &nbsp;</center> </div> </form> </body> </html>

    Read the article

  • Error Message, "The Controls collection cannot be modified because the control contains code blocks"

    - by Gogster
    I'm receiving this error on a page that previously worked fine, in fact the only change I've made to the page recently was to add another asp:TextBox and asp:RequiredFieldValidator control. The page already had numerous ASP.NET controls on it, so I cannot see why these extra controls would make a difference, anyway I shall post the code below and hopefully you can see what the error is: <%@ Control Language="C#" AutoEventWireup="true" CodeFile="MeetingGenerator.ascx.cs" Inherits="usercontrols_MeetingGenerator" %> <%@ Register TagPrefix="cc1" Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" %> <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager> <div style="width:498px;height:425px;background-color:#033b2a;text-align:center;padding-top:20px;"> <asp:Label ID="lblDone" CssClass="done" runat="server"></asp:Label> <asp:Panel id="pnlAddReport" runat="server"> <div> <img src="../images/banners/add-meeting.png" alt="Add Report" /> </div> <p> <asp:ValidationSummary ID="ValidationSummary" CssClass="validationsummary" runat="server" /> <asp:TextBox ID="txtTitle" BorderStyle="None" CssClass="watermark" Width="250px" Height="22px" runat="server"></asp:TextBox> <cc1:TextBoxWatermarkExtender ID="TextBoxWatermarkExtender1" TargetControlID="txtTitle" WatermarkCssClass="watermark" WatermarkText=" Meeting title" runat="server"></cc1:TextBoxWatermarkExtender> <asp:RequiredFieldValidator ID="rfvTitle" ControlToValidate="txtTitle" Text="" ErrorMessage="Please enter the title" Display="None" InitialValue="" runat="server"></asp:RequiredFieldValidator> <asp:RequiredFieldValidator ID="rfvTitle1" ControlToValidate="txtTitle" Text="" ErrorMessage="Please enter the title" Display="None" InitialValue=" Meeting title" runat="server"></asp:RequiredFieldValidator> </p> <p> <asp:TextBox ID="txtDate" BorderStyle="None" CssClass="watermark" Width="250px" Height="22px" runat="server"></asp:TextBox> <cc1:CalendarExtender ID="ceDate" TargetControlID="txtDate" Format="dd/MM/yyyy" runat="server"> </cc1:CalendarExtender> <cc1:TextBoxWatermarkExtender ID="TextBoxWatermarkExtender2" TargetControlID="txtDate" WatermarkCssClass="watermark" WatermarkText=" Meeting Date" runat="server"></cc1:TextBoxWatermarkExtender> <asp:RequiredFieldValidator ID="rfvDate" ControlToValidate="txtDate" Text="" ErrorMessage="Please select the meeting date" Display="None" InitialValue="" runat="server"></asp:RequiredFieldValidator> <asp:RequiredFieldValidator ID="rfvDate1" ControlToValidate="txtDate" Text="" ErrorMessage="Please select the meeting date" Display="None" InitialValue=" Meeting Date" runat="server"></asp:RequiredFieldValidator> </p> <p> <asp:TextBox ID="txtMeetingTime" BorderStyle="None" Width="250px" Height="22px" MaxLength="5" runat="server"></asp:TextBox> <cc1:TextBoxWatermarkExtender ID="tweMeetingTime" TargetControlID="txtMeetingTime" WatermarkCssClass="watermark" WatermarkText=" Time (HH:MM)" runat="server"></cc1:TextBoxWatermarkExtender> <asp:RequiredFieldValidator ID="RequiredFieldValidator1" ControlToValidate="txtMeetingTime" Text="" ErrorMessage="Please enter the meeting time" Display="None" InitialValue="" runat="server"></asp:RequiredFieldValidator> <asp:RequiredFieldValidator ID="RequiredFieldValidator11" ControlToValidate="txtMeetingTime" Text="" ErrorMessage="Please enter the meeting time" Display="None" InitialValue=" Time (HH:MM)" runat="server"></asp:RequiredFieldValidator> </p> <p> <asp:TextBox ID="txtLocation" BorderStyle="None" CssClass="watermark" Width="250px" Height="22px" runat="server"></asp:TextBox> <cc1:TextBoxWatermarkExtender ID="TextBoxWatermarkExtender3" TargetControlID="txtLocation" WatermarkCssClass="watermark" WatermarkText=" Location" runat="server"></cc1:TextBoxWatermarkExtender> <asp:RequiredFieldValidator ID="rfvLocation" ControlToValidate="txtLocation" Text="" ErrorMessage="Please enter the location" Display="None" InitialValue="" runat="server"></asp:RequiredFieldValidator> <asp:RequiredFieldValidator ID="rfvLocation1" ControlToValidate="txtLocation" Text="" ErrorMessage="Please enter the location" Display="None" InitialValue=" Location" runat="server"></asp:RequiredFieldValidator> </p> <p> <asp:ImageButton ID="btnAddMeeting" ImageUrl="/images/buttons/addmeeting-btn.gif" runat="server" OnClick="btnAddMeeting_Click" /> </p> <p> </p> </asp:Panel> </div> <%@ Master Language="C#" MasterPageFile="/masterpages/Master.master" AutoEventWireup="true" %> <asp:content ContentPlaceHolderId="additionalhead" runat="server"> </asp:content> <asp:content ContentPlaceHolderId="additionalbody" runat="server"> <umbraco:Macro Alias="AddMeeting" runat="server"></umbraco:Macro> </asp:content> <asp:content ContentPlaceHolderId="bodyContent" runat="server"> </asp:content> <%@ Master Language="C#" AutoEventWireup="true" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title><umbraco:Item field="title" runat="server"></umbraco:Item></title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js"></script> <script type="text/javascript" src="/js/jQueryString-2.0.2-Min.js"></script> <link rel="stylesheet" type="text/css" href="/css/Styles.css" /> <link rel="stylesheet" type="text/css" href="/css/Layout.css" /> <link rel="stylesheet" type="text/css" href="/css/Forms.css" /> <script type="text/javascript" language="javascript"> $(document).ready(function () { $('#uploadAgenda').hide(); $('#uploadMinutes').hide(); $('#<%=txtSearchEAA.ClientID%>').val('Search EAA'); var st = $.getQueryString({ ID:"search" }); if (st != '') { $('#<%=txtSearchEAA.ClientID%>').val(st); }; $('#<%=txtSearchEAA.ClientID%>').click(function() { $('#<%=txtSearchEAA.ClientID%>').val(''); }); }); </script> <script type="text/C#" runat="server"> protected void btnSearch_Click(object sender, EventArgs e) { Response.Redirect("/members/search-results?search=" + txtSearchEAA.Text); } </script> <asp:ContentPlaceHolder id="additionalhead" runat="server"></asp:ContentPlaceHolder> <umbraco:Item field="AdditionalHead" runat="server"></umbraco:Item> </head> <body style="background-color:#e5e5e5;"> <script runat="server"> protected void btnLogout_Click(object sender, EventArgs e) { FormsAuthentication.SignOut(); Response.Redirect("/login"); } </script> <form id="form1" runat="server"> <asp:ContentPlaceHolder id="additionalbody" runat="server"></asp:ContentPlaceHolder> <div class="wrapper"> <div class="content"> <div class="banner"> <div class="bannerSearchSpacer"> <a href="/home"><h1><span>EAA</span></h1></a> </div> <div class="aboutEAA"> &nbsp; </div> <div class="bannerSearchAligns"> <div class="searchbox"> <asp:TextBox ID="txtSearchEAA" CssClass="watermark" Width="155px" runat="server"></asp:TextBox> </div> <div class="searchButton"> <asp:ImageButton ID="imbSearch" ImageUrl="/images/buttons/go.gif" OnClick="btnSearch_Click" runat="server" /> </div> <div style="clear:both;"></div> </div> <div class="loginBox"> <dl> <dt>Hello</dt> <dd><umbraco:Macro Alias="MemberName" runat="server"></umbraco:Macro></dd> <dt>Arena</dt> <dd><umbraco:Macro Alias="MemberArena" runat="server"></umbraco:Macro></dd> </dl> <div><asp:ImageButton ID="btnLogout" ImageUrl="/images/buttons/logout.gif" runat="server" OnClick="btnLogout_Click" /></div> </div> <div style="clear:both;"></div> </div> <div id="contentarea"> <div class="menuLeft"> <div class="menuPlaceholder"> <umbraco:Macro Alias="DynamicMenu" runat="server"></umbraco:Macro> </div> </div> <div class="mainBody"> <asp:ContentPlaceHolder id="bodyContent" runat="server"></asp:ContentPlaceHolder> </div> <div style="clear:both;"></div> </div> </div> </div> </form> <umbraco:Macro Alias="MemberAnalytics" runat="server"></umbraco:Macro> </body> </html>

    Read the article

  • How to implement EntityDataSource Where IN entity sql clause

    - by TonyS
    I want to pass a number of values into a parameter of the EntityDataSource, e.g.: Where="it.ORDER_ID IN {@OrderIdList}" (this is a property on the EntityDataSource) <WhereParameters> <asp:ControlParameter Name="OrderIdList" Type="Int16" ControlID="OrderFilterControl" PropertyName="OrderIdList" /> </WhereParameters> This doesn't work as ORDER_ID is of type int32 and I need to pass in multiple values, e.g. {1,2,3} etc The next thing I tried was setting the Where clause in code-behind and this all works except I can't get data binding on DropDownLists to work. By this I mean no value is returned from the bound dropdownlists in the EntityDataSource Updating Event. My ideal solution would be to use a WhereParameter on the EntityDataSource but any help is appreciated. Thanks, Tony. A complete code example follows using the AdventureWorks db: Public Class EntityDataSourceWhereInClause Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load CustomersEntityDataSource.Where = WhereClause ''# reset after each postback as its lost otherwise End Sub Private Sub cmdFilterCustomers_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdFilterCustomers.Click Dim CustomerIdList As New Generic.List(Of Int32) For Each item As ListItem In CustomerIdCheckBoxList.Items If item.Selected Then CustomerIdList.Add(item.Value) End If Next Dim CustomerCsvList As String = String.Join(", ", CustomerIdList.Select(Function(o) o.ToString()).ToArray()) WhereClause = "it.CustomerID IN {" & CustomerCsvList & "}" CustomersEntityDataSource.Where = WhereClause FormView1.PageIndex = 0 End Sub ''# save between postbacks the custom Where IN clause Public Property WhereClause() As String Get Return ViewState("WhereClause") End Get Set(ByVal value As String) ViewState.Add("WhereClause", value) End Set End Property Private Sub CustomersEntityDataSource_Updating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.EntityDataSourceChangingEventArgs) Handles CustomersEntityDataSource.Updating Dim c = CType(e.Entity, EntityFrameworkTest.Customer) If c.Title.Length = 0 Then Response.Write("Title is empty string, so will save like this!") End If End Sub End Class <%@ Page Language="vb" AutoEventWireup="false" CodeBehind="EntityDataSourceWhereInClause.aspx.vb" Inherits="EntityFrameworkTest.EntityDataSourceWhereInClause" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <%''# filter control %> <div> <asp:EntityDataSource ID="CustomerIdListEntityDataSource" runat="server" ConnectionString="name=AdventureWorksLT2008Entities" DefaultContainerName="AdventureWorksLT2008Entities" EnableFlattening="False" EntitySetName="Customers" Select="it.[CustomerID]" OrderBy="it.[CustomerID]"> </asp:EntityDataSource> <asp:CheckBoxList ID="CustomerIdCheckBoxList" runat="server" DataSourceID="CustomerIdListEntityDataSource" DataTextField="CustomerID" DataValueField="CustomerID" RepeatDirection="Horizontal"> </asp:CheckBoxList> <asp:Button ID="cmdFilterCustomers" runat="server" Text="Apply Filter" /> </div> <% ''# you get this error passing in CSV in the where clause ''# The element type 'Edm.Int32' and the CollectionType 'Transient.collection[Edm.String(Nullable=True,DefaultValue=,MaxLength=,Unicode=,FixedLength=)]' are not compatible. The IN expression only supports entity, primitive, and reference types. Near WHERE predicate, line 6, column 15. ''# so have coded it manually in code-behind Where="it.CustomerID IN {@OrderIdList}" %> <asp:EntityDataSource ID="CustomersEntityDataSource" runat="server" ConnectionString="name=AdventureWorksLT2008Entities" DefaultContainerName="AdventureWorksLT2008Entities" EnableFlattening="False" EnableUpdate="True" EntitySetName="Customers" AutoGenerateOrderByClause="false"> </asp:EntityDataSource> <%''# updating works with DropDownLists until the Where clause is set in code %> <asp:FormView ID="FormView1" runat="server" AllowPaging="True" CellPadding="4" DataKeyNames="CustomerID" DataSourceID="CustomersEntityDataSource" ForeColor="#333333"> <EditItemTemplate> CustomerID: <asp:Label ID="CustomerIDLabel1" runat="server" Text='<%# Eval("CustomerID") %>' /> <br /> NameStyle: <asp:CheckBox ID="NameStyleCheckBox" runat="server" Checked='<%# Bind("NameStyle") %>' /> <br /> Title: <%''# the SelectedValue is not Bound to the EF object if the Where clause is updated in code-behind %> <asp:DropDownList ID="ddlTitleBound" runat="server" DataSourceID="TitleEntityDataSource" DataTextField="Title" DataValueField="Title" AutoPostBack="false" AppendDataBoundItems="true" SelectedValue='<%# Bind("Title") %>'> </asp:DropDownList> <asp:EntityDataSource ID="TitleEntityDataSource" runat="server" ConnectionString="name=AdventureWorksLT2008Entities" DefaultContainerName="AdventureWorksLT2008Entities" EnableFlattening="False" EntitySetName="Customers" Select="it.[Title]" GroupBy="it.[Title]" ViewStateMode="Enabled"> </asp:EntityDataSource> <br /> FirstName: <asp:TextBox ID="FirstNameTextBox" runat="server" Text='<%# Bind("FirstName") %>' /> <br /> MiddleName: <asp:TextBox ID="MiddleNameTextBox" runat="server" Text='<%# Bind("MiddleName") %>' /> <br /> LastName: <asp:TextBox ID="LastNameTextBox" runat="server" Text='<%# Bind("LastName") %>' /> <br /> Suffix: <asp:TextBox ID="SuffixTextBox" runat="server" Text='<%# Bind("Suffix") %>' /> <br /> CompanyName: <asp:TextBox ID="CompanyNameTextBox" runat="server" Text='<%# Bind("CompanyName") %>' /> <br /> SalesPerson: <asp:TextBox ID="SalesPersonTextBox" runat="server" Text='<%# Bind("SalesPerson") %>' /> <br /> EmailAddress: <asp:TextBox ID="EmailAddressTextBox" runat="server" Text='<%# Bind("EmailAddress") %>' /> <br /> Phone: <asp:TextBox ID="PhoneTextBox" runat="server" Text='<%# Bind("Phone") %>' /> <br /> PasswordHash: <asp:TextBox ID="PasswordHashTextBox" runat="server" Text='<%# Bind("PasswordHash") %>' /> <br /> PasswordSalt: <asp:TextBox ID="PasswordSaltTextBox" runat="server" Text='<%# Bind("PasswordSalt") %>' /> <br /> rowguid: <asp:TextBox ID="rowguidTextBox" runat="server" Text='<%# Bind("rowguid") %>' /> <br /> ModifiedDate: <asp:TextBox ID="ModifiedDateTextBox" runat="server" Text='<%# Bind("ModifiedDate") %>' /> <br /> <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" CommandName="Update" Text="Update" /> &nbsp;<asp:LinkButton ID="UpdateCancelButton" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel" /> </EditItemTemplate> <EditRowStyle BackColor="#999999" /> <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /> <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /> <ItemTemplate> CustomerID: <asp:Label ID="CustomerIDLabel" runat="server" Text='<%# Eval("CustomerID") %>' /> <br /> NameStyle: <asp:CheckBox ID="NameStyleCheckBox" runat="server" Checked='<%# Bind("NameStyle") %>' Enabled="false" /> <br /> Title: <asp:Label ID="TitleLabel" runat="server" Text='<%# Bind("Title") %>' /> <br /> FirstName: <asp:Label ID="FirstNameLabel" runat="server" Text='<%# Bind("FirstName") %>' /> <br /> MiddleName: <asp:Label ID="MiddleNameLabel" runat="server" Text='<%# Bind("MiddleName") %>' /> <br /> LastName: <asp:Label ID="LastNameLabel" runat="server" Text='<%# Bind("LastName") %>' /> <br /> Suffix: <asp:Label ID="SuffixLabel" runat="server" Text='<%# Bind("Suffix") %>' /> <br /> CompanyName: <asp:Label ID="CompanyNameLabel" runat="server" Text='<%# Bind("CompanyName") %>' /> <br /> SalesPerson: <asp:Label ID="SalesPersonLabel" runat="server" Text='<%# Bind("SalesPerson") %>' /> <br /> EmailAddress: <asp:Label ID="EmailAddressLabel" runat="server" Text='<%# Bind("EmailAddress") %>' /> <br /> Phone: <asp:Label ID="PhoneLabel" runat="server" Text='<%# Bind("Phone") %>' /> <br /> PasswordHash: <asp:Label ID="PasswordHashLabel" runat="server" Text='<%# Bind("PasswordHash") %>' /> <br /> PasswordSalt: <asp:Label ID="PasswordSaltLabel" runat="server" Text='<%# Bind("PasswordSalt") %>' /> <br /> rowguid: <asp:Label ID="rowguidLabel" runat="server" Text='<%# Bind("rowguid") %>' /> <br /> ModifiedDate: <asp:Label ID="ModifiedDateLabel" runat="server" Text='<%# Bind("ModifiedDate") %>' /> <br /> <asp:LinkButton ID="EditButton" runat="server" CausesValidation="False" CommandName="Edit" Text="Edit" /> </ItemTemplate> <PagerSettings Position="Top" /> <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" /> <RowStyle BackColor="#F7F6F3" ForeColor="#333333" /> </asp:FormView> </form>

    Read the article

  • A problem with the asp.net create user control

    - by Sir Psycho
    Hi, I've customised the asp.net login control and it seems to create new accounts fine, but if I duplicate the user id thats already registered or enter an email thats already used, the error messages arn't displaying. Its driving me crazy. The page just refreshes without showing an error. I've included the as instructed on the MSDN site but nothing. http://msdn.microsoft.com/en-us/library/ms178342.aspx <asp:CreateUserWizard ErrorMessageStyle-BorderColor="Azure" ID="CreateUserWizard1" runat="server" ContinueDestinationPageUrl="~/home.aspx"> <WizardSteps> <asp:CreateUserWizardStep ID="CreateUserWizardStep1" runat="server"> <ContentTemplate> <asp:Literal ID="ErrorMessage" runat="server"></asp:Literal> <div class="fieldLine"> <asp:Label ID="lblFirstName" runat="server" Text="First Name:" AssociatedControlID="tbxFirstName"></asp:Label> <asp:Label ID="lblLastName" runat="server" Text="Last Name:" AssociatedControlID="tbxLastName"></asp:Label> </div> <div class="fieldLine"> <asp:TextBox ID="tbxFirstName" runat="server"></asp:TextBox> <asp:TextBox ID="tbxLastName" runat="server"></asp:TextBox> </div> <asp:Label ID="lblEmail" runat="server" Text="Email:" AssociatedControlID="Email"></asp:Label> <asp:TextBox ID="Email" runat="server" CssClass="wideInput"></asp:TextBox><br /> <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" CssClass="aspValidator" Display="Dynamic" ControlToValidate="Email" ErrorMessage="Required"></asp:RequiredFieldValidator> <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" Display="Dynamic" CssClass="aspValidator" ControlToValidate="Email" SetFocusOnError="true" ValidationExpression="^(?:[a-zA-Z0-9_'^&amp;/+-])+(?:\.(?:[a-zA-Z0-9_'^&amp;/+-])+)*@(?:(?:\[?(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))\.){3}(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\]?)|(?:[a-zA-Z0-9-]+\.)+(?:[a-zA-Z]){2,}\.?)$" ErrorMessage="Email address not valid"></asp:RegularExpressionValidator> <asp:Label ID="lblEmailConfirm" runat="server" Text="Confirm Email Address:" AssociatedControlID="tbxEmailConfirm"></asp:Label> <asp:TextBox ID="tbxEmailConfirm" runat="server" CssClass="wideInput"></asp:TextBox><br /> <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" CssClass="aspValidator" Display="Dynamic" ControlToValidate="tbxEmailConfirm" ErrorMessage="Required"></asp:RequiredFieldValidator> <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" Display="Dynamic" CssClass="aspValidator" ControlToValidate="tbxEmailConfirm" SetFocusOnError="true" ValidationExpression="^(?:[a-zA-Z0-9_'^&amp;/+-])+(?:\.(?:[a-zA-Z0-9_'^&amp;/+-])+)*@(?:(?:\[?(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))\.){3}(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\]?)|(?:[a-zA-Z0-9-]+\.)+(?:[a-zA-Z]){2,}\.?)$" ErrorMessage="Email address not valid"></asp:RegularExpressionValidator> <asp:CompareValidator ID="CompareValidator1" runat="server" Display="Dynamic" SetFocusOnError="true" CssClass="aspValidator" ControlToCompare="Email" ControlToValidate="tbxEmailConfirm" ErrorMessage="Email address' do not match"></asp:CompareValidator> <asp:Label ID="lblUsername" runat="server" Text="Username:" AssociatedControlID="UserName"></asp:Label> <asp:TextBox ID="UserName" runat="server" MaxLength="12"></asp:TextBox><br /> <asp:CustomValidator ID="CustomValidatorUserName" runat="server" Display="Dynamic" SetFocusOnError="true" CssClass="aspValidator" ValidateEmptyText="true" ControlToValidate="UserName" ErrorMessage="Username can be between 6 and 12 characters." ClientValidationFunction="ValidateLength" OnServerValidate="ValidateUserName"></asp:CustomValidator> <div class="fieldLine"> <asp:Label ID="lblPassword" runat="server" Text="Password:" AssociatedControlID="Password"></asp:Label> <asp:Label ID="lblPasswordConfirm" runat="server" Text="Confirm Password:" AssociatedControlID="ConfirmPassword" CssClass="confirmPassword"></asp:Label> </div> <div class="fieldLine"> <asp:TextBox ID="Password" runat="server" TextMode="Password"></asp:TextBox> <asp:TextBox ID="ConfirmPassword" runat="server" TextMode="Password"></asp:TextBox><br /> <asp:CustomValidator ID="CustomValidatorPassword" runat="server" Display="Dynamic" SetFocusOnError="true" CssClass="aspValidator" ControlToValidate="Password" ValidateEmptyText="true" ErrorMessage="Password can be between 6 and 12 characters" ClientValidationFunction="ValidateLength" OnServerValidate="ValidatePassword"></asp:CustomValidator> <asp:CustomValidator ID="CustomValidatorConfirmPassword" runat="server" Display="Dynamic" SetFocusOnError="true" CssClass="aspValidator" ControlToValidate="ConfirmPassword" ValidateEmptyText="true" ErrorMessage="Password can be between 6 and 12 characters" ClientValidationFunction="ValidateLength" OnServerValidate="ValidatePassword"></asp:CustomValidator> <asp:CompareValidator ID="CompareValidator2" runat="server" Enabled="false" Display="Dynamic" SetFocusOnError="true" CssClass="aspValidator" ControlToCompare="Password" ControlToValidate="ConfirmPassword" ErrorMessage="Passwords do not match"></asp:CompareValidator> </div> <asp:Label ID="lblCaptch" runat="server" Text="Captcha:" AssociatedControlID="imgCaptcha"></asp:Label> <div class="borderBlue" style="width:200px;"> <asp:Image ID="imgCaptcha" runat="server" ImageUrl="~/JpegImage.aspx" /><br /> </div> <asp:TextBox ID="tbxCaptcha" runat="server" CssClass="captchaText"></asp:TextBox> <asp:RequiredFieldValidator ControlToValidate="tbxCaptcha" CssClass="aspValidator" ID="RequiredFieldValidator3" runat="server" ErrorMessage="Required"></asp:RequiredFieldValidator> <asp:CustomValidator ID="CustomValidator1" ControlToValidate="tbxCaptcha" runat="server" OnServerValidate="ValidateCaptcha" ErrorMessage="Captcha incorrect"></asp:CustomValidator> </ContentTemplate> <CustomNavigationTemplate> <div style="float:left;"> <asp:Button ID="CreateUser" runat="server" Text="Register Now!" CausesValidation="true" CommandName="CreateUser" OnCommand="CreateUserClick" CssClass="registerButton" /> </div> </CustomNavigationTemplate> </asp:CreateUserWizardStep> <asp:CompleteWizardStep ID="CompleteWizardStep1" runat="server"> <ContentTemplate> <table border="0" style="font-size: 100%; font-family: Verdana" id="TABLE1" > <tr> <td align="center" colspan="2" style="font-weight: bold; color: white; background-color: #5d7b9d; height: 18px;"> Complete</td> </tr> <tr> <td> Your account has been successfully created.<br /> </td> </tr> <tr> <td align="right" colspan="2"> <asp:Button ID="Button1" PostBackUrl="~/home.aspx" runat="server" Text="Button" /> </td> </tr> </table> </ContentTemplate> </asp:CompleteWizardStep> </WizardSteps> </asp:CreateUserWizard>

    Read the article

  • Jquery - add server control

    - by superexsl
    Hey, I'm having trouble with a custom control and adding it dynamically using JQuery. I've got the following code: $('.custom_control_div').replaceWith( "<div><cc:mycustomcontrol id='cControl' ></cc:mycustomcontrol></div>" ); This doesn't throw any errors, but doesn't work because I need to use runat=server in my custom control. However, if I add runat=server in the code above, no javascript is executed on the page (and jqueryUI no longer works). The custom control works fine when I add it directly to the page from design-time. Is there a way to add a control, with runat=server using Jquery? Thanks

    Read the article

  • C#: No value given for one or more required parameter with FormView

    - by Vinzcent
    Hey, I am using a FormView and when I want to update something I have edited, I always get this error: No value given for one or more required parameters. I use a SQLDataSource in combination with a FormView This is the code of my SQLDataSource <asp:SqlDataSource ID="sqldsLokaalPrinters" runat="server" ConnectionString="<%$ ConnectionStrings:connRand2 %>" DeleteCommand="DELETE FROM [tblComputers] WHERE (([tblArtveldenr] = ?) OR ([tblArtveldenr] IS NULL AND ? IS NULL))" InsertCommand="INSERT INTO [tblComputers] ([tblArtveldenr], [tblNaam], [tblCLokaal_id], [tblPositie], [tblSerienr], [tblTCPIP], [tblFabrikant], [tblModel], [tblProcessor], [tblSnelheid], [tblKleur], [tblGeheugen], [tblHarddisk], [tblZip], [tblCD], [tblDVD], [tblNetwerk], [tblFirewire], [tblAanschafdatum], [tblCLeverabcierNr], [tblScherm], [tblLaptop]) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" ProviderName="<%$ ConnectionStrings:connRand2.ProviderName %>" SelectCommand="SELECT * FROM [tblComputers] WHERE ([tblCLokaal_id] = ?)" UpdateCommand="UPDATE [tblComputers] SET [tblNaam] = ?, [tblCLokaal_id] = ?, [tblPositie] = ?, [tblSerienr] = ?, [tblTCPIP] = ?, [tblFabrikant] = ?, [tblModel] = ?, [tblProcessor] = ?, [tblSnelheid] = ?, [tblKleur] = ?, [tblGeheugen] = ?, [tblHarddisk] = ?, [tblZip] = ?, [tblCD] = ?, [tblDVD] = ?, [tblNetwerk] = ?, [tblFirewire] = ?, [tblAanschafdatum] = ?, [tblCLeverabcierNr] = ?, [tblScherm] = ?, [tblLaptop] = ? WHERE (([tblArtveldenr] = ?) OR ([tblArtveldenr] IS NULL AND ? IS NULL))"> <SelectParameters> <asp:SessionParameter Name="tblCLokaal_id" SessionField="lokaalID" Type="Int16" /> </SelectParameters> <DeleteParameters> <asp:Parameter Name="tblArtveldenr" Type="String" /> </DeleteParameters> <UpdateParameters> <asp:Parameter Name="tblNaam" Type="String" /> <asp:Parameter Name="tblCLokaal_id" Type="Int16" /> <asp:Parameter Name="tblPositie" Type="Int32" /> <asp:Parameter Name="tblSerienr" Type="String" /> <asp:Parameter Name="tblTCPIP" Type="String" /> <asp:Parameter Name="tblFabrikant" Type="String" /> <asp:Parameter Name="tblModel" Type="String" /> <asp:Parameter Name="tblProcessor" Type="String" /> <asp:Parameter Name="tblSnelheid" Type="Int32" /> <asp:Parameter Name="tblKleur" Type="String" /> <asp:Parameter Name="tblGeheugen" Type="Int32" /> <asp:Parameter Name="tblHarddisk" Type="Double" /> <asp:Parameter Name="tblZip" Type="String" /> <asp:Parameter Name="tblCD" Type="String" /> <asp:Parameter Name="tblDVD" Type="String" /> <asp:Parameter Name="tblNetwerk" Type="String" /> <asp:Parameter Name="tblFirewire" Type="Int32" /> <asp:Parameter Name="tblAanschafdatum" Type="DateTime" /> <asp:Parameter Name="tblCLeverabcierNr" Type="Int32" /> <asp:Parameter Name="tblScherm" Type="String" /> <asp:Parameter Name="tblLaptop" Type="Boolean" /> <asp:Parameter Name="tblArtveldenr" Type="String" /> </UpdateParameters> <InsertParameters> <asp:Parameter Name="tblArtveldenr" Type="String" /> <asp:Parameter Name="tblNaam" Type="String" /> <asp:Parameter Name="tblCLokaal_id" Type="Int16" /> <asp:Parameter Name="tblPositie" Type="Int32" /> <asp:Parameter Name="tblSerienr" Type="String" /> <asp:Parameter Name="tblTCPIP" Type="String" /> <asp:Parameter Name="tblFabrikant" Type="String" /> <asp:Parameter Name="tblModel" Type="String" /> <asp:Parameter Name="tblProcessor" Type="String" /> <asp:Parameter Name="tblSnelheid" Type="Int32" /> <asp:Parameter Name="tblKleur" Type="String" /> <asp:Parameter Name="tblGeheugen" Type="Int32" /> <asp:Parameter Name="tblHarddisk" Type="Double" /> <asp:Parameter Name="tblZip" Type="String" /> <asp:Parameter Name="tblCD" Type="String" /> <asp:Parameter Name="tblDVD" Type="String" /> <asp:Parameter Name="tblNetwerk" Type="String" /> <asp:Parameter Name="tblFirewire" Type="Int32" /> <asp:Parameter Name="tblAanschafdatum" Type="DateTime" /> <asp:Parameter Name="tblCLeverabcierNr" Type="Int32" /> <asp:Parameter Name="tblScherm" Type="String" /> <asp:Parameter Name="tblLaptop" Type="Boolean" /> </InsertParameters> </asp:SqlDataSource> This is the code of my FormView <asp:FormView ID="FormView1" runat="server" AllowPaging="True" DataKeyNames="tblArtveldenr" DataSourceID="sqldsLokaalPrinters"> <EditItemTemplate> tblPositie: <asp:TextBox ID="tblPositieTextBox" runat="server" Text='<%# Bind("tblPositie") %>' /> <br /> tblSerienr: <asp:TextBox ID="tblSerienrTextBox" runat="server" Text='<%# Bind("tblSerienr") %>' /> <br /> tblFabrikant: <asp:TextBox ID="tblFabrikantTextBox" runat="server" Text='<%# Bind("tblFabrikant") %>' /> <br /> tblModel: <asp:TextBox ID="tblModelTextBox" runat="server" Text='<%# Bind("tblModel") %>' /> <br /> tblSnelheid: <asp:TextBox ID="tblSnelheidTextBox" runat="server" Text='<%# Bind("tblSnelheid") %>' /> <br /> tblHarddisk: <asp:TextBox ID="tblHarddiskTextBox" runat="server" Text='<%# Bind("tblHarddisk") %>' /> <br /> tblCD: <asp:TextBox ID="tblCDTextBox" runat="server" Text='<%# Bind("tblCD") %>' /> <br /> tblDVD: <asp:TextBox ID="tblDVDTextBox" runat="server" Text='<%# Bind("tblDVD") %>' /> <br /> tblAanschafdatum: <asp:TextBox ID="tblAanschafdatumTextBox" runat="server" Text='<%# Bind("tblAanschafdatum") %>' /> <br /> <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" CommandName="Update" Text="Update" /> &nbsp;<asp:LinkButton ID="UpdateCancelButton" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel" /> </EditItemTemplate> <InsertItemTemplate> tblPositie: <asp:TextBox ID="tblPositieTextBox" runat="server" Text='<%# Bind("tblPositie") %>' /> <br /> tblSerienr: <asp:TextBox ID="tblSerienrTextBox" runat="server" Text='<%# Bind("tblSerienr") %>' /> <br /> tblFabrikant: <asp:TextBox ID="tblFabrikantTextBox" runat="server" Text='<%# Bind("tblFabrikant") %>' /> <br /> tblModel: <asp:TextBox ID="tblModelTextBox" runat="server" Text='<%# Bind("tblModel") %>' /> <br /> tblSnelheid: <asp:TextBox ID="tblSnelheidTextBox" runat="server" Text='<%# Bind("tblSnelheid") %>' /> <br /> tblHarddisk: <asp:TextBox ID="tblHarddiskTextBox" runat="server" Text='<%# Bind("tblHarddisk") %>' /> <br /> tblCD: <asp:TextBox ID="tblCDTextBox" runat="server" Text='<%# Bind("tblCD") %>' /> <br /> tblDVD: <asp:TextBox ID="tblDVDTextBox" runat="server" Text='<%# Bind("tblDVD") %>' /> <br /> tblAanschafdatum: <asp:TextBox ID="tblAanschafdatumTextBox" runat="server" Text='<%# Bind("tblAanschafdatum") %>' /> <br /> <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" CommandName="Insert" Text="Insert" /> &nbsp;<asp:LinkButton ID="InsertCancelButton" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel" /> </InsertItemTemplate> <ItemTemplate> tblPositie: <asp:Label ID="tblPositieLabel" runat="server" Text='<%# Bind("tblPositie") %>' /> <br /> tblSerienr: <asp:Label ID="tblSerienrLabel" runat="server" Text='<%# Bind("tblSerienr") %>' /> <br /> tblFabrikant: <asp:Label ID="tblFabrikantLabel" runat="server" Text='<%# Bind("tblFabrikant") %>' /> <br /> tblModel: <asp:Label ID="tblModelLabel" runat="server" Text='<%# Bind("tblModel") %>' /> <br /> tblSnelheid: <asp:Label ID="tblSnelheidLabel" runat="server" Text='<%# Bind("tblSnelheid") %>' /> <br /> tblHarddisk: <asp:Label ID="tblHarddiskLabel" runat="server" Text='<%# Bind("tblHarddisk") %>' /> <br /> tblCD: <asp:Label ID="tblCDLabel" runat="server" Text='<%# Bind("tblCD") %>' /> <br /> tblDVD: <asp:Label ID="tblDVDLabel" runat="server" Text='<%# Bind("tblDVD") %>' /> <br /> tblAanschafdatum: <asp:Label ID="tblAanschafdatumLabel" runat="server" Text='<%# Bind("tblAanschafdatum") %>' /> <br /> <br /> <asp:LinkButton ID="EditButton" runat="server" CausesValidation="False" CommandName="Edit" Text="Edit" /> &nbsp;<asp:LinkButton ID="DeleteButton" runat="server" CausesValidation="False" CommandName="Delete" Text="Delete" /> &nbsp;<asp:LinkButton ID="NewButton" runat="server" CausesValidation="False" CommandName="New" Text="New" /> </ItemTemplate> </asp:FormView> I have no idea how to solve this error Thanks a lot Vincent

    Read the article

  • Exception handling in WebForms

    - by user999379
    I have a webform with a formview <asp:FormView ID="formViewBrouwers" runat="server" AllowPaging="True" DataKeyNames="BrouwerNr" DataSourceID="brouwerDataSource" onitemupdated="formViewBrouwers_ItemUpdated" onitemupdating="formViewBrouwers_ItemUpdating" oniteminserted="formViewBrouwers_ItemInserted" oniteminserting="formViewBrouwers_ItemInserting"> <EditItemTemplate> BrouwerNr: <asp:Label ID="BrouwerNrLabel1" runat="server" Text='<%# Eval("BrouwerNr") %>' /> <br /> BrNaam: <asp:TextBox ID="BrNaamTextBox" runat="server" Text='<%# Bind("BrNaam") %>' /> <br /> Adres: <asp:TextBox ID="AdresTextBox" runat="server" Text='<%# Bind("Adres") %>' /> <br /> Postcode: <asp:TextBox ID="PostcodeTextBox" runat="server" Text='<%# Bind("Postcode") %>' /> <br /> Gemeente: <asp:TextBox ID="GemeenteTextBox" runat="server" Text='<%# Bind("Gemeente") %>' /> <br /> Omzet: <asp:TextBox ID="OmzetTextBox" runat="server" Text='<%# Bind("Omzet") %>' /> <br /> Status: <asp:TextBox ID="StatusTextBox" runat="server" Text='<%# Bind("Status") %>' /> <br /> <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" CommandName="Update" Text="Update" /> &nbsp;<asp:LinkButton ID="UpdateCancelButton" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel" /> </EditItemTemplate> <InsertItemTemplate> BrNaam: <asp:TextBox ID="BrNaamTextBox" runat="server" Text='<%# Bind("BrNaam") %>' /> <br /> Adres: <asp:TextBox ID="AdresTextBox" runat="server" Text='<%# Bind("Adres") %>' /> <br /> Postcode: <asp:TextBox ID="PostcodeTextBox" runat="server" Text='<%# Bind("Postcode") %>' /> <br /> Gemeente: <asp:TextBox ID="GemeenteTextBox" runat="server" Text='<%# Bind("Gemeente") %>' /> <br /> Omzet: <asp:TextBox ID="OmzetTextBox" runat="server" Text='<%# Bind("Omzet") %>' /> <br /> Status: <asp:TextBox ID="StatusTextBox" runat="server" Text='<%# Bind("Status") %>' /> <br /> <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" CommandName="Insert" Text="Insert" /> &nbsp;<asp:LinkButton ID="InsertCancelButton" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel" /> </InsertItemTemplate> <ItemTemplate> BrouwerNr: <asp:Label ID="BrouwerNrLabel" runat="server" Text='<%# Eval("BrouwerNr") %>' /> <br /> BrNaam: <asp:Label ID="BrNaamLabel" runat="server" Text='<%# Bind("BrNaam") %>' /> <br /> Adres: <asp:Label ID="AdresLabel" runat="server" Text='<%# Bind("Adres") %>' /> <br /> Postcode: <asp:Label ID="PostcodeLabel" runat="server" Text='<%# Bind("Postcode") %>' /> <br /> Gemeente: <asp:Label ID="GemeenteLabel" runat="server" Text='<%# Bind("Gemeente") %>' /> <br /> Omzet: <asp:Label ID="OmzetLabel" runat="server" Text='<%# Bind("Omzet") %>' /> <br /> Status: <asp:Label ID="StatusLabel" runat="server" Text='<%# Bind("Status") %>' /> <br /> <asp:LinkButton ID="EditButton" runat="server" CausesValidation="False" CommandName="Edit" Text="Edit" /> &nbsp;<asp:LinkButton ID="DeleteButton" runat="server" CausesValidation="False" CommandName="Delete" Text="Delete" /> &nbsp;<asp:LinkButton ID="NewButton" runat="server" CausesValidation="False" CommandName="New" Text="New" /> </ItemTemplate> <PagerSettings Mode="NextPreviousFirstLast" /> </asp:FormView> In my property Postcode I check the value like this: private Int16 postcodeValue; public Int16 Postcode { get { return postcodeValue; } set { if (value < 1000 || value > 9999) { throw new Exception("Postcode moet tussen 1000 en 9999 liggen"); } else { postcodeValue = value; } } } How can I handle the exception I threw? If there is an exception I want a label to appear with the following exception?

    Read the article

  • Is it possible to modify ASP.NET to no longer require runat="server"?

    - by sean2078
    I know why runat="server" is currently required (ASP.NET why runat="server"), but the consensus is that it should not be required if you incorporate a simple default into the design (I agree of course). Would it be possible to modify, extend, decompile and recreate, intercept or otherwise change the behavior of how ASP.NET parses ASPX and ASCX files so that runat="server" would no longer be required? For instance, I assume that a version of Mono could be branched to accomplish this goal. In case specific requirements are helpful, the following highlights one design: During parsing, when configured namespace tags are encountered (such as "asp"), default the element's runat property to "server" During parsing, when configured namespace tags are encountered (such as "asp"), if the element's runat property value is available, then that value should be used in place of the default New page-level setting introduced (can be set in the page directive or web.config) that specifies the default runat value for a specific namespace tag

    Read the article

  • Infragistics UltraWebTab

    - by user354089
    Im using Infragistcs UltraWebTab. The code is shown below ` <div class="tab-content"> <asp:Panel ID="PnlGeneral" runat="server"> <table width="100%" border="0" cellspacing="0" cellpadding="0" class="tab-list"> <tr> <td style="border-bottom-color: White"> <asp:Label ID="LblErrors" runat="server" CssClass="ErrorMessage1"></asp:Label> <asp:Label ID="LblSuccessMsg" runat="server" CssClass="SuccessMessage1"></asp:Label> </td> </tr> <tr> <td> <table cellpadding="0" cellspacing="0" width="100%" border="0" class="tab-list"> <tr> <th width="205" class="FormLabel1"> Campaign Name <span class="ErrorMessage">*</span> </th> <td width="80%"> <asp:TextBox ID="TxtCampaignName" runat="server" CssClass="TextBox1"></asp:TextBox> </td> </tr> <tr> <th width="205" class="FormLabel1"> CRM Name <span class="ErrorMessage">*</span> </th> <td width="80%"> <asp:TextBox ID="TxtCRMName" runat="server" CssClass="TextBox1"></asp:TextBox> </td> </tr> <tr> <th class="FormLabel1"> Campaign Type <span class="ErrorMessage">*</span> </th> <td> <asp:DropDownList ID="DDLCampaignType" runat="server" CssClass="TextBox1" AutoPostBack="true" Width="117px" OnSelectedIndexChanged="DDLCampaignType_SelectedIndexChanged"> </asp:DropDownList> </td> </tr> <tr visible="false" id="trCompanyRow" runat="server"> <th class="FormLabel1"> Company <span class="ErrorMessage">*</span> </th> <td> <table cellpadding="0" cellspacing="0" border="0" width="100%"> <tr> <td class="style2" style="border-bottom-color: White"> <asp:DropDownList ID="DDLCompany" runat="server" CssClass="TextBox1" Width="117px" OnSelectedIndexChanged="DDLCompany_SelectedIndexChanged"> </asp:DropDownList> </td> <td class="style3" style="border-bottom-color: White"> <asp:LinkButton ID="btnlnknewCompany" runat="server" Style="font-size: 100%;" Text="Add New" OnClick="btnlnknewCompany_Click"></asp:LinkButton> </td> <td style="border-bottom-color: White"> <table cellpadding="0" cellspacing="0" border="0" width="100%" id="tdNewComapny" visible="false" runat="server"> <tr> <td class="style4" style="border-bottom-color: White"> <asp:TextBox ID="txtCompanyName" runat="server"></asp:TextBox> </td> <td style="border-bottom-color: White"> <asp:Button ID="btnCompanyAdd" runat="server" CssClass="btn1" Height="20px" Text="Add" Width="25%" OnClick="btnCompanyAdd_Click" /> </td> </tr> </table> </td> </tr> </table> </td> </tr> <tr id="trBannerImage" runat="server" visible="false"> <th class="FormLabel1"> Banner Image <span class="ErrorMessage">*</span> </th> <td> <asp:FileUpload ID="FileUploadBannerImage" runat="server" ToolTip="Add images for banner" /> </td> </tr> <tr> <th class="FormLabel1"> Start Date <span class="ErrorMessage">*</span> </th> <td> <asp:TextBox ID="TxtStartDate" runat="server" CssClass="TextBox1"></asp:TextBox><rjs:PopCalendar ID="CalStartDate" runat="server" Control="TxtStartDate" Format="dd mm yyyy" ShowErrorMessage="false" /> &nbsp;dd-mm-yyyy </td> </tr> <tr> <th class="FormLabel1"> End Date <span class="ErrorMessage">*</span> </th> <td> <asp:TextBox ID="TxtEndDate" runat="server" CssClass="TextBox1"></asp:TextBox><rjs:PopCalendar ID="CalEndDate" runat="server" Control="TxtEndDate" Format="dd mm yyyy" ShowErrorMessage="false" /> &nbsp;dd-mm-yyyy </td> </tr> <tr> <th class="FormLabel1"> Enabled? </th> <td> <asp:CheckBox ID="ChkEnabled" runat="server" /> </td> </tr> <tr style="border-bottom-color: White" id="tblVerificationFields" visible="false" runat="server"> <th style="border-bottom-color: White"> Company's Verification Fields </th> <td style="border-bottom-color: White"> <table border="0" cellspacing="0" cellpadding="0" class="tab-form" width="100%"> <tr> <td colspan="3" align="center"> <br /> <p> <label style="font-size: 14px; font-weight: bold; text-align: center;"> Select from existing verification fields below</label></p> </td> </tr> <tr> <td colspan="2"> <asp:Repeater ID="RptrVeriFieldsParamType" runat="server"> <HeaderTemplate> <table border="0" cellpadding="0" cellspacing="0" class="tab-grid" style="border: 0px"> <tr> <th> </th> <th> Field Name </th> <th> Type </th> <th> </th> </tr> </HeaderTemplate> <ItemTemplate> <tr> <td style="border-bottom-color: White"> <asp:CheckBox ID="RptrChkVeriFields" runat="server" /> </td> <td style="border-bottom-color: White"> <asp:Label ID="RptrFieldName" runat="server" Text='<%# Eval("FieldName") %>'> </asp:Label> </td> <td style="border-bottom-color: White"> <asp:Label ID="RptrParamterTypeName" runat="server" Text='<%# Eval("PARAMETERTYPENAME") %>'> </asp:Label> </td> <td> <asp:Label ID="RptrHdnFieldId" runat="server" Text='<%# Eval("FIELDID") %>' Visible="false"></asp:Label> </td> </tr> </ItemTemplate> <FooterTemplate> </table> </FooterTemplate> </asp:Repeater> </td> </tr> <tr> <td style="border-bottom-color: White"> </td> </tr> <tr> <td> <table border="0" cellpadding="0" cellspacing="0" width="100%" runat="server"> <tr> <td colspan="6" style="border-bottom-color: White" align="center"> <br /> <p> <label style="font-size: 14px; font-weight: bold; text-align: center; width: 100%;"> Or Add New verification field</label> </p> </td> </tr> <tr id="trVerifcationFields" runat="server" visible="false"> <th style="border-bottom-color: White" width="110px"> <strong>Verification Name</strong> </th> <td style="border-bottom-color: White" width="50px"> <asp:TextBox ID="TxtVeriField" runat="server"> </asp:TextBox> </td> <th style="border-bottom-color: White" width="100px"> <strong>Parameter Type</strong> </th> <td style="border-bottom-color: White" width="100px"> <asp:DropDownList ID="DDLParameterType" runat="server"> </asp:DropDownList> </td> <th> </th> <td align="left" style="border-bottom-color: White"> <asp:Button ID="BtnAddVeriField" runat="server" CssClass="btn1" Height="20px" Text="Add" OnClick="BtnAddVeriField_Click" Width="75%" /> </td> </tr> </table> </td> </tr> </table> </td> </tr> </table> </td> </tr> <tr> <td> <table cellpadding="0" cellspacing="0" width="100%" border="0" class="tab-list"> <tr align="right"> <td> </td> <td align="right" class="tab-list"> <asp:Button runat="server" ID="Next" Visible="true" Text="Next >" CssClass="btn" /> </td> </tr> </table> </td> </tr> </table> </asp:Panel> </div> </ContentTemplate> </igtab:Tab> <igtab:Tab Text="CRM Deals (Step-2)" Key="Tab2"> <ContentTemplate> <div style="clear: both"> </div> <div class="tab-content"> <asp:Panel ID="PnlCRMDeals" runat="server" ScrollBars="Vertical" Height="500px"> <table width="100%" border="0" cellspacing="0" cellpadding="0" class="tab-list"> <tr> <td> <asp:GridView ID="GridDeals" AutoGenerateColumns="False" runat="server" BorderStyle="none" BorderWidth="0" CellPadding="0" CellSpacing="0" GridLines="None" ShowFooter="false" HorizontalAlign="Left" CssClass="tab-grid" Width="100%"> <HeaderStyle CssClass="header" HorizontalAlign="Center" /> <PagerStyle CssClass="pager" /> <AlternatingRowStyle CssClass="odd" /> <Columns> <asp:TemplateField> <ItemStyle Width="5%" /> <ItemTemplate> <asp:CheckBox ID="ChkDeals" runat="server" Visible="true" /> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="Deal Name"> <ItemStyle Width="25%" /> <ItemTemplate> <asp:Label ID="DealName" runat="server" Text='<%# Eval("DealName") %>' /> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="Name in CRM"> <ItemTemplate> <asp:Label ID="CRMDealName" runat="server" Text='<%# Eval("CRM_NAME") %>' /> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="Deal Code"> <ItemTemplate> <asp:Label ID="PartNum" runat="server" Text='<%# Eval("PARTNUM") %>' /> </ItemTemplate> </asp:TemplateField> </Columns> </asp:GridView> </td> </tr> </table> </asp:Panel> </div> </ContentTemplate> </igtab:Tab> ` The problem im facing is after the "BtnAddVeriField" add button is clicked the Panel for the next tab gets displayed below the first tab's Panel. Furthermore, that Add button is not displayed as well.

    Read the article

  • Ajax Control Toolkit November 2011 Release

    - by Stephen Walther
    I’m happy to announce the November 2011 Release of the Ajax Control Toolkit. This release introduces a new Balloon Popup control and several enhancements to the existing Tabs control including support for on-demand loading of tab content, support for vertical tabs, and support for keyboard tab navigation. We also fixed the top-voted bugs associated with the Tabs control reported at CodePlex.com. You can download the new release by visiting the CodePlex website: http://AjaxControlToolkit.CodePlex.com Alternatively, the fast and easy way to get the latest release of the Ajax Control Toolkit is to use NuGet. Open your Library Package Manager console in Visual Studio 2010 and type: After you install the Ajax Control Toolkit through NuGet, please do a Rebuild of your project (the menu option Build, Rebuild). After you do a Rebuild, the ajaxToolkit prefix will appear in Intellisense: Using the Balloon Popup Control Why a new Balloon Popup control? The Balloon Popup control is the second most requested new feature for the Ajax Control Toolkit according to CodePlex votes: The Balloon Popup displays a message in a balloon when you shift focus to a control, click a control, or hover over a control. You can use the Balloon Popup, for example, to display instructions for TextBoxes which appear in a form: Here’s the code used to create the Balloon Popup: <ajaxToolkit:ToolkitScriptManager ID="tsm1" runat="server" /> <asp:TextBox ID="txtFirstName" Runat="server" /> <asp:Panel ID="pnlFirstNameHelp" runat="server"> Please enter your first name </asp:Panel> <ajaxToolkit:BalloonPopupExtender TargetControlID="txtFirstName" BalloonPopupControlID="pnlFirstNameHelp" BalloonSize="Small" UseShadow="true" runat="server" /> You also can use the Balloon Popup to explain hard to understand words in a text document: Here’s how you display the Balloon Popup when you hover over the link: The point of the conversation was <asp:HyperLink ID="lnkObfuscate" Text="obfuscated" CssClass="hardWord" runat="server" /> by his incessant coughing. <ajaxToolkit:ToolkitScriptManager ID="tsm1" runat="server" /> <asp:Panel id="pnlObfuscate" Runat="server"> To bewilder or render something obscure </asp:Panel> <ajaxToolkit:BalloonPopupExtender TargetControlID="lnkObfuscate" BalloonPopupControlID="pnlObfuscate" BalloonStyle="Cloud" UseShadow="true" DisplayOnMouseOver="true" Runat="server" />   There are four important properties which you need to know about when using the Balloon Popup control: BalloonSize – The three balloon sizes are Small, Medium, and Large. BalloonStyle -- The two built-in styles are Rectangle and Cloud. UseShadow – When true, a drop shadow appears behind the popup. Position – Can have the values Auto, BottomLeft, BottomRight, TopLeft, TopRight. When set to Auto, which is the default, the Balloon Popup will appear where it has the most screen real estate. The following screenshots illustrates how these settings affect the appearance of the Balloon Popup: Customizing the Balloon Popup You can customize the appearance of the Balloon Popup by creating your own Cascading Style Sheet and Sprite. The Ajax Control Toolkit sample site includes a sample of a custom Oval Balloon Popup style: This custom style was created by using a custom Cascading Style Sheet and image. You point the Balloon Popup at a custom Cascading Style Sheet and Cascading Style Sheet class by using the CustomCssUrl and CustomClassName properties like this: <asp:TextBox ID="txtCustom" autocomplete="off" runat="server" /> <br /> <asp:Panel ID="Panel3" runat="server"> This is a custom BalloonPopupExtender style created with a custom Cascading Style Sheet. </asp:Panel> <ajaxToolkit:BalloonPopupExtender ID="bpe1" TargetControlID="txtCustom" BalloonPopupControlID="Panel3" BalloonStyle="Custom" CustomCssUrl="CustomStyle/BalloonPopupOvalStyle.css" CustomClassName="oval" UseShadow="true" runat="server" />   Learn More about the Balloon Popup To learn more about the Balloon Popup control, visit the sample page for the Balloon Popup at the Ajax Control Toolkit sample site: http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/BalloonPopup/BalloonPopupExtender.aspx Improvements to the Tabs Control In this release, we introduced several important new features for the existing Tabs control. We also fixed all of the top-voted bugs for the Tabs control. On-Demand Loading of Tab Content Here is the scenario. Imagine that you are using the Tabs control in a Web Forms page. The Tabs control displays two tabs: Customers and Products. When you click the Customers tab then you want to see a list of customers and when you click on the Products tab then you want to see a list of products. In this scenario, you don’t want the list of customers and products to be retrieved from the database when the page is initially opened. The user might never click on the Products tab and all of the work to load the list of products from the database would be wasted. In this scenario, you want the content of a tab panel to be loaded on demand. The products should only be loaded from the database and rendered to the browser when you click the Products tab and not before. The Tabs control in the November 2011 Release of the Ajax Control Toolkit includes a new property named OnDemand. When OnDemand is set to the value True, a tab panel won’t be loaded until you click its associated tab. Here is the code for the aspx page: <ajaxToolkit:ToolkitScriptManager ID="tsm1" runat="server" /> <ajaxToolkit:TabContainer ID="tabs" OnDemand="false" runat="server"> <ajaxToolkit:TabPanel HeaderText="Customers" runat="server"> <ContentTemplate> <h2>Customers</h2> <asp:GridView ID="grdCustomers" DataSourceID="srcCustomers" runat="server" /> <asp:SqlDataSource ID="srcCustomers" SelectCommand="SELECT * FROM Customers" ConnectionString="<%$ ConnectionStrings:StoreDB %>" runat="server" /> </ContentTemplate> </ajaxToolkit:TabPanel> <ajaxToolkit:TabPanel HeaderText="Products" runat="server"> <ContentTemplate> <h2>Products</h2> <asp:GridView ID="grdProducts" DataSourceID="srcProducts" runat="server" /> <asp:SqlDataSource ID="srcProducts" SelectCommand="SELECT * FROM Products" ConnectionString="<%$ ConnectionStrings:StoreDB %>" runat="server" /> </ContentTemplate> </ajaxToolkit:TabPanel> </ajaxToolkit:TabContainer> Notice that the TabContainer includes an OnDemand=”True” property. The Tabs control contains two Tab Panels. The first tab panel uses a DataGrid and SqlDataSource to display a list of customers and the second tab panel uses a DataGrid and SqlDataSource to display a list of products. And here is the code-behind for the page: using System; using System.Diagnostics; using System.Web.UI.WebControls; namespace ACTSamples { public partial class TabsOnDemand : System.Web.UI.Page { protected override void OnInit(EventArgs e) { srcProducts.Selecting += new SqlDataSourceSelectingEventHandler(srcProducts_Selecting); } void srcProducts_Selecting(object sender, SqlDataSourceSelectingEventArgs e) { Debugger.Break(); } } } The code-behind file includes an event handler for the Products SqlDataSource Selecting event. The handler breaks into the debugger by calling the Debugger.Break() method. That way, we can know when the Products SqlDataSource actually retrieves the list of products. When the OnDemand property has the value False then the Selecting event handler is called immediately when the page is first loaded. The contents of all of the tabs are loaded (and the contents of the unselected tabs are hidden) when the page is first loaded. When the OnDemand property has the value True then the Selecting event handler is not called when the page is first loaded. The event handler is not called until you click on the Products tab. If you never click on the Products tab then the list of products is never retrieved from the database. If you want even more control over when the contents of a tab panel gets loaded then you can use the TabPanel OnDemandMode property. This property accepts the following three values: None – Never load the contents of the tab panel again after the page is first loaded. Once – Wait until the tab is selected to load the contents of the tab panel Always – Load the contents of the tab panel each and every time you select the tab. There is a live demonstration of the OnDemandMode property here in the sample page for the Tabs control: http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/Tabs/Tabs.aspx Displaying Vertical Tabs With the November 2011 Release, the Tabs control now supports vertical tabs. To create vertical tabs, just set the TabContainer UserVerticalStripPlacement property to the value True like this: <ajaxToolkit:TabContainer ID="tabs" OnDemand="false" UseVerticalStripPlacement="true" runat="server"> <ajaxToolkit:TabPanel ID="TabPanel1" HeaderText="First Tab" runat="server"> <ContentTemplate> <p> Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas porttitor congue massa. Fusce posuere, magna sed pulvinar ultricies, purus lectus malesuada libero, sit amet commodo magna eros quis urna. </p> </ContentTemplate> </ajaxToolkit:TabPanel> <ajaxToolkit:TabPanel ID="TabPanel2" HeaderText="Second Tab" runat="server"> <ContentTemplate> <p> Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas porttitor congue massa. Fusce posuere, magna sed pulvinar ultricies, purus lectus malesuada libero, sit amet commodo magna eros quis urna. </p> </ContentTemplate> </ajaxToolkit:TabPanel> </ajaxToolkit:TabContainer> In addition, you can use the TabStripPlacement property to control whether the tab strip appears at the left or right or top or bottom of the tab panels: Tab Keyboard Navigation Another highly requested feature for the Tabs control is support for keyboard navigation. The Tabs control now supports the arrow keys and the Home and End keys. In order for the arrow keys to work, you must first move focus to the tab control on the page by either clicking on a tab with your mouse or repeatedly hitting the Tab key. You can try out the new keyboard navigation support by trying any of the demos included in the Tabs sample page: http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/Tabs/Tabs.aspx Summary I hope that you take advantage of the new Balloon Popup control and the new features which we introduced for the Tabs control. We added a lot of new features to the Tabs control in this release including support for on-demand tabs, support for vertical tabs, and support for tab keyboard navigation. I want to thank the developers on the Superexpert team for all of the hard work which they put into this release.

    Read the article

  • Render custom form / alter existing rendering template at runtime.

    - by Janis Veinbergs
    How do I create reusable custom new item form + preferrably, i don't want to tie this form to content type? I want to force render one hidden field (it could be render on the page, but make invisible or render on the page and display) and set field value programmatically (that's why it has to be rendered - to set it's value). Google has tons of information on how to create custom list form with sharepoint designer, but in my case, i don't want sharepoint designer for the advantages you see below. What i'm trying to achieve I want to be able to have a custom newform to create item (i don't want it to be as default). To open this newForm i would use CustomAction in item's ECB menu. In this form, i want to force render one hidden field and set it's value programmatically. I want to open this form from CustomAction ECB (item's context menu), so i don't want to set this as a default New form template for content type. <XmlDocument NamespaceURI="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms"> <FormTemplates xmlns="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms"> <New>ListForm</New> </FormTemplates> </XmlDocument> Idea #1 I could create custom RenderingTemplate and set Content type's new form template to my newly created template. For example, OOTB ListForm rendering template: <SharePoint:RenderingTemplate ID="ListForm" runat="server"> <Template> <SPAN id='part1'> <SharePoint:InformationBar runat="server"/> <wssuc:ToolBar CssClass="ms-formtoolbar" id="toolBarTbltop" RightButtonSeparator="&nbsp;" runat="server"> <Template_RightButtons> <SharePoint:NextPageButton runat="server"/> <SharePoint:SaveButton runat="server"/> <SharePoint:GoBackButton runat="server"/> </Template_RightButtons> </wssuc:ToolBar> <SharePoint:FormToolBar runat="server"/> <TABLE class="ms-formtable" style="margin-top: 8px;" border=0 cellpadding=0 cellspacing=0 width=100%> <SharePoint:ChangeContentType runat="server"/> <SharePoint:FolderFormFields runat="server"/> <SharePoint:ListFieldIterator runat="server" /> <SharePoint:ApprovalStatus runat="server"/> <SharePoint:FormComponent TemplateName="AttachmentRows" runat="server"/> </TABLE> <table cellpadding=0 cellspacing=0 width=100%><tr><td class="ms-formline"><IMG SRC="/_layouts/images/blank.gif" width=1 height=1 alt=""></td></tr></table> <TABLE cellpadding=0 cellspacing=0 width=100% style="padding-top: 7px"><tr><td width=100%> <SharePoint:ItemHiddenVersion runat="server"/> <SharePoint:ParentInformationField runat="server"/> <SharePoint:InitContentType runat="server"/> <wssuc:ToolBar CssClass="ms-formtoolbar" id="toolBarTbl" RightButtonSeparator="&nbsp;" runat="server"> <Template_Buttons> <SharePoint:CreatedModifiedInfo runat="server"/> </Template_Buttons> <Template_RightButtons> <SharePoint:SaveButton runat="server"/> <SharePoint:GoBackButton runat="server"/> </Template_RightButtons> </wssuc:ToolBar> </td></tr></TABLE> </SPAN> <SharePoint:AttachmentUpload runat="server"/> </Template> </SharePoint:RenderingTemplate> I only need such a minor change: <SharePoint:RenderingTemplate ID="NewRelatedListItemTemplate" runat="server"> ... <SharePoint:ListFieldIterator TemplateName="ListItemFormFieldsWithRelatedItems" runat="server" /> .. </SharePoint:RenderingTemplate> <SharePoint:RenderingTemplate ID="ListItemFormFieldsWithRelatedItems" runat="server"> <Template> <Balticovo:ListFieldIteratorExtended IncludeFields="RelatedItems" runat="server"/> </Template> </SharePoint:RenderingTemplate> Advantages over manual (SPD) custom forms In this way form is not "constant/static". If new list fields are added to list or content type afterwards, my custom form will render them (the ListFieldIterator will do it). Idea #2 Could it be that i modify existing RenderingTemplate at runtime? I would take "new forms" template (Named, for example, ListForm or it could be other than default ListForm) with SPControlTemplateManager.GetTemplateByName("ListForm") Find ListIterator control and add property TemplateName="ListItemFormFieldsWithRelatedItems" Render this template and return it? In short, i would like to create RenderingTemplate programmatically, on-the-fly and then use this template to render list's new form. Advantages I get the advantage of Idea 1 + This way i would get a bonus even if Template changes (from ListForm to CompanyCustomListForm) and my custom form won't loose my implemented functionality if i choose to change content type's rendering template later on (i can create other features not trying to rembeer to reimplement this particular stuff or other 3rd party features won't override my functionality if they use custom forms - loose coupling is it?). Now, is this (Idea #2) possible...?

    Read the article

  • How do I insert data using a DetailsView into an access database without everything breaking?

    - by Steve
    Hey I'm getting the error: Data type mismatch in criteria expression. when I try to submit a DetailsView insert. Code for Default.aspx: (from inside an asp:Content tag) <asp:DetailsView ID="DetailsView1" runat="server" Height="50px" Width="125px" AutoGenerateRows="False" DataKeyNames="user_id" DataSourceID="AccessDataSource1" CellPadding="4" ForeColor="#333333" GridLines="None"> <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /> <CommandRowStyle BackColor="#E2DED6" Font-Bold="True" /> <RowStyle BackColor="#F7F6F3" ForeColor="#333333" /> <FieldHeaderStyle BackColor="#E9ECF1" Font-Bold="True" /> <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" /> <Fields> <asp:BoundField DataField="email" HeaderText="email" SortExpression="email" /> <asp:BoundField DataField="password" HeaderText="password" SortExpression="password" /> <asp:BoundField DataField="users_name" HeaderText="users_name" SortExpression="users_name" /> <asp:BoundField DataField="image_path" HeaderText="image_path" SortExpression="image_path" /> <asp:BoundField DataField="mobile" HeaderText="mobile" SortExpression="mobile" /> <asp:BoundField DataField="twitter" HeaderText="twitter" SortExpression="twitter" /> <asp:TemplateField HeaderText="privacy_level_id" SortExpression="privacy_level_id"> <InsertItemTemplate> <asp:DropDownList ID="DropDownList2" runat="server" DataSourceID="AccessDataSource2" DataTextField="privacy_level_name" DataValueField="privacy_level_id"> </asp:DropDownList> <asp:AccessDataSource ID="AccessDataSource2" runat="server" DataFile="~/App_Data/VisageFinal.mdb" SelectCommand="SELECT * FROM [PrivacyLevels]"></asp:AccessDataSource> </InsertItemTemplate> <ItemTemplate> <asp:Label ID="Label1" runat="server" Text='<%# Bind("date_of_birth") %>'></asp:Label> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="course_id" SortExpression="course_id"> <EditItemTemplate> <asp:DropDownList ID="DropDownList3" runat="server" DataSourceID="AccessDataSource3" DataTextField="course_name" DataValueField="course_id"> </asp:DropDownList> <asp:AccessDataSource ID="AccessDataSource3" runat="server" DataFile="~/App_Data/VisageFinal.mdb" SelectCommand="SELECT * FROM [Courses]"> </asp:AccessDataSource> </EditItemTemplate> <InsertItemTemplate> <asp:DropDownList ID="DropDownList22" runat="server" DataSourceID="AccessDataSource22" DataTextField="privacy_level_name" DataValueField="privacy_level_id"> </asp:DropDownList> <asp:AccessDataSource ID="AccessDataSource22" runat="server" DataFile="~/App_Data/VisageFinal.mdb" SelectCommand="SELECT * FROM [PrivacyLevels]"></asp:AccessDataSource> </InsertItemTemplate> <ItemTemplate> <asp:DropDownList ID="DropDownList3" runat="server" DataSourceID="AccessDataSource3" DataTextField="course_name" DataValueField="course_id" Enabled="False"> </asp:DropDownList> <asp:AccessDataSource ID="AccessDataSource3" runat="server" DataFile="~/App_Data/VisageFinal.mdb" SelectCommand="SELECT * FROM [Courses]"></asp:AccessDataSource> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="nationality_id" SortExpression="nationality_id"> <EditItemTemplate> <asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="AccessDataSource20" DataTextField="nationality_name" DataValueField="nationality_id"> </asp:DropDownList> <asp:AccessDataSource ID="AccessDataSource20" runat="server" DataFile="~/App_Data/VisageFinal.mdb" SelectCommand="SELECT * FROM [Nationalities]"> </asp:AccessDataSource> </EditItemTemplate> <InsertItemTemplate> <asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="AccessDataSource20" DataTextField="nationality_name" DataValueField="nationality_id"> </asp:DropDownList> <asp:AccessDataSource ID="AccessDataSource20" runat="server" DataFile="~/App_Data/VisageFinal.mdb" SelectCommand="SELECT * FROM [Nationalities]"> </asp:AccessDataSource> </InsertItemTemplate> <ItemTemplate> <asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="AccessDataSource20" DataTextField="nationality_name" DataValueField="nationality_id" Enabled="False"> </asp:DropDownList> <asp:AccessDataSource ID="AccessDataSource20" runat="server" DataFile="~/App_Data/VisageFinal.mdb" SelectCommand="SELECT * FROM [Nationalities]"> </asp:AccessDataSource> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="residence_id" SortExpression="residence_id"> <EditItemTemplate> <asp:DropDownList ID="DropDownList4" runat="server" DataSourceID="AccessDataSource4" DataTextField="residence_name" DataValueField="residence_id"> </asp:DropDownList> <asp:AccessDataSource ID="AccessDataSource4" runat="server" DataFile="~/App_Data/VisageFinal.mdb" SelectCommand="SELECT * FROM [Residences]"></asp:AccessDataSource> </EditItemTemplate> <InsertItemTemplate> <asp:DropDownList ID="DropDownList4" runat="server" DataSourceID="AccessDataSource4" DataTextField="residence_name" DataValueField="residence_id"> </asp:DropDownList> <asp:AccessDataSource ID="AccessDataSource4" runat="server" DataFile="~/App_Data/VisageFinal.mdb" SelectCommand="SELECT * FROM [Residences]"></asp:AccessDataSource> </InsertItemTemplate> <ItemTemplate> <asp:DropDownList ID="DropDownList4" runat="server" DataSourceID="AccessDataSource4" DataTextField="residence_name" DataValueField="residence_id" Enabled="False"> </asp:DropDownList> <asp:AccessDataSource ID="AccessDataSource4" runat="server" DataFile="~/App_Data/VisageFinal.mdb" SelectCommand="SELECT * FROM [Residences]"></asp:AccessDataSource> </ItemTemplate> </asp:TemplateField> <asp:BoundField DataField="course_year" HeaderText="course_year" SortExpression="course_year" /> <asp:TemplateField HeaderText="gender_id" SortExpression="gender_id"> <EditItemTemplate> <asp:DropDownList ID="DropDownList5" runat="server" DataSourceID="AccessDataSource5" DataTextField="gender_name" DataValueField="gender_id"> </asp:DropDownList> <asp:AccessDataSource ID="AccessDataSource5" runat="server" DataFile="~/App_Data/VisageFinal.mdb" SelectCommand="SELECT * FROM [Genders]"></asp:AccessDataSource> </EditItemTemplate> <InsertItemTemplate> <asp:DropDownList ID="DropDownList5" runat="server" DataSourceID="AccessDataSource5" DataTextField="gender_name" DataValueField="gender_id"> </asp:DropDownList> <asp:AccessDataSource ID="AccessDataSource5" runat="server" DataFile="~/App_Data/VisageFinal.mdb" SelectCommand="SELECT * FROM [Genders]"></asp:AccessDataSource> </InsertItemTemplate> <ItemTemplate> <asp:DropDownList ID="DropDownList5" runat="server" DataSourceID="AccessDataSource5" DataTextField="gender_name" DataValueField="gender_id" Enabled="False"> </asp:DropDownList> <asp:AccessDataSource ID="AccessDataSource5" runat="server" DataFile="~/App_Data/VisageFinal.mdb" SelectCommand="SELECT * FROM [Genders]"></asp:AccessDataSource> </ItemTemplate> </asp:TemplateField> <asp:CommandField ShowInsertButton="True" InsertText="Create my user!" /> </Fields> <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /> <EditRowStyle BackColor="#999999" /> <AlternatingRowStyle BackColor="White" ForeColor="#284775" /> </asp:DetailsView> <asp:Button ID="Button1" runat="server" Text="Button" /> <asp:AccessDataSource ID="AccessDataSource1" runat="server" DataFile="~/App_Data/VisageFinal.mdb" DeleteCommand="DELETE FROM [Users] WHERE [user_id] = ?" InsertCommand="INSERT INTO [Users] ([email], [password], [users_name], [image_path], [mobile], [twitter], [privacy_level_id], [nationality_id], [course_id], [residence_id], [course_year], [gender_id]) VALUES ('?', '?', '?', '?', '?', '?', ?, ?, ?, ?, ?, ?)" SelectCommand="SELECT * FROM [Users]" UpdateCommand="UPDATE [Users] SET [email] = ?, [password] = ?, [users_name] = ?, [date_of_birth] = ?, [image_path] = ?, [mobile] = ?, [twitter] = ?, [privacy_level_id] = ?, [nationality_id] = ?, [course_id] = ?, [residence_id] = ?, [has_set_privacy_level] = ?, [course_year] = ?, [gender_id] = ? WHERE [user_id] = ?"> <DeleteParameters> <asp:Parameter Name="user_id" Type="Int32" /> </DeleteParameters> <UpdateParameters> <asp:Parameter Name="email" Type="String" /> <asp:Parameter Name="password" Type="String" /> <asp:Parameter Name="users_name" Type="String" /> <asp:Parameter Name="image_path" Type="String" /> <asp:Parameter Name="mobile" Type="String" /> <asp:Parameter Name="twitter" Type="String" /> <asp:Parameter Name="privacy_level_id" Type="Int32" /> <asp:Parameter Name="nationality_id" Type="Int32" /> <asp:Parameter Name="course_id" Type="Int32" /> <asp:Parameter Name="residence_id" Type="Int32" /> <asp:Parameter Name="has_set_privacy_level" Type="Boolean" /> <asp:Parameter Name="course_year" Type="Int32" /> <asp:Parameter Name="gender_id" Type="Int32" /> <asp:Parameter Name="user_id" Type="Int32" /> </UpdateParameters> <InsertParameters> <asp:Parameter Name="email" Type="String" /> <asp:Parameter Name="password" Type="String" /> <asp:Parameter Name="users_name" Type="String" /> <asp:Parameter Name="image_path" Type="String" /> <asp:Parameter Name="mobile" Type="String" /> <asp:Parameter Name="twitter" Type="String" /> <asp:Parameter Name="privacy_level_id" Type="Int32" /> <asp:Parameter Name="nationality_id" Type="Int32" /> <asp:Parameter Name="course_id" Type="Int32" /> <asp:Parameter Name="residence_id" Type="Int32" /> <asp:Parameter Name="course_year" Type="Int32" /> <asp:Parameter Name="gender_id" Type="Int32" /> </InsertParameters> </asp:AccessDataSource> Any ideas what I've broken?

    Read the article

  • Where is ScriptManager.IsStartupScriptRegistered method?

    - by Ismail S
    Below is my code if (!Page.ClientScript.IsStartupScriptRegistered(Page.GetType(), scriptKey)) { ScriptManager scriptManager = ScriptManager.GetCurrent(page); if (scriptManager != null && scriptManager.IsInAsyncPostBack) { //if a MS AJAX request, use the Scriptmanager class ScriptManager.RegisterStartupScript(Page, Page.GetType(), scriptKey, script, true); } else { //if a standard postback, use the standard ClientScript method Page.ClientScript.RegisterStartupScript(Page.GetType(), scriptKey, script, true); } } I'm doing as suggested in this answer so that I can register startup script on both times i.e. when there is partial postback and a full postback. The problem is Page.ClientScript.IsStartupScriptRegistered(Page.GetType(), scriptKey) always returns false when it is partial postback. And I couldn't find ScriptManager.IsStartupScriptRegistered method. As a result of this additional script is emitted on all partial/async postbacks. Please note that I'm using script manager of AjaxControlToolkit version 4.1 i.e. ToolkitScriptManager in my masterpage. But I don't thing it has something to do with this. UPDATE <asp:UpdatePanel ID="ContactDetailsUpdatePanel" UpdateMode="Conditional" runat="server"> <Triggers> <asp:AsyncPostBackTrigger ControlID="UpdateContactDetailsButton" EventName="Click" /> </Triggers> <ContentTemplate> <div id="ContactDetailsContent" class="contact_details_content"> <div class="customer_contactdetails_left_pane"> <div class="customer_name_field"> <asp:Label ID="CustomerNameLabel" runat="server" Text="Customer" /> <asp:TextBox ID="CustomerNameValue" runat="server" /> </div> <div class="customer_address_field"> <asp:Label ID="CustomerAddressLabel" runat="server" Text="Address" /> <asp:TextBox ID="CustomerAddressValue" runat="server" /> <asp:TextBox ID="CustomerAddressValue1" runat="server" /> <asp:TextBox ID="CustomerAddressValue2" runat="server" /> <asp:TextBox ID="CustomerAddressValue3" runat="server" /> </div> <div class="customer_postcode_field"> <asp:Label ID="CustomerPostcodeLabel" runat="server" Text="Postcode" /> <asp:TextBox ID="CustomerPostcodeValue" runat="server" /> </div> </div> <div class="customer_contactdetails_right_pane"> <div> <asp:Label ID="CustomerContactLabel" runat="server" Text="Contact" /> <asp:TextBox ID="CustomerContactValue" runat="server" /> </div> <div> <asp:Label ID="CustomerTelephoneLabel" runat="server" Text="Telephone" /> <asp:TextBox ID="CustomerTelephoneValue" runat="server" /> </div> <div> <asp:Label ID="CustomerMobileLabel" runat="server" Text="Mobile" /> <asp:TextBox ID="CustomerMobileValue" runat="server" /> </div> <div> <asp:Label ID="CustomerFaxLabel" runat="server" Text="Fax" /> <asp:TextBox ID="CustomerFaxValue" runat="server" /> </div> <div> <asp:Label ID="CustomerEmailLabel" runat="server" Text="Email" /> <asp:TextBox ID="CustomerEmailValue" runat="server" /> </div> <div> <asp:Label ID="CustomerWebLabel" runat="server" Text="Web" /> <asp:TextBox ID="CustomerWebValue" runat="server" /> </div> </div> </div> <div class="update_button_field"> <asp:Button ID="UpdateContactDetailsButton" runat="server" Text="Update" onclick="UpdateContactDetailsButton_Click" /> </div> </ContentTemplate> </asp:UpdatePanel> Thanks in advance.

    Read the article

  • asp.net labels and asp.net textboxes are not lining up correctly?

    - by Xaisoft
    My Registration page currently looks like the following: The current styling I have for the above is image is: <style type="text/css"> #contactinfo label { float: left; width: 10em; margin-right: 0.5em; text-align: right; font-size: 14px; } #contactinfo p { padding: 5px; } #contactinfo input[type="text"], input[type="password"] { height: 1.5em; } #contactinfo select { padding: 0.25em; } #contactinfo input[type="text"]:focus, input[type="password"]:focus { background-color: #FFFFE0; } #contactinfo .update { margin-left: 12.5em; } #contactinfo .error { background-color: transparent; } #contactinfo .longtextbox { width: 20em; } #contactinfo .shorttextbox { width: 5em; } </style> and the markup is <div id="contactinfo"> <p> <asp:Label runat="server" AssociatedControlID="txtEmail">Email </asp:Label> <asp:TextBox ID="txtEmail" runat="server" CssClass="longtextbox" /> </p> <p> <asp:Label runat="server" AssociatedControlID="txtFirstName">First Name </asp:Label> <asp:TextBox ID="txtFirstName" runat="server" ValidationGroup="AccountValidation" /> <asp:RequiredFieldValidator runat="server" ControlToValidate="txtFirstName" Text="First Name is required." ValidationGroup="AccountValidation" CssClass="error"> </asp:RequiredFieldValidator> </p> <p> <asp:Label runat="server" AssociatedControlID="txtLastName">Last Name </asp:Label> <asp:TextBox ID="txtLastName" runat="server" ValidationGroup="AccountValidation" /> <asp:RequiredFieldValidator runat="server" ControlToValidate="txtLastName" Text="Last Name is required." ValidationGroup="AccountValidation" CssClass="error"> </asp:RequiredFieldValidator> </p> <p> <asp:Label runat="server" AssociatedControlID="txtBusinessName">Business Name </asp:Label> <asp:TextBox ID="txtBusinessName" runat="server" CssClass="longtextbox" ValidationGroup="AccountValidation" /> <asp:RequiredFieldValidator runat="server" ControlToValidate="txtBusinessName" Text="Business Name is required." ValidationGroup="AccountValidation" CssClass="error"> </asp:RequiredFieldValidator> </p> <p> <asp:Label runat="server" AssociatedControlID="txtPhone">Phone </asp:Label> <asp:TextBox ID="txtPhone" runat="server" ValidationGroup="AccountValidation" /> </p> <p> <asp:Label runat="server" AssociatedControlID="txtAddress">Address </asp:Label> <asp:TextBox ID="txtAddress" runat="server" CssClass="longtextbox" ValidationGroup="AccountValidation" /> <asp:RequiredFieldValidator runat="server" ControlToValidate="txtAddress" Text="Address is required." ValidationGroup="AccountValidation" CssClass="error"></asp:RequiredFieldValidator> </p> <p> <asp:Label runat="server" AssociatedControlID="txtCity">City </asp:Label><asp:TextBox ID="txtCity" runat="server" ValidationGroup="AccountValidation" /> <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="txtCity" Text="City is required." ValidationGroup="AccountValidation" CssClass="error"> </asp:RequiredFieldValidator> </p> <p> <asp:Label runat="server" AssociatedControlID="ddlState">State </asp:Label> <asp:DropDownList ID="ddlState" runat="server" DataSourceID="dsStates" DataTextField="Name" DataValueField="Id"> </asp:DropDownList> </p> <p> <asp:Label runat="server" AssociatedControlID="txtZipcode">Zipcode</asp:Label> <asp:TextBox ID="txtZipCode" runat="server" CssClass="shorttextbox" ValidationGroup="AccountValidation" /> </p> </div> As you can see from above, I have every label field pair wrapped in a p tag so it breaks to the next line, but I am not sure if I need to do this. I want to get city, state, and zip all on the same line, but as soon as I move all the labels and inputs for city,state,zip into one p tag, it looks like the following and I don't know how to fix it.

    Read the article

  • Control 'ctl00_TextBox1' of type 'TextBox' must be placed inside a form tag with runat=server.

    - by Hiru
    When a form with a run at server is added there will be two forms with runat server and another error occurs. Can some one give me an idea. Thankx in advance. The details of the error are as follows. Control 'ctl00_TextBox1' of type 'TextBox' must be placed inside a form tag with runat=server. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Web.HttpException: Control 'ctl00_TextBox1' of type 'TextBox' must be placed inside a form tag with runat=server. Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace: [HttpException (0x80004005): Control 'ctl00_TextBox1' of type 'TextBox' must be placed inside a form tag with runat=server.] System.Web.UI.Page.VerifyRenderingInServerForm(Control control) +2052287 System.Web.UI.WebControls.TextBox.AddAttributesToRender(HtmlTextWriter writer) +49 System.Web.UI.WebControls.WebControl.RenderBeginTag(HtmlTextWriter writer) +17 System.Web.UI.WebControls.TextBox.Render(HtmlTextWriter writer) +17 System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +25 System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +121 System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +22 System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +199 System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +20 System.Web.UI.Control.Render(HtmlTextWriter writer) +7 System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +25 System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +121 System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +22 System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +199 System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +20 System.Web.UI.Page.Render(HtmlTextWriter writer) +26 System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +25 System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +121 System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +22 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2558 Version Information: Microsoft .NET Framework Version:2.0.50727.1873; ASP.NET Version:2.0.50727.1433

    Read the article

  • Which is better Span that runat server or default asp lable ?

    - by Space Cracker
    I have a simple asp.net web page that contain a table with about 5 TR and each row have 2 TD .. in the page load I get user data ( 5 property ) and view them in this page the following are first 2 rows : <table> <tr> <td> FullName </td> <td> <span id="fullNameSpan" runat="server"></span> </td> </tr> <tr> <td> Username </td> <td> <span id="userNameSpan" runat="server"></span> </td> </tr> </table> I always used <asp:Label to set value by code but i always notice that label converted in runtime to span so i decided to user span by making him runat=server to be accessed by code, so Which is better to use asp:label or span with runat=server ??

    Read the article

  • AddHandler not working?

    - by EdenMachine
    I can't figure out why my addhandler is not firing? In the Sub "CreateTagStyle" thd AddHandler is to firing when the LinkButton is clicked Is there some reason that addhandlers can't be adding at certain points of the page lifecycle? <%@ Page Title="" Language="VB" MasterPageFile="~/_Common/Admin.master" %> <script runat="server"> Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) End Sub Protected Sub RadGrid1_NeedDataSource(ByVal source As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) If Not e.IsFromDetailTable Then Dim forms As New MB.RequestFormPacket() RadGrid1.DataSource = forms.GetPackets() End If End Sub Protected Sub RadGrid1_DetailTableDataBind(ByVal source As Object, ByVal e As Telerik.Web.UI.GridDetailTableDataBindEventArgs) Select Case e.DetailTableView.Name Case "gtvForms" Dim PacketID As Guid = e.DetailTableView.ParentItem.GetDataKeyValue("ID") e.DetailTableView.DataSource = MB.RequestForm.GetRequestForms(PacketID) End Select End Sub Protected Sub RadGrid1_InsertCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) If IsValid Then Select Case TryCast(e.Item.NamingContainer.NamingContainer, GridTableView).Name Case "gtvPackets" Dim rtbName As RadTextBox = TryCast(e.Item.FindControl("rtbName"), RadTextBox) Dim IsActive As Boolean = TryCast(e.Item.FindControl("cbxIsActive"), CheckBox).Checked Dim packet As New MB.RequestFormPacket() packet.Name = rtbName.Text packet.IsActive = IsActive packet.Insert() e.Canceled = True e.Item.OwnerTableView.IsItemInserted = False RadGrid1.Rebind() System.Web.UI.ScriptManager.RegisterStartupScript(Me.Page, Me.GetType(), "ClientMessage", "SuccessMessage('Request Form Packet has been added successfully.');", True) Case "gtvForms" Dim parentItem As GridDataItem = e.Item.OwnerTableView.ParentItem Dim rcbForms As RadComboBox = TryCast(e.Item.FindControl("rcbForms"), RadComboBox) Dim rf As New MB.RequestForm() rf.RequestFormPacketID = CType(parentItem.OwnerTableView.DataKeyValues(parentItem.ItemIndex)("ID"), Guid) rf.FormID = rcbForms.SelectedValue If MB.RequestFormPacket.HasItems(rf.RequestFormPacketID) Then rf.SortOrder = rf.MaxSortOrder + 1 Else rf.SortOrder = 0 End If rf.Insert() e.Canceled = True e.Item.OwnerTableView.IsItemInserted = False TryCast(e.Item.NamingContainer.NamingContainer, GridTableView).Rebind() End Select End If End Sub Protected Sub RadGrid1_UpdateCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) If IsValid Then Select Case TryCast(e.Item.NamingContainer, GridTableView).Name Case "gtvPackets" Dim PacketID As Guid = CType(CType(e.CommandSource, Button).NamingContainer, GridEditFormItem).GetDataKeyValue("ID") Dim Name As String = TryCast(e.Item.FindControl("rtbName"), RadTextBox).Text Dim Tags As String = TryCast(e.Item.FindControl("hdnTags"), HiddenField).Value Dim IsActive As Boolean = TryCast(e.Item.FindControl("cbxIsActive"), CheckBox).Checked Dim rfp As New MB.RequestFormPacket() rfp.Update(PacketID, Name, IsActive) Call MB.RequestFormPacketTag.Insert(PacketID, Tags) e.Item.Edit = False TryCast(e.Item.NamingContainer, GridTableView).Rebind() System.Web.UI.ScriptManager.RegisterStartupScript(Me.Page, Me.GetType(), "ClientMessage", "SuccessMessage('Request Form Packet has been updated successfully.');", True) Case "gtvForms" Dim RequestFormID As Guid = CType(CType(e.CommandSource, Button).NamingContainer, GridEditFormItem).GetDataKeyValue("ID") Dim rcbForms As RadComboBox = TryCast(e.Item.FindControl("rcbForms"), RadComboBox) Dim rf As New MB.RequestForm() rf.Update(RequestFormID, rcbForms.SelectedValue) e.Item.Edit = False TryCast(e.Item.NamingContainer, GridTableView).Rebind() End Select End If End Sub Protected Sub RadGrid1_DeleteCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Dim editedItem As GridEditableItem = TryCast(e.Item, GridEditableItem) Select Case CType(editedItem.Parent.Parent, GridTableView).Name Case "gtvPackets" Dim ID As Guid = CType(CType(e.CommandSource, ImageButton).NamingContainer, GridDataItem).GetDataKeyValue("ID") MB.RequestFormPacket.Delete(ID) System.Web.UI.ScriptManager.RegisterStartupScript(Me.Page, Me.GetType(), "ClientMessage", "NotifyMessage('Request Form Packet has been deleted.');", True) Case "gtvForms" Dim ID As Guid = CType(CType(e.CommandSource, ImageButton).NamingContainer, GridDataItem).GetDataKeyValue("ID") MB.RequestForm.Delete(ID) System.Web.UI.ScriptManager.RegisterStartupScript(Me.Page, Me.GetType(), "ClientMessage", "NotifyMessage('Request Form has been removed.');", True) End Select End Sub Protected Sub ibnItemUpArrow_Command(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.CommandEventArgs) Dim gtv As GridTableView = CType(CType(sender, ImageButton).NamingContainer.NamingContainer, GridTableView) Dim ID As Guid = New Guid(e.CommandArgument.ToString()) Call MB.RequestForm.MoveUp(ID) gtv.Rebind() End Sub Protected Sub ibnItemDownArrow_Command(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.CommandEventArgs) Dim gtv As GridTableView = CType(CType(sender, ImageButton).NamingContainer.NamingContainer, GridTableView) Dim ID As Guid = New Guid(e.CommandArgument.ToString()) Call MB.RequestForm.MoveDown(ID) gtv.Rebind() End Sub Protected Sub RadGrid1_RowDrop(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridDragDropEventArgs) If String.IsNullOrEmpty(e.HtmlElement) Then If e.DraggedItems(0).OwnerGridID = RadGrid1.ClientID Then If e.DestDataItem IsNot Nothing Then Dim gtv As GridTableView = CType(e.DestDataItem.NamingContainer, GridTableView) For Each gdi As GridDataItem In e.DraggedItems Select Case gtv.Name Case "gtvForms" MB.RequestForm.DragAndDropReorder(gdi.GetDataKeyValue("ID"), e.DestDataItem.GetDataKeyValue("ID"), IIf(e.DropPosition = GridItemDropPosition.Above, True, False)) gtv.Rebind() End Select Next End If End If End If End Sub Protected Sub cbxAllowDragAndDrop_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Dim cbx As CheckBox = CType(sender, CheckBox) If cbx.Checked Then RadGrid1.ClientSettings.AllowRowsDragDrop = True RadGrid1.ClientSettings.Selecting.AllowRowSelect = True RadGrid1.ClientSettings.Selecting.EnableDragToSelectRows = True Else RadGrid1.ClientSettings.AllowRowsDragDrop = False RadGrid1.ClientSettings.Selecting.AllowRowSelect = False RadGrid1.ClientSettings.Selecting.EnableDragToSelectRows = False End If End Sub Protected Sub ibnDisableToggleProcess_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Dim ibn As ImageButton = CType(sender, ImageButton) Dim hdn As HiddenField = CType(ibn.NamingContainer.FindControl("hdnDisableProcessID"), HiddenField) Dim status As Boolean = MB.RequestFormPacket.ActivateToggle(New Guid(hdn.Value)) Dim gtv As GridTableView = CType(ibn.NamingContainer.NamingContainer, GridTableView) gtv.Rebind() System.Web.UI.ScriptManager.RegisterStartupScript(Me.Page, Me.GetType(), "ClientMessage", "SuccessMessage('Process has been " & IIf(status, "Activated", "Deactivated") & ".');", True) End Sub Protected Function DisplayTagList(ByVal tags As IEnumerable(Of MB.RequestFormPacketTag)) As String Dim list As String = "" For Each t As MB.RequestFormPacketTag In tags list += "<span class=""tags"">" & t.Tag.Name & "</span>" Next Return list End Function Protected Sub RadGrid1_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Select Case e.Item.GetType.Name Case "GridEditFormInsertItem" 'do nothing Case "GridEditFormItem" Dim plh As PlaceHolder = CType(e.Item.FindControl("plhTags"), PlaceHolder) Dim hdn As HiddenField = CType(e.Item.FindControl("hdnTags"), HiddenField) If hdn IsNot Nothing Then Dim gefi As GridEditFormItem = e.Item Dim packet As MB.RequestFormPacket = gefi.DataItem For Each pt As MB.RequestFormPacketTag In packet.RequestFormPacketTags Call CreateTagStyle(plh, hdn, pt.Tag.Name) If hdn.Value = "" Then hdn.Value = "|" End If hdn.Value += pt.Tag.Name & "|" Next End If End Select End Sub Protected Sub btnAddTag_Click(ByVal sender As Object, ByVal e As System.EventArgs) Dim btnAddTag As Button = sender Dim rtbTags As RadTextBox = btnAddTag.NamingContainer.FindControl("rtbTags") Dim plhTags As PlaceHolder = btnAddTag.NamingContainer.FindControl("plhTags") Dim hdnTags As HiddenField = btnAddTag.NamingContainer.FindControl("hdnTags") Dim TagExists As Boolean = False rtbTags.Text = rtbTags.Text.ToUpper().Trim() Dim currentTags() As String = Split(hdnTags.Value, "|") For i As Integer = 1 To currentTags.Count - 2 Call CreateTagStyle(plhTags, hdnTags, currentTags(i)) Next If TagExists = False And String.IsNullOrEmpty(rtbTags.Text) = False Then Call CreateTagStyle(plhTags, hdnTags, rtbTags.Text) If String.IsNullOrEmpty(hdnTags.Value) Then hdnTags.Value = "|" End If hdnTags.Value += rtbTags.Text & "|" 'System.Web.UI.ScriptManager.RegisterStartupScript(Me.Page, Me.GetType(), "ClientMessage", "highlightTag('" & lbn.ClientID & "');", True) End If rtbTags.Text = "" rtbTags.Focus() End Sub Public Sub RemoveTag(ByVal sender As Object, ByVal e As EventArgs) Response.End() Dim lbnSender As LinkButton = sender Dim plhTags As PlaceHolder = lbnSender.NamingContainer.FindControl("plhTags") Dim hdnTags As HiddenField = lbnSender.NamingContainer.FindControl("hdnTags") Response.Write(hdnTags.Value) Response.End() Dim TagExists As Boolean = False Dim currentTags() As String = Split(hdnTags.Value, "|") For i As Integer = 1 To currentTags.Count - 2 Call CreateTagStyle(plhTags, hdnTags, currentTags(i)) Next End Sub Protected Sub CreateTagStyle(ByVal plh As PlaceHolder, ByVal hdn As HiddenField, ByVal tagName As String) Dim lbn As New LinkButton() lbn.ID = "lbn_" & hdn.ClientID & "_" & tagName lbn.CssClass = "deleteCreateTag" lbn.Text = "X" AddHandler lbn.Click, AddressOf RemoveTag plh.Controls.Add(New LiteralControl("<div><span class=showTag>" & tagName & "</span>")) plh.Controls.Add(lbn) plh.Controls.Add(New LiteralControl("</div>")) End Sub </script> <asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server"> <style type="text/css"> .tags { border:solid 1px #93AFE5; background-color:#F3F7F8; margin: 0px 2px 0px 2px; padding: 0px 4px 0px 4px; font-family:Verdana; font-size:10px; text-transform:uppercase; } </style> <script type="text/javascript"> function highlightTag(id) { $("#" + id).highlightFade({ color: '#FFFF99', speed: 2000, iterator: 'sinusoidal' }); } </script> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" DefaultLoadingPanelID="RadAjaxLoadingPanel1" EnableAJAX="false"> <AjaxSettings> <telerik:AjaxSetting AjaxControlID="RadGrid1"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="RadGrid1" /> </UpdatedControls> </telerik:AjaxSetting> </AjaxSettings> </telerik:RadAjaxManager> <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" /> <telerik:RadTabStrip ID="RadTabStrip1" runat="server" Skin="WebBlue" style="position:relative;top:1px;" ValidationGroup="vgTabs"> <Tabs> <telerik:RadTab Text="Request Form Packets" Selected="true" ImageUrl="~/Admin/Images/Packet2.png" /> <telerik:RadTab Text="Request Forms" NavigateUrl="Forms.aspx" ImageUrl="~/Admin/Images/Forms.png" /> </Tabs> </telerik:RadTabStrip> <asp:ObjectDataSource ID="odsForms" runat="server" TypeName="MB.Form" SelectMethod="GetForms" /> <asp:Panel ID="pnlContent" runat="server" CssClass="ContentPanel"> <telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="True" AllowSorting="True" GridLines="None" OnNeedDataSource="RadGrid1_NeedDataSource" AllowAutomaticUpdates="true" AllowAutomaticDeletes="true" AllowAutomaticInserts="true" OnInsertCommand="RadGrid1_InsertCommand" OnUpdateCommand="RadGrid1_UpdateCommand" OnDeleteCommand="RadGrid1_DeleteCommand" OnRowDrop="RadGrid1_RowDrop" OnDetailTableDataBind="RadGrid1_DetailTableDataBind" OnItemDataBound="RadGrid1_ItemDataBound"> <%-----------------------------------------------------------%> <%------------------------- PACKETS -------------------------%> <%-----------------------------------------------------------%> <MasterTableView AutoGenerateColumns="False" DataKeyNames="ID" ClientDataKeyNames="ID" ShowHeadersWhenNoRecords="true" Name="gtvPackets" NoMasterRecordsText="There are currently no Request Form Packets" GroupLoadMode="Client" RetrieveNullAsDBNull="true" CommandItemDisplay="Top" AllowAutomaticUpdates="true" AllowAutomaticDeletes="true" AllowAutomaticInserts="true"> <RowIndicatorColumn> <HeaderStyle Width="20px"></HeaderStyle> </RowIndicatorColumn> <ExpandCollapseColumn> <HeaderStyle Width="20px"></HeaderStyle> </ExpandCollapseColumn> <CommandItemTemplate> <table width="100%"> <tr> <td class="AdminGridHeader">&nbsp;<img src="../Admin/Images/Packet2.png" align="absmiddle" width="16" height="16" />&nbsp;&nbsp;Request Form Packets</td> <td width="1%"><asp:CheckBox ID="cbxAllowDragAndDrop" runat="server" AutoPostBack="true" OnCheckedChanged="cbxAllowDragAndDrop_CheckedChanged" /></td> <td width="1%" nowrap="nowrap"><asp:Label AssociatedControlID="cbxAllowDragAndDrop" ID="Label1" runat="server" Text="Enable Drag and Drop Reordering" ToolTip="Drag and Drop Reordering applies only to Forms." /></td> <td align="right" width="1%"><asp:Button ID="btnAddPacket" Text="Create New Packet" runat="server" CommandName="InitInsert" /></td> </tr> </table> </CommandItemTemplate> <EditFormSettings> <EditColumn ButtonType="PushButton" HeaderStyle-Font-Bold="true" UniqueName="EditCommandColumn" /> </EditFormSettings> <EditItemStyle Font-Bold="true" BackColor="#FFFFCC" /> <Columns> <telerik:GridTemplateColumn HeaderText="Packet Name" UniqueName="PacketName" SortExpression="Name"> <ItemTemplate> <img src="../Admin/Images/Packet2.png" align="absmiddle" width="16" height="16" />&nbsp;&nbsp;<%#Eval("Name")%> </ItemTemplate> <EditItemTemplate> <telerik:RadTextBox runat="server" ID="rtbName" Width="300" Text='<%# Bind("Name") %>' /> <asp:RequiredFieldValidator ID="rfvName" runat="server" ErrorMessage="Required" ControlToValidate="rtbName" /> </EditItemTemplate> </telerik:GridTemplateColumn> <telerik:GridTemplateColumn HeaderText="Tags" UniqueName="Tags"> <ItemTemplate> <%#DisplayTagList(Eval("RequestFormPacketTags"))%> </ItemTemplate> <EditItemTemplate> <asp:Panel ID="pnlAddTags" runat="server" DefaultButton="btnAddTag"> <table cellpadding="0" cellspacing="0"> <tr> <td> <telerik:RadTextBox ID="rtbTags" runat="server" Width="200" style="text-transform:uppercase;" /> <asp:RegularExpressionValidator ID="revTags" runat="server" ErrorMessage="Invalid Entry" ControlToValidate="rtbTags" Display="Dynamic" ValidationExpression="^[^<>`~!/@\#}$%:;)(_^{&*=|+]+$" ValidationGroup="vgTags" /> </td> <td> <asp:Button ID="btnAddTag" runat="server" ValidationGroup="vgTags" Text="Add" OnClick="btnAddTag_Click" /> </td> </tr> </table> </asp:Panel> <div id="divTags"> <asp:PlaceHolder id="plhTags" runat="server" /> <asp:HiddenField ID="hdnTags" runat="server" /> </div> </EditItemTemplate> </telerik:GridTemplateColumn> <telerik:GridTemplateColumn HeaderTooltip="Disable" ItemStyle-Width="1%" ItemStyle-HorizontalAlign="Center" SortExpression="IsActive" UniqueName="IsActive" ReadOnly="true"> <ItemTemplate> <asp:ImageButton ID="ibnDisabledProcess" runat="server" ImageUrl="../Images/Icons/Stop.png" Width="16" OnClientClick="return window.confirm('Activate this Process?');" ToolTip="Click to activate this Request for Account use." Visible='<%#IIF(Eval("IsActive"),false,true) %>' OnClick="ibnDisableToggleProcess_Click" /> <asp:ImageButton ID="ibnEnabledProcess" runat="server" ImageUrl="../Images/Icons/Stop_disabled.png" Width="16" OnClientClick="return window.confirm('Deactivate this Process?');" ToolTip="Click to deactivate this Request for Account use." Visible='<%#IIF(Eval("IsActive"),true,false) %>' OnClick="ibnDisableToggleProcess_Click" /> <asp:HiddenField ID="hdnDisableProcessID" runat="server" Value='<%#Eval("ID") %>' /> </ItemTemplate> </telerik:GridTemplateColumn> <telerik:GridTemplateColumn HeaderText="Is Active" UniqueName="IsActiveCheckbox" Display="false"> <EditItemTemplate> <asp:CheckBox ID="cbxIsActive" runat="server" Checked='<%# IIF(Eval("IsActive") Is DbNull.Value OrElse Eval("IsActive") = False,False,True) %>' /> </EditItemTemplate> </telerik:GridTemplateColumn> <telerik:GridEditCommandColumn ButtonType="ImageButton" EditText="Edit Admin" ItemStyle-Width="16" EditImageUrl="~/Images/edit-small.png" /> <telerik:GridButtonColumn ConfirmText="Do you really want to delete this Admin? WARNING: THIS CANNOT BE UNDONE!!" ConfirmDialogType="RadWindow" ConfirmTitle="Delete" ButtonType="ImageButton" CommandName="Delete" Text="Delete Admin" ImageUrl="~/Images/Delete.png" UniqueName="DeleteColumn"> <ItemStyle HorizontalAlign="Center" Width="16" /> </telerik:GridButtonColumn> </Columns> <DetailTables> <%-----------------------------------------------------------%> <%-------------------------- FORMS --------------------------%> <%-----------------------------------------------------------%> <telerik:GridTableView Name="gtvForms" AllowPaging="true" PagerStyle-Position="TopAndBottom" PageSize="20" AutoGenerateColumns="false" DataKeyNames="RequestFormPacketID,ID" runat="server" CommandItemDisplay="Top" Width="100%"> <ParentTableRelation> <telerik:GridRelationFields DetailKeyField="RequestFormPacketID" MasterKeyField="ID" /> </ParentTableRelation> <CommandItemTemplate> <table width="100%" class="AdminGridHeaders"> <tr> <td class="AdminGridHeaders"> &nbsp;<img src="../Admin/Images/Forms.png" align="absmiddle" width="16" height="16" />&nbsp;&nbsp;Forms </td> <td align="right"> <asp:Button ID="ibnAdd" runat="server" Text="Add Form" CommandName="InitInsert" /> </td> </tr> </table> </CommandItemTemplate> <EditFormSettings> <EditColumn ButtonType="PushButton" InsertText="Save" UpdateText="Update" CancelText="Cancel" /> </EditFormSettings> <EditItemStyle Font-Bold="true" BackColor="#FFFFCC" /> <Columns> <telerik:GridTemplateColumn HeaderText="Form Name" UniqueName="FormName"> <ItemTemplate> <img src="../Admin/Images/Forms.png" align="absmiddle" width="16" height="16" style="margin-right:4px;" /> <%#Eval("Form.Name")%> </ItemTemplate> <EditItemTemplate> <telerik:RadComboBox ID="rcbForms" runat="server" DataSourceID="odsForms" AppendDataBoundItems="true" DataTextField="Name" DataValueField="ID" SelectedValue='<%#Bind("FormID")%>'> <Items> <telerik:RadComboBoxItem Text="-- Select a Form --" Value="" /> </Items> </telerik:RadComboBox> <asp:RequiredFieldValidator ID="rfvForms" runat="server" ErrorMessage="Required" ControlToValidate="rcbForms" InitialValue="-- Select a Form --" Display="Dynamic" /> </EditItemTemplate> </telerik:GridTemplateColumn> <telerik:GridTemplateColumn HeaderText="Test" ReadOnly="true" UniqueName="TestForm" HeaderStyle-Width="1%" ItemStyle-HorizontalAlign="Center"> <ItemTemplate> <asp:HyperLink ID="hypTestForm" runat="server" NavigateUrl='<%# "FormsPreview.aspx?fid=" & Eval("FormID").ToString() & "&test=true" %>' Target="_blank"><asp:Image ID="imgTestProcess" runat="server" ImageUrl="~/Admin/Images/Test.png" ImageAlign="AbsMiddle" ToolTip="Test Form" /></asp:HyperLink> </ItemTemplate> </telerik:GridTemplateColumn> <telerik:GridTemplateColumn HeaderText="Header" SortExpression="Header" UniqueName="Header"> <ItemTemplate> <%#Eval("Form.Header")%>&nbsp; </ItemTemplate> </telerik:GridTemplateColumn> <telerik:GridTemplateColumn ReadOnly="true" ItemStyle-HorizontalAlign="Center" HeaderStyle-Width="1%" HeaderStyle-Wrap="false" ItemStyle-Wrap="false" UniqueName="SortOrder"> <ItemTemplate> <asp:ImageButton ID="ibnItemUpArrow" runat="server" Width="16" height="16" ImageUrl="~/Admin/Images/ArrowUp.png" ImageAlign="AbsMiddle" Visible='<%#IIF(Eval("SortOrder") = 0,false,true) %>' CommandArgument='<%#Eval("ID") %>' OnCommand=

    Read the article

  • ASP.Net repeater item.DataItem is null

    - by mattgcon
    Within a webpage, upon loading, I fill a dataset with two table with a relation between those tables and then load the data into a repeater with a nested repeater. This can also occur after the user clicks on a button. The data gets loaded from a SQL database and the repeater datasource is set to the dataset after a postback. However, when ItemDataBound occurs the Item.Dataitem is always null. Why would this occur? below is my HTML repeater code <asp:Repeater ID="rptCustomSpaList" runat="server" onitemdatabound="rptCustomSpaList_ItemDataBound"> <HeaderTemplate> </HeaderTemplate> <ItemTemplate> <table> <tr> <td> <asp:Label ID="Label3" runat="server" Text="Spa Series:"></asp:Label> </td> <td> <asp:Label ID="Label4" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "SPASERIESVALUE") %>'></asp:Label> </td> </tr> <tr> <td> <asp:Label ID="Label5" runat="server" Text="Spa Model:"></asp:Label> </td> <td> <asp:Label ID="Label6" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "SPAMODELVALUE") %>'></asp:Label> </td> </tr> <tr> <td> <asp:Label ID="Label9" runat="server" Text="Acrylic Color:"></asp:Label> </td> <td> <asp:Label ID="Label10" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "ACRYLICCOLORVALUE") %>'></asp:Label> </td> </tr> <tr> <td> <asp:Label ID="Label11" runat="server" Text="Cabinet Color:"></asp:Label> </td> <td> <asp:Label ID="Label12" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "CABPANCOLORVALUE") %>'></asp:Label> </td> </tr> <tr> <td> <asp:Label ID="Label17" runat="server" Text="Cabinet Type:"></asp:Label> </td> <td> <asp:Label ID="Label18" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "CABINETVALUE") %>'></asp:Label> </td> </tr> <tr> <td> <asp:Label ID="Label13" runat="server" Text="Cover Color:"></asp:Label> </td> <td> <asp:Label ID="Label14" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "COVERCOLORVALUE") %>'></asp:Label> </td> </tr> </table> <asp:Label ID="Label15" runat="server" Text="Options:"></asp:Label> <asp:Repeater ID="rptCustomSpaItem" runat="server"> <HeaderTemplate> <table> </HeaderTemplate> <ItemTemplate> <tr> <td> <asp:Label ID="Label1" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "PROPERTY") %>'></asp:Label> </td> <td> <asp:Label ID="Label2" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "VALUE") %>'></asp:Label> </td> </tr> </ItemTemplate> <FooterTemplate> </table> </FooterTemplate> </asp:Repeater> <table> <tr> <td style="padding-top:15px;padding-bottom:30px;"> <asp:Label ID="Label7" runat="server" Text="Configured Price:"></asp:Label> </td> <td style="padding-top:15px;padding-bottom:30px;"> <asp:Label ID="Label8" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "SPAVALUEVALUE") %>'></asp:Label> </td> </tr> </table> <asp:Label ID="Label16" runat="server" Text="------"></asp:Label> </ItemTemplate> <FooterTemplate></FooterTemplate> </asp:Repeater>

    Read the article

  • How to create Checkboxes that act like Radio buttons with Jquery

    - by hmloo
    I have a post here to show code examples for check/uncheck all checkbox with Jquery. This time I will implement another request that the user should only be able to check at most one of the checkboxes, it's behave like radio buttons. There are 2 cases. Case 1 shows function that has little difference with radio button. It allows the user to deselect checkbox. Case 2 is same as radio button. Case 1 <head id="Head1" runat="server"> <title></title> <script src="Scripts/jquery-1.4.1.min.js" type="text/javascript"></script> <style type="text/css"> .cbRowItem {display:block;} </style> <script type="text/javascript"> $(document).ready(function() { var $chk = $('input:checkbox .cbRowItem'); $chk.click(function() { $chk.not(this).removeAttr('checked'); }); }); </script> </head> <body> <form id="form1" runat="server"> <div style="display:block;"> <asp:CheckBox id="CheckBox1" runat="server" class="cbRowItem" Text = "CheckBox 1"/> <asp:CheckBox id="CheckBox2" runat="server" class="cbRowItem" Text = "CheckBox 2"/> <asp:CheckBox id="CheckBox3" runat="server" class="cbRowItem" Text = "CheckBox 3"/> <asp:CheckBox id="CheckBox4" runat="server" class="cbRowItem" Text = "CheckBox 4"/> </div> </form> </body> </html> Case 2 <head id="Head1" runat="server"> <title></title> <script src="Scripts/jquery-1.4.1.min.js" type="text/javascript"></script> <style type="text/css"> .cbRowItem {display:block;} </style> <script type="text/javascript"> $(document).ready(function() { var $chk = $('input:checkbox .cbRowItem'); $chk.click(function() { $chk.removeAttr('checked'); $(this).attr('checked', 'checked'); }); }); </script> </head> <body> <form id="form1" runat="server"> <div style="display:block;"> <asp:CheckBox id="CheckBox1" runat="server" class="cbRowItem" Text = "CheckBox 1"/> <asp:CheckBox id="CheckBox2" runat="server" class="cbRowItem" Text = "CheckBox 2"/> <asp:CheckBox id="CheckBox3" runat="server" class="cbRowItem" Text = "CheckBox 3"/> <asp:CheckBox id="CheckBox4" runat="server" class="cbRowItem" Text = "CheckBox 4"/> </div> </form> </body> </html>

    Read the article

  • September 2011 Release of the Ajax Control Toolkit

    - by Stephen Walther
    I’m happy to announce the release of the September 2011 Ajax Control Toolkit. This release has several important new features including: Date ranges – When using the Calendar extender, you can specify a start and end date and a user can pick only those dates which fall within the specified range. This was the fourth top-voted feature request for the Ajax Control Toolkit at CodePlex. Twitter Control – You can use the new Twitter control to display recent tweets associated with a particular Twitter user or tweets which match a search query. Gravatar Control – You can use the new Gravatar control to display a unique image for each user of your website. Users can upload custom images to the Gravatar.com website or the Gravatar control can display a unique, auto-generated, image for a user. You can download this release this very minute by visiting CodePlex: http://AjaxControlToolkit.CodePlex.com Alternatively, you can execute the following command from the Visual Studio NuGet console: Improvements to the Ajax Control Toolkit Calendar Control The Ajax Control Toolkit Calendar extender control is one of the most heavily used controls from the Ajax Control Toolkit. The developers on the Superexpert team spent the last sprint focusing on improving this control. There are three important changes that we made to the Calendar control: we added support for date ranges, we added support for highlighting today’s date, and we made fixes to several bugs related to time zones and daylight savings. Using Calendar Date Ranges One of the top-voted feature requests for the Ajax Control Toolkit was a request to add support for date ranges to the Calendar control (this was the fourth most voted feature request at CodePlex). With the latest release of the Ajax Control Toolkit, the Calendar extender now supports date ranges. For example, the following page illustrates how you can create a popup calendar which allows a user only to pick dates between March 2, 2009 and May 16, 2009. <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CalendarDateRange.aspx.cs" Inherits="WebApplication1.CalendarDateRange" %> <%@ Register TagPrefix="asp" Namespace="AjaxControlToolkit" Assembly="AjaxControlToolkit" %> <html> <head runat="server"> <title>Calendar Date Range</title> </head> <body> <form id="form1" runat="server"> <asp:ToolkitScriptManager ID="tsm" runat="server" /> <asp:TextBox ID="txtHotelReservationDate" runat="server" /> <asp:CalendarExtender ID="Calendar1" TargetControlID="txtHotelReservationDate" StartDate="3/2/2009" EndDate="5/16/2009" SelectedDate="3/2/2009" runat="server" /> </form> </body> </html> This page contains three controls: an Ajax Control Toolkit ToolkitScriptManager control, a standard ASP.NET TextBox control, and an Ajax Control Toolkit CalendarExtender control. Notice that the Calendar control includes StartDate and EndDate properties which restrict the range of valid dates. The Calendar control shows days, months, and years outside of the valid range as struck out. You cannot select days, months, or years which fall outside of the range. The following video illustrates interacting with the new date range feature: If you want to experiment with a live version of the Ajax Control Toolkit Calendar extender control then you can visit the Calendar Sample Page at the Ajax Control Toolkit Sample Site. Highlighted Today’s Date Another highly requested feature for the Calendar control was support for highlighting today’s date. The Calendar control now highlights the user’s current date regardless of the user’s time zone. Fixes to Time Zone and Daylight Savings Time Bugs We fixed several significant Calendar extender bugs related to time zones and daylight savings time. For example, previously, when you set the Calendar control’s SelectedDate property to the value 1/1/2007 then the selected data would appear as 12/31/2006 or 1/1/2007 or 1/2/2007 depending on the server time zone. For example, if your server time zone was set to Samoa (UTC-11:00), then setting SelectedDate=”1/1/2007” would result in “12/31/2006” being selected in the Calendar. Users of the Calendar extender control found this behavior confusing. After careful consideration, we decided to change the Calendar extender so that it interprets all dates as UTC dates. In other words, if you set StartDate=”1/1/2007” then the Calendar extender parses the date as 1/1/2007 UTC instead of parsing the date according to the server time zone. By interpreting all dates as UTC dates, we avoid all of the reported issues with the SelectedDate property showing the wrong date. Furthermore, when you set the StartDate and EndDate properties, you know that the same StartDate and EndDate will be selected regardless of the time zone associated with the server or associated with the browser. The date 1/1/2007 will always be the date 1/1/2007. The New Twitter Control This release of the Ajax Control Toolkit introduces a new twitter control. You can use the Twitter control to display recent tweets associated with a particular twitter user. You also can use this control to show the results of a twitter search. The following page illustrates how you can use the Twitter control to display recent tweets made by Scott Hanselman: <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TwitterProfile.aspx.cs" Inherits="WebApplication1.TwitterProfile" %> <%@ Register TagPrefix="asp" Namespace="AjaxControlToolkit" Assembly="AjaxControlToolkit" %> <html > <head runat="server"> <title>Twitter Profile</title> </head> <body> <form id="form1" runat="server"> <asp:ToolkitScriptManager ID="tsm" runat="server" /> <asp:Twitter ID="Twitter1" ScreenName="shanselman" runat="server" /> </form> </body> </html> This page includes two Ajax Control Toolkit controls: the ToolkitScriptManager control and the Twitter control. The Twitter control is set to display tweets from Scott Hanselman (shanselman): You also can use the Twitter control to display the results of a search query. For example, the following page displays all recent tweets related to the Ajax Control Toolkit: Twitter limits the number of times that you can interact with their API in an hour. Twitter recommends that you cache results on the server (https://dev.twitter.com/docs/rate-limiting). By default, the Twitter control caches results on the server for a duration of 5 minutes. You can modify the cache duration by assigning a value (in seconds) to the Twitter control's CacheDuration property. The Twitter control wraps a standard ASP.NET ListView control. You can customize the appearance of the Twitter control by modifying its LayoutTemplate, StatusTemplate, AlternatingStatusTemplate, and EmptyDataTemplate. To learn more about the new Twitter control, visit the live Twitter Sample Page. The New Gravatar Control The September 2011 release of the Ajax Control Toolkit also includes a new Gravatar control. This control makes it easy to display a unique image for each user of your website. A Gravatar is associated with an email address. You can visit Gravatar.com and upload an image and associate the image with your email address. That way, every website which uses Gravatars (such as the www.ASP.NET website) will display your image next to your name. For example, I visited the Gravatar.com website and associated an image of a Koala Bear with the email address [email protected]. The following page illustrates how you can use the Gravatar control to display the Gravatar image associated with the [email protected] email address: <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="GravatarDemo.aspx.cs" Inherits="WebApplication1.GravatarDemo" %> <%@ Register TagPrefix="asp" Namespace="AjaxControlToolkit" Assembly="AjaxControlToolkit" %> <html xmlns="http://www.w3.org/1999/xhtml"> <head id="Head1" runat="server"> <title>Gravatar Demo</title> </head> <body> <form id="form1" runat="server"> <asp:ToolkitScriptManager ID="tsm" runat="server" /> <asp:Gravatar ID="Gravatar1" Email="[email protected]" runat="server" /> </form> </body> </html> The page above simply displays the Gravatar image associated with the [email protected] email address: If a user has not uploaded an image to Gravatar.com then you can auto-generate a unique image for the user from the user email address. The Gravatar control supports four types of auto-generated images: Identicon -- A different geometric pattern is generated for each unrecognized email. MonsterId -- A different image of a monster is generated for each unrecognized email. Wavatar -- A different image of a face is generated for each unrecognized email. Retro -- A different 8-bit arcade-style face is generated for each unrecognized email. For example, there is no Gravatar image associated with the email address [email protected]. The following page displays an auto-generated MonsterId for this email address: <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="GravatarMonster.aspx.cs" Inherits="WebApplication1.GravatarMonster" %> <%@ Register TagPrefix="asp" Namespace="AjaxControlToolkit" Assembly="AjaxControlToolkit" %> <html xmlns="http://www.w3.org/1999/xhtml"> <head id="Head1" runat="server"> <title>Gravatar Monster</title> </head> <body> <form id="form1" runat="server"> <asp:ToolkitScriptManager ID="tsm" runat="server" /> <asp:Gravatar ID="Gravatar1" Email="[email protected]" DefaultImageBehavior="MonsterId" runat="server" /> </form> </body> </html> The page above generates the following image automatically from the supplied email address: To learn more about the properties of the new Gravatar control, visit the live Gravatar Sample Page. ASP.NET Connections Talk on the Ajax Control Toolkit If you are interested in learning more about the changes that we are making to the Ajax Control Toolkit then please come to my talk on the Ajax Control Toolkit at the upcoming ASP.NET Connections conference. In the talk, I will present a summary of the changes that we have made to the Ajax Control Toolkit over the last several months and discuss our future plans. Do you have ideas for new Ajax Control Toolkit controls? Ideas for improving the toolkit? Come to my talk – I would love to hear from you. You can register for the ASP.NET Connections conference by visiting the following website: Register for ASP.NET Connections   Summary The previous release of the Ajax Control Toolkit – the July 2011 Release – has had over 100,000 downloads. That is a huge number of developers who are working with the Ajax Control Toolkit. We are really excited about the new features which we added to the Ajax Control Toolkit in the latest September sprint. We hope that you find the updated Calender control, the new Twitter control, and the new Gravatar control valuable when building your ASP.NET Web Forms applications.

    Read the article

1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >