Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
80 views
I've got the following javascript code and a web page with 3 combo boxes (combo1, combo2)

 

function LoadCombo2(combo, eventArqs) {

 

 

        var item = eventArqs.get_item();

 

        _Combo2.set_text(

"Loading...");

 

The above funtion gets fired during combo1's fired OnClientSelectedIndexChanging event, which works fine when the page is initially rendered. But after a 'CancelAll' or cancel command, I get the an error on _Combo2.set_text("Loading...");
In fact, no matter what property or method I try to use for combo2, I get the following javascript error...
        

 

            this.get_element() is null or not an object

Any ideas what is causing this error?  I'm using IE7, RadControls for ASP.NET AJAX Q3 2009

Thanks,
weezie

Veselin Vasilev
Telerik team
 answered on 11 Dec 2009
1 answer
165 views
Hi
I Working on RAD ComboBox with Multiple Selection loading on Demand
I am getting the Data from StoredProc.
RadComboBox1 is getting values from 1StoredProc(CustomerNames);
Problem
RadComboBox2 to has to pop with ID on Demand(Just Like the Ex in Telerik Site)

I used the Example BUT
i unable to get that where i am going wrong
for each and every click(on RadComboBox1) its adding the values(again and again) in RadComboBox2
AND
It is not working basing on CheckBoxs it is working basing the SelectedItem(Click on Item)
plz help me
Where i am going wrong

My Default.CS File

 

using

 

System;

 

 

 

 

using

 

System.Collections.Generic;

 

 

 

 

using

 

System.Linq;

 

 

 

 

using

 

System.Web;

 

 

 

 

using

 

System.Web.UI;

 

 

 

 

using

 

System.Web.UI.WebControls;

 

 

 

 

using

 

System.Data;

 

 

 

 

using

 

System.Data.SqlClient;

 

 

 

 

using

 

Telerik.Web.UI;

 

 

 

 

namespace

 

Combotry

 

{

 

public partial class _Default : System.Web.UI.Page

 

 

 

 

 

{

 

protected void Page_Load(object sender, EventArgs e)

 

{

 

 

if (!Page.IsPostBack)

 

{

 

 

this.RadComboBox1.DataBind();

 

 

this.RadComboBox1.Text = String.Empty;

 

 

//fill the continents combo

 

 

 

 

 

LoadCustomerName();

 

this.Label4.Text = this.RadComboBox1.Text;

 

 

}

}

 

protected void LoadCustomerName()

 

{

 

SqlConnection connection = new SqlConnection("Data Source=vijay;Initial Catalog=TRY;Integrated Security=True");

 

 

SqlDataAdapter adapter = new SqlDataAdapter("usp_GetCustomers", connection);

 

 

DataTable dt = new DataTable();

 

adapter.Fill(dt);

RadComboBox1.DataTextField =

"customerName";

 

RadComboBox1.DataValueField =

"customerid";

 

RadComboBox1.DataSource = dt;

RadComboBox1.DataBind();

 

//insert the first item

 

 

 

 

 

RadComboBox1.Items.Insert(0,

new RadComboBoxItem("- Select Customer -"));

 

 

this.Label4.Text = this.RadComboBox1.Text;

 

 

this.Label4.Text = this.comboValue.Value;

 

 

}

 

protected void LoadStoreID(string customerid)

 

{

 

this.Label4.Text = this.RadComboBox1.Text;

 

 

this.Label4.Text = this.comboValue.Value;

 

 

SqlCommand cmd = new SqlCommand("dbo.StoreID", new SqlConnection("Data Source=vijay;Initial Catalog=TRY;Integrated Security=True"));

 

 

//select a StoreID based on the CustomerID

 

 

 

 

 

 

//SqlDataAdapter adapter = new SqlDataAdapter("dbo.StoreID", cmd);

 

 

 

 

 

 

SqlDataAdapter adapter = new SqlDataAdapter(cmd);

 

cmd.CommandType =

CommandType.StoredProcedure;

 

 

 

//adapter.SelectCommand.Parameters.AddWithValue("@CustomerID", customerid);

 

 

 

 

 

cmd.Parameters.Add(

new SqlParameter("@CustomerID", customerid ));

 

 

DataTable dt = new DataTable();

 

adapter.Fill(dt);

cmd.Connection.Open();

RadComboBox2.DataTextField =

"storeid";

 

RadComboBox2.DataValueField =

"storeid";

 

RadComboBox2.DataSource = dt;

RadComboBox2.DataBind();

 

}

 

protected void LoadStoreName(string storeid)

 

{

 

SqlConnection connection = new SqlConnection("Data Source=vijay;Initial Catalog=TRY;Integrated Security=True");

 

 

//select a StoreID based on the CustomerID

 

 

 

 

 

 

SqlDataAdapter adapter = new SqlDataAdapter("SELECT name FROM StoreMaster WHERE storeid=@storeid", connection);

 

adapter.SelectCommand.Parameters.AddWithValue(

"@storeid", storeid);

 

 

DataTable dt = new DataTable();

 

adapter.Fill(dt);

RadComboBox3.DataTextField =

"Name";

 

RadComboBox3.DataValueField =

"name";

 

RadComboBox3.DataSource = dt;

RadComboBox3.DataBind();

}

 

protected void RadComboBox1_ItemsRequested(object o, RadComboBoxItemsRequestedEventArgs e)

 

{

LoadCustomerName();

 

}

 

protected void RadComboBox2_ItemsRequested(object o, RadComboBoxItemsRequestedEventArgs e)

 

{

 

// e.Text is the first parameter of the requestItems method

 

 

 

 

 

 

// invoked in LoadStoreID method

 

 

 

 

 

LoadStoreID(e.Text );

 

 

}

 

protected void RadComboBox3_ItemsRequested(object o, RadComboBoxItemsRequestedEventArgs e)

 

{

 

// e.Text is the first parameter of the requestItems method

 

 

 

 

 

 

// invoked in LoadStoreName method

 

 

 

 

 

LoadStoreName(e.Text);

}

 

protected void RadComboBox1_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e)

 

{

}

}

}

My .ASPX File

<%

@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Combotry._Default" %>

 

<%

@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %>

 

<!

 

DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

 

<

 

html xmlns="http://www.w3.org/1999/xhtml">

 

<

 

head>

 

<

 

title = "ComboBox"></title>

 

</

 

head>

 

<

 

body >

 

 

<form runat="server" id="mainForm" method="post" style="width: 100%">

 

 

<telerik:RadScriptManager ID="RadScriptManager1" runat="server">

 

 

</telerik:RadScriptManager>

 

 

<script type="text/javascript">

 

 

var supressDropDownClosing = false;

 

 

function OnClientDropDownClosing(sender, eventArgs) {

 

eventArgs.set_cancel(supressDropDownClosing);

}

 

function OnClientSelectedIndexChanging(sender, eventArgs) {

 

eventArgs.set_cancel(supressDropDownClosing);

}

 

function OnClientDropDownOpening(sender, eventArgs) {

 

supressDropDownClosing =

true;

 

}

 

function OnClientBlur(sender) {

 

supressDropDownClosing =

false;

 

sender.toggleDropDown();

}

 

function checkboxClick() {

 

collectSelectedItems();

}

 

function getItemCheckBox(item) {

 

 

//Get the 'div' representing the current RadComboBox Item.

 

 

var itemDiv = item.get_element();

 

 

//Get the collection of all 'input' elements in the 'div' (which are contained in the Item).

 

 

var inputs = itemDiv.getElementsByTagName("input");

 

 

for (var inputIndex = 0; inputIndex < inputs.length; inputIndex++) {

 

 

var input = inputs[inputIndex];

 

 

//Check the type of the current 'input' element.

 

 

if (input.type == "checkbox") {

 

 

return input;

 

}

}

 

return null;

 

}

 

function collectSelectedItems() {

 

 

var combo = $find("<%= RadComboBox1.ClientID %>");

 

 

var items = combo.get_items();

 

 

var selectedItemsTexts = "";

 

 

var selectedItemsValues = "";

 

 

var itemsCount = items.get_count();

 

 

for (var itemIndex = 0; itemIndex < itemsCount; itemIndex++) {

 

 

var item = items.getItem(itemIndex);

 

 

var checkbox = getItemCheckBox(item);

 

 

//Check whether the Item's CheckBox) is checked.

 

 

if (checkbox.checked) {

 

selectedItemsTexts += item.get_text() +

", ";

 

selectedItemsValues += item.get_value() +

", ";

 

}

}

selectedItemsTexts = selectedItemsTexts.substring(0, selectedItemsTexts.length - 2);

selectedItemsValues = selectedItemsValues.substring(0, selectedItemsValues.length - 2);

 

//Set the text of the RadComboBox with the texts of the selected Items, separated by ','.

 

combo.set_text(selectedItemsTexts);

 

//Set the comboValue hidden field value with values of the selected Items, separated by ','.

 

 

//document.getElementById("comboValue").value = selectedItemsValues;

 

 

//Clear the selection that RadComboBox has made internally.

 

 

if (selectedItemsValues == "") {

 

combo.clearSelection();

}

}

 

</script>

 

 

 

<div>

 

 

<asp:Label ID="Label1" runat="server"

 

 

style="z-index: 1; left: 162px; top: 38px; position: absolute; height: 20px; width: 112px">

 

CustomerID

 

</asp:Label>

 

 

<input type="hidden" id="comboValue" value="" runat="server" />

 

 

<telerik:RadComboBox ID="RadComboBox1"

 

 

runat="server"

 

 

OnClientSelectedIndexChanging="LoadCustomerName"

 

 

OnItemsRequested="RadComboBox1_ItemsRequested"

 

 

style="z-index: 1; left: 284px; top: 38px; position: absolute; height: 20px; width: 160px"

 

 

AllowCustomText="True" HighlightTemplatedItems="True"

 

 

onclientdropdownopening="OnClientDropDownOpening"

 

 

OnClientDropDownClosing="OnClientDropDownClosing"

 

 

OnClientBlur="OnClientBlur" DataTextField="CustomerName"

 

 

DataValueField="CustomerID" Skin="Web20">

 

 

<ItemTemplate>

 

 

<asp:CheckBox runat="server" ID="CheckBox" onclick="checkboxClick();" Text='<%# DataBinder.Eval(Container, "Text") %>' />

 

 

</ItemTemplate>

 

 

<CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>

 

 

</telerik:RadComboBox>

 

 

<asp:SqlDataSource ID="DataSourceforCustomers" runat="server"

 

 

ConnectionString="<%$ ConnectionStrings:ULTIMATE_NEWConnectionString %>"

 

 

SelectCommand="usp_GetCustomers" SelectCommandType="StoredProcedure">

 

 

</asp:SqlDataSource>

 

 

<asp:Label ID="Label2" runat="server"

 

 

style="z-index: 1; left: 537px; top: 38px; position: absolute; height: 20px; width: 83px">

 

StoreID:

 

</asp:Label>

 

 

<telerik:RadComboBox ID="RadComboBox2"

 

 

runat="server"

 

 

Width="186px"

 

 

OnClientSelectedIndexChanging="LoadStoreName"

 

 

OnClientItemsRequested="ItemsLoaded"

 

 

OnItemsRequested="RadComboBox2_ItemsRequested"

 

 

style="z-index: 1; left: 634px; top: 38px; position: absolute; height: 20px; width: 160px"

 

 

DataTextField="StoreID" DataValueField="StoreID" Skin="Web20">

 

 

<ItemTemplate>

 

 

<asp:CheckBox runat="server" ID="CheckBox" onclick="checkboxClick();" Text='<%# DataBinder.Eval(Container, "Text") %>' />

 

 

</ItemTemplate>

 

<

 

CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>

 

 

</telerik:RadComboBox>

 

 

<asp:SqlDataSource ID="DataSourceforStoreID" runat="server"

 

 

ConnectionString="<%$ ConnectionStrings:ULTIMATE_NEWConnectionString %>"

 

 

SelectCommand="StoreID" SelectCommandType="StoredProcedure">

 

 

<SelectParameters>

 

 

<asp:ControlParameter ControlID="RadComboBox1" Name="CustomerID"

 

 

PropertyName="SelectedValue" Type="String" />

 

 

</SelectParameters>

 

 

</asp:SqlDataSource>

 

 

<asp:Label ID="Label3" runat="server"

 

 

style="z-index: 1; left: 907px; top: 38px; position: absolute; height: 20px; width: 103px; right: 599px;">

 

StoreName:

 

</asp:Label>

 

 

<telerik:RadComboBox ID="RadComboBox3"

 

 

runat="server"

 

 

Width="186px"

 

 

OnClientItemsRequested="ItemsLoaded"

 

 

OnItemsRequested="RadComboBox3_ItemsRequested"

 

 

style="z-index: 1; left: 1024px; top: 38px; position: absolute; height: 20px; width: 160px" Skin="Web20">

 

<

 

CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>

 

 

</telerik:RadComboBox>

 

 

</div>

 

 

<script type="text/javascript">

 

 

//global variables for the countries and cities comboboxes

 

 

var StoreIDCombo;

 

 

var StoreNameCombo;

 

 

function pageLoad() {

 

 

// initialize the global variables

 

 

// in this event all client objects

 

 

// are already created and initialized

 

StoreIDCombo = $find(

"<%= RadComboBox2.ClientID %>");

 

StoreNameCombo = $find(

"<%= RadComboBox3.ClientID %>");

 

}

 

 

function LoadCustomerName(combo, eventArqs) {

 

 

var item = eventArqs.get_item();

 

StoreIDCombo.set_text(

"Loading...");

 

StoreNameCombo.clearSelection();

 

// if a continent is selected

 

 

if (item.get_index() > 0) {

 

 

// this will fire the ItemsRequested event of the

 

 

// StoreID combobox passing the CustomerName as a parameter

 

StoreIDCombo.requestItems(item.get_value(), checkboxClick);

}

 

if (checkbox.checked) {

 

selectedItemsTexts += item.get_text() +

", ";

 

selectedItemsValues += item.get_value() +

", ";

 

}

 

}

 

function LoadStoreName(combo, eventArqs) {

 

 

var item = eventArqs.get_item();

 

StoreNameCombo.set_text(

"Loading...");

 

 

// this will fire the ItemsRequested event of the

 

 

// StoreName combobox passing the StoreID as a parameter

 

StoreNameCombo.requestItems(item.get_value(),

false );

 

}

 

function ItemsLoaded(combo, eventArqs) {

 

 

if (combo.get_items().get_count() > 0) {

 

 

// pre-select the first item

 

combo.set_text(combo.get_items().getItem(0).get_text());

combo.get_items().getItem(0).highlight();

}

combo.showDropDown();

}

 

function collectSelectedItems() {

 

 

var combo =$find ("<%= RadComboBox1.ClientID %>");

 

 

var items = combo.get_items();

 

 

var selectedItemsTexts = "";

 

 

var selectedItemsValues = "";

 

 

var itemsCount = items.get_count();

 

 

for (var itemIndex = 0; itemIndex < itemsCount; itemIndex++) {

 

 

var item = items.getItem(itemIndex);

 

 

var checkbox = getItemCheckBox(item);

 

 

//Check whether the Item's CheckBox) is checked.

 

 

if (checkbox.checked) {

 

selectedItemsTexts += item.get_text() +

", ";

 

selectedItemsValues += item.get_value() +

", ";

 

}

}

selectedItemsTexts = selectedItemsTexts.substring(0, selectedItemsTexts.length - 2);

selectedItemsValues = selectedItemsValues.substring(0, selectedItemsValues.length - 2);

 

//Set the text of the RadComboBox with the texts of the selected Items, separated by ','.

 

combo.set_text(selectedItemsTexts);

 

//Set the comboValue hidden field value with values of the selected Items, separated by ','.

 

}

 

</script>

 

 

<p>

 

 

&nbsp;</p>

 

 

 

<asp:Label ID="Label4" runat="server"

 

 

style="z-index: 1; left: 10px; top: 95px; position: absolute; height: 149px; width: 418px"

 

 

Text="Label"></asp:Label>

 

 

 

</form>

 

</

 

body>

 

</

 

html>

 

Test Test
Top achievements
Rank 1
 answered on 11 Dec 2009
3 answers
272 views
I have a tooltip right above an asp button that I would like to use as a notification when an update is successful. However, I set the toolTip.visible to true and the tooltip never shows. Any ideas why? Here is my aspx
<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/admin/Admin.Master"
    CodeBehind="EditEntity.aspx.vb" Inherits="ClickableCommunity.EditEntity" %>

<%@ Register Assembly="RadMenu" Namespace="Telerik.WebControls" TagPrefix="radM" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <telerik:RadScriptBlock ID="ScriptBlock1" runat="server">

        <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;sensor=false&amp;key=ABQIAAAANvmC5YwARPSDAHoiTGyjXRSmfv2uK-bEd6eXTQY7EyaTpVn3FxSr013tT5OlQzrX6y2uOmRLFFdYTw"
            type="text/javascript"></script>

        <script type="text/javascript">
            var map;
            var geocoder;
            globalLat = 40.7001;
            globalLon = -99.0844;

            function map_initialize() {

                //if the browser is compatible with the gmap api
                if (GBrowserIsCompatible()) {

                    //initialize the map
                    map = new GMap2(document.getElementById('entityMap'));

                    //add the controls
                    map.addControl(new GLargeMapControl());
                    map.addControl(new GMenuMapTypeControl());
                    map.setCenter(new GLatLng(globalLat, globalLon), 15);

                    //enable the zooming
                    map.enableDoubleClickZoom();
                    map.enableScrollWheelZoom();

                    //add the marker and set the drag to true
                    globalMarker = new GMarker(map.getCenter(), { draggable: true });

                    //these should get the object of the rad textbox
                    var templat = $find('<%= latInput.ClientID %>');
                    var templon = $find('<%= lonInput.ClientID %>');

                    //if they drag the marker
                    GEvent.addListener(globalMarker, 'dragend',

                        function(p) {
                            map.panTo(p);

                            //set the textboxes to the latitude and long
                            templat.set_value(map.getCenter().lat().toFixed(6));
                            templon.set_value(map.getCenter().lng().toFixed(6));

                        } //function(p)

                    ); //GEvent.addListener

                    //add the marker
                    map.addOverlay(globalMarker);

                    //add the geocoder
                    geocoder = new GClientGeocoder();

                } //if gbrowsercompatible

            } //map_initialize

            function map_geocode(address) {
                geocoder.getLatLng(address,
                        function(p) {

                            if (p) {
                                map.panTo(p);
                            } //if (p)

                            else {
                                alert('Sorry, the geocoder failed to locate the specified address :-(');
                            } //else
                        } //function
                    ); //geocoder.getLatLng
            } //map_geocode

            GEvent.addDomListener(window, 'load', map_initialize);

            //this function will get the latitude and longitude
            //for a given address and set a tool tip to visible
            //if it can't find the address.
            function getLatLon(sender, args) {

                //we only do something if the over ride button
                //is not checked
                var street = $find('<%= streetInput.ClientID %>').get_value();
                var city = $find('<%= cityInput.ClientID %>').get_value();
                var state = $find('<%= stateInput.ClientID %>').get_value();
                var zip = $find('<%= zipInput.ClientID %>').get_value();
                var address = (street + ", " + city + " " + zip);

                geocodeAddress(address);
            } //getLatLon

            //this function takes in an address and returns
            //the lattitude and longitude.
            function geocodeAddress(address) {
                var coder = new GClientGeocoder();
                coder.getLatLng(address,
                              function(point) {
                                  //the id of the tool tip
                                  var toolTip = $find("<%= cantFindLocation.ClientID %>");
                                  if (!point) {

                                      //show the tool tip if it is hidden
                                      if (!toolTip.isVisible()) {
                                          toolTip.show();
                                      } //if
                                      //the tool tip is showing and the clicked the link
                                      else {
                                          toolTip.set_text("Still no dice, <a href=\"#\" onclick=\"getLatLon()\">" +
                                                           "try again</a> or get them <a href=\"" +
                                                           "http://itouchmap.com/latlong.html\" target=\"_blank\"" +
                                                           ">manually</a>.");
                                      } //else
                                  } //if
                                  //we set the textboxes to their values
                                  else {

                                      //reset the global lat and long
                                      //and call the function to reload
                                      //the map
                                      var templat = $find('<%= latInput.ClientID %>');
                                      var templon = $find('<%= lonInput.ClientID %>');
                                      templat.set_value(point.lat());
                                      templon.set_value(point.lng());
                                      globalLat = point.lat();
                                      globalLon = point.lng();
                                      map_initialize();

                                      //hide the tooltip if its showing
                                      if (toolTip.isVisible()) {
                                          toolTip.hide();
                                      }

                                  } //else
                              } //function(point)
                            );
            } //geocodeAddress
        </script>

    </telerik:RadScriptBlock>
    <style type="text/css">
        .radfdSkinnedFormButton radfd_Web20
        {
            text-align: center !important;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="header" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">
    <telerik:RadFormDecorator ID="decorator" Skin="Web20" DecoratedControls="Buttons"
        runat="server" />
    <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" LoadingPanelID="RadAjaxLoadingPanel1">
        <table class="entityTable">
            <tr>
                <td width="410px">
                    <table>
                        <tr>
                            <td class="tableColumn">
                                <center>
                                    <span class="adminTableLabel">Select Entity</span>
                                    <telerik:RadComboBox ID="businessNameDrop" runat="server" Skin="Web20" Width="150px"
                                        MarkFirstMatch="True" DropDownWidth="150px" CssClass="stateDropDownText" Font-Size="16px"
                                        AutoPostBack="true">
                                        <CollapseAnimation Duration="1000" Type="InOutBack" />
                                    </telerik:RadComboBox>
                                    <asp:SqlDataSource ID="businessDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:connectionString %>"
                                        SelectCommand="getAllBusinesses" SelectCommandType="StoredProcedure"></asp:SqlDataSource>
                                </center>
                            </td>
                            <td class="addBusinessSpacing">
                            </td>
                            <td class="tableColumn">
                                <center>
                                    <span class="adminTableLabel">Entity Name</span>
                                    <telerik:RadTextBox ID="entityNameInput" runat="server" Skin="Web20" Width="150px">
                                    </telerik:RadTextBox>
                                </center>
                            </td>
                        </tr>
                        <tr>
                            <td class="tableColumn">
                                <center>
                                    <span class="adminTableLabel">Category</span>
                                    <telerik:RadComboBox ID="categoryDrop" runat="server" Skin="Web20" Width="150px"
                                        MarkFirstMatch="True" DropDownWidth="150px" CssClass="stateDropDownText" Font-Size="16px"
                                        DataSourceID="categoriesDataSource" DataTextField="name" DataValueField="categoryid">
                                        <CollapseAnimation Duration="1000" Type="InOutBack" />
                                    </telerik:RadComboBox>
                                    <asp:SqlDataSource ID="categoriesDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:connectionString %>"
                                        SelectCommand="getAllAttractionCategories" SelectCommandType="StoredProcedure"></asp:SqlDataSource>
                                </center>
                            </td>
                            <td class="addBusinessSpacing">
                            </td>
                            <td>
                                <span class="adminTableLabel">Description</span>
                                <center>
                                    <table>
                                        <tr>
                                            <td>
                                                <telerik:RadTextBox ID="descInput" runat="server" Skin="Web20" Height="150px" Width="150px"
                                                    Wrap="true" TextMode="MultiLine">
                                                </telerik:RadTextBox>
                                            </td>
                                        </tr>
                                    </table>
                                </center>
                            </td>
                        </tr>
                        <tr>
                            <td class="tableColumn">
                                <center>
                                    <span class="adminTableLabel">Street Address</span>
                                    <telerik:RadTextBox ID="streetInput" runat="server" Skin="Web20" Width="150px">
                                    </telerik:RadTextBox>
                                </center>
                            </td>
                            <td class="addBusinessSpacing">
                            </td>
                            <td class="tableColumn">
                                <center>
                                    <span class="adminTableLabel">City</span>
                                    <telerik:RadTextBox ID="cityInput" runat="server" Skin="Web20" Width="150px">
                                    </telerik:RadTextBox>
                                </center>
                            </td>
                            <td class="tableColumn">
                                <telerik:RadToolTip runat="server" ID="overRideTip" Skin="Web20" Height="60px" Width="250px"
                                    Position="TopRight" RelativeTo="Element" TargetControlID="overRide" AutoCloseDelay="5000"
                                    IsClientID="true">
                                    <span class="normalText">Check this if you would like to enter the latitude and longitude
                                        manually.</span>
                                </telerik:RadToolTip>
                            </td>
                        </tr>
                        <tr>
                            <td class="tableColumn">
                                <center>
                                    <span class="adminTableLabel">State</span>
                                    <telerik:RadComboBox ID="stateInput" runat="server" Skin="Web20" Width="150px" ChangeTextOnKeyBoardNavigation="true"
                                        MarkFirstMatch="true" DropDownWidth="150px" CssClass="stateDropDownText" Font-Size="16px">
                                        <CollapseAnimation Duration="1000" Type="InOutBack" />
                                        <Items>
                                            <telerik:RadComboBoxItem Text="Alabama" Value="AL" CssClass="stateDropDownText" />
                                            <telerik:RadComboBoxItem Text="Alaska" Value="AK" CssClass="stateDropDownText" />
                                            <telerik:RadComboBoxItem Text="Arizona" Value="AZ" CssClass="stateDropDownText" />
                                            <telerik:RadComboBoxItem Text="Arkansas" Value="AR" CssClass="stateDropDownText" />
                                            <telerik:RadComboBoxItem Text="California" Value="CA" CssClass="stateDropDownText" />
                                            <telerik:RadComboBoxItem Text="Colorado" Value="CO" CssClass="stateDropDownText" />
                                            <telerik:RadComboBoxItem Text="Connecticut" Value="CT" CssClass="stateDropDownText" />
                                            <telerik:RadComboBoxItem Text="Delaware" Value="DE" CssClass="stateDropDownText" />
                                            <telerik:RadComboBoxItem Text="District Of Columbia" Value="DC" CssClass="stateDropDownText" />
                                            <telerik:RadComboBoxItem Text="Florida" Value="FL" CssClass="stateDropDownText" />
                                            <telerik:RadComboBoxItem Text="Georgia" Value="GA" CssClass="stateDropDownText" />
                                            <telerik:RadComboBoxItem Text="Hawaii" Value="HI" CssClass="stateDropDownText" />
                                            <telerik:RadComboBoxItem Text="Idaho" Value="ID" CssClass="stateDropDownText" />
                                            <telerik:RadComboBoxItem Text="Illinois" Value="IL" CssClass="stateDropDownText" />
                                            <telerik:RadComboBoxItem Text="Indiana" Value="IN" CssClass="stateDropDownText" />
                                            <telerik:RadComboBoxItem Text="Iowa" Value="IA" CssClass="stateDropDownText" />
                                            <telerik:RadComboBoxItem Text="Kansas" Value="KS" CssClass="stateDropDownText" />
                                            <telerik:RadComboBoxItem Text="Kentucky" Value="KY" CssClass="stateDropDownText" />
                                            <telerik:RadComboBoxItem Text="Louisiana" Value="LA" CssClass="stateDropDownText" />
                                            <telerik:RadComboBoxItem Text="Maine" Value="ME" CssClass="stateDropDownText" />
                                            <telerik:RadComboBoxItem Text="Maryland" Value="MD" CssClass="stateDropDownText" />
                                            <telerik:RadComboBoxItem Text="Massachusetts" Value="MA" CssClass="stateDropDownText" />
                                            <telerik:RadComboBoxItem Text="Michigan" Value="MI" CssClass="stateDropDownText" />
                                            <telerik:RadComboBoxItem Text="Minnesota" Value="MN" CssClass="stateDropDownText" />
                                            <telerik:RadComboBoxItem Text="Mississippi" Value="MS" CssClass="stateDropDownText" />
                                            <telerik:RadComboBoxItem Text="Missouri" Value="MO" CssClass="stateDropDownText" />
                                            <telerik:RadComboBoxItem Text="Montana" Value="MT" CssClass="stateDropDownText" />
                                            <telerik:RadComboBoxItem Text="Nebraska" Value="NE" CssClass="stateDropDownText"
                                                Selected="true" />
                                            <telerik:RadComboBoxItem Text="Nevada" Value="NV" CssClass="stateDropDownText" />
                                            <telerik:RadComboBoxItem Text="New Hampshire" Value="NH" CssClass="stateDropDownText" />
                                            <telerik:RadComboBoxItem Text="New Jersey" Value="NJ" CssClass="stateDropDownText" />
                                            <telerik:RadComboBoxItem Text="New Mexico" Value="NM" CssClass="stateDropDownText" />
                                            <telerik:RadComboBoxItem Text="New York" Value="NY" CssClass="stateDropDownText" />
                                            <telerik:RadComboBoxItem Text="North Carolina" Value="NC" CssClass="stateDropDownText" />
                                            <telerik:RadComboBoxItem Text="North Dakota" Value="ND" CssClass="stateDropDownText" />
                                            <telerik:RadComboBoxItem Text="Ohio" Value="OH" CssClass="stateDropDownText" />
                                            <telerik:RadComboBoxItem Text="Oklahoma" Value="OK" CssClass="stateDropDownText" />
                                            <telerik:RadComboBoxItem Text="Oregon" Value="OR" CssClass="stateDropDownText" />
                                            <telerik:RadComboBoxItem Text="Pennsylvania" Value="PA" CssClass="stateDropDownText" />
                                            <telerik:RadComboBoxItem Text="Rhode Island" Value="RI" CssClass="stateDropDownText" />
                                            <telerik:RadComboBoxItem Text="South Carolina" Value="SC" CssClass="stateDropDownText" />
                                            <telerik:RadComboBoxItem Text="South Dakota" Value="SD" CssClass="stateDropDownText" />
                                            <telerik:RadComboBoxItem Text="Tennessee" Value="TN" CssClass="stateDropDownText" />
                                            <telerik:RadComboBoxItem Text="Texas" Value="TX" CssClass="stateDropDownText" />
                                            <telerik:RadComboBoxItem Text="Utah" Value="UT" CssClass="stateDropDownText" />
                                            <telerik:RadComboBoxItem Text="Vermont" Value="VT" CssClass="stateDropDownText" />
                                            <telerik:RadComboBoxItem Text="Virginia" Value="VA" CssClass="stateDropDownText" />
                                            <telerik:RadComboBoxItem Text="Washington" Value="WA" CssClass="stateDropDownText" />
                                            <telerik:RadComboBoxItem Text="West Virginia" Value="WV" CssClass="stateDropDownText" />
                                            <telerik:RadComboBoxItem Text="Wisconsin" Value="WI" CssClass="stateDropDownText" />
                                            <telerik:RadComboBoxItem Text="Wyoming" Value="WY" CssClass="stateDropDownText" />
                                        </Items>
                                    </telerik:RadComboBox>
                                </center>
                            </td>
                            <td class="addBusinessSpacing">
                            </td>
                            <td class="tableColumn">
                                <center>
                                    <span class="adminTableLabel">Zip</span>
                                    <telerik:RadTextBox ID="zipInput" runat="server" Skin="Web20" Width="150px">
                                    </telerik:RadTextBox>
                                    <asp:RegularExpressionValidator ID="reZipCode" ControlToValidate="zipInput" ValidationExpression="^((\d{5}){1}|^(\d{5}-\d{4}){1}){1}"
                                        ErrorMessage="Please enter a valid zip code." Display="Dynamic" runat="server"
                                        CssClass="errorMessage" />
                                    <telerik:RadToolTip runat="server" ID="cantFindLocation" Skin="Web20" Height="100px"
                                        Width="400px" ManualClose="true" Position="TopRight" RelativeTo="Element" TargetControlID="streetInput">
                                        <span class="normalText">I can't find the address you specified. Please make sure that
                                            it is typed in correctly. If you would like to manually find the latitude and longitude,
                                            go to <a href="http://itouchmap.com/latlong.html" target="_blank">here</a> and get
                                            the coordinates. <a href="#" onclick="getLatLon()">Look Again</a> </span>
                                    </telerik:RadToolTip>
                                </center>
                            </td>
                        </tr>
                        <tr>
                            <td class="tableColumn">
                                <center>
                                    <span class="adminTableLabel">Latitude</span>
                                    <telerik:RadTextBox ID="latInput" runat="server" Skin="Web20" Width="150px">
                                    </telerik:RadTextBox>
                                </center>
                            </td>
                            <td class="addBusinessSpacing">
                            </td>
                            <td class="tableColumn">
                                <center>
                                    <span class="adminTableLabel">Longitude</span>
                                    <telerik:RadTextBox ID="lonInput" runat="server" Skin="Web20" Width="150px">
                                    </telerik:RadTextBox>
                                </center>
                            </td>
                            <td class="tableColumn">
                                <a href="#" onclick="getLatLon()" style="font-size: 11px; font-family: Arial;">Find
                                    on map </a>
                            </td>
                        </tr>
                        <tr>
                            <td class="tableColumn">
                                <center>
                                    <span class="adminTableLabel">Website</span>
                                    <telerik:RadTextBox ID="siteInput" runat="server" Skin="Web20" Width="150px">
                                    </telerik:RadTextBox>
                                </center>
                            </td>
                            <td class="addBusinessSpacing">
                            </td>
                            <td class="tableColumn">
                                <center>
                                    <span class="adminTableLabel">Phone Number</span>
                                    <telerik:RadTextBox ID="phoneInput" runat="server" Skin="Web20" Width="150px">
                                    </telerik:RadTextBox>
                                </center>
                            </td>
                        </tr>
                    </table>
                    <table>
                        <tr>
                            <td>
                                <table style="margin-left: 140px">
                                    <tr>
                                        <td>
                                            <telerik:RadToolTip ID="toolTip" Skin="Web20"
                                                Position="TopRight" runat="server" Height="100" Width="300"
                                                RelativeTo="Element" HideDelay="25"
                                                TargetControlID="addEntity" VisibleOnPageLoad="false">
                                                </telerik:RadToolTip>
                                            <asp:Button ID="addEntity" runat="server" Text="Change" /><br />
                                        </td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <center>
                                    <asp:Label ID="output" runat="server" Text=""></asp:Label></center>
                            </td>
                        </tr>
                    </table>
                </td>
                <td class="entityMapClass">
                    <div id="entityMap">
                    </div>
                </td>
            </tr>
        </table>
        <asp:SqlDataSource ID="usersDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:connectionString %>"
            SelectCommand="returnAllNonAdminUsers" SelectCommandType="StoredProcedure"></asp:SqlDataSource>
        <asp:Label Style="visibility: hidden;" ID="hiddenJs" runat="server" Text=""></asp:Label>
    </telerik:RadAjaxPanel>
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" SkinID="Web20"
        Height="75px" Transparency="10" BackgroundPosition="Center">
        <img alt="Loading..." src='<%= RadAjaxLoadingPanel.GetWebResourceUrl(Page, "Telerik.Web.UI.Skins.Default.Ajax.LoadingProgressBar.gif") %>'
            style="border: 0px;" />
    </telerik:RadAjaxLoadingPanel>
</asp:Content>

And here is my vb
Imports System.Data
Imports System.Data.Sql
Imports System.Data.SqlClient
Imports Telerik.Web.UI

Partial Public Class EditEntity
    Inherits System.Web.UI.Page

    'my connection string
    Dim conn As String = System.Configuration.ConfigurationManager.ConnectionStrings("connectionString").ToString

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        'populate the dropdown
        Dim tableOfData As DataTable = createTable()
        businessNameDrop.DataSource = tableOfData
        businessNameDrop.DataTextField = "text"
        businessNameDrop.DataValueField = "id"
        businessNameDrop.DataBind()

    End Sub

    'this fires when they change the business name drop down box
    Private Sub businessNameDrop_SelectedIndexChanged(ByVal o As Object, ByVal e As Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs) Handles businessNameDrop.SelectedIndexChanged

        If (businessNameDrop.Text <> "- Please Select -") Then

            'the id
            Dim entityId As Integer = businessNameDrop.SelectedValue

            'set the entity name to the name
            entityNameInput.Text = businessNameDrop.SelectedItem.Text

            'my sql connection
            Dim myConn As New Data.SqlClient.SqlConnection(conn)

            'the name of the stored procedure
            Dim strSQL = "getEntityInfo"

            Dim returnCommand As New Data.SqlClient.SqlCommand(strSQL, myConn)

            'add the parameters
            returnCommand.Parameters.AddWithValue("@entityId", entityId)

            'tell the system it is a stored procedure
            returnCommand.CommandType = CommandType.StoredProcedure

            Try
                myConn.Open()
                Dim dr As SqlDataReader = returnCommand.ExecuteReader()

                While dr.Read()

                    'set all of the textboxes to the input
                    streetInput.Text = dr.Item(0).ToString
                    cityInput.Text = dr.Item(1).ToString
                    stateInput.SelectedValue = dr.Item(2).ToString
                    zipInput.Text = dr.Item(3).ToString
                    latInput.Text = dr.Item(4).ToString
                    lonInput.Text = dr.Item(5).ToString
                    phoneInput.Text = dr.Item(6).ToString
                    siteInput.Text = dr.Item(7).ToString
                    descInput.Text = dr.Item(8).ToString
                    categoryDrop.SelectedValue = dr.Item(9)

                End While 'while dr.read()

            Catch ex As Exception

                output.Text = ("<span class='textRed'>There was an error in retrieving the entity information,<br>" & _
                               " please contact the system administrator if the problem persists.</span>")

            End Try

        End If 'if businessNameDrop.text

    End Sub

    'if they click the add button
    Protected Sub addEntity_Click(ByVal sender As Object, ByVal e As EventArgs) Handles AddEntity.Click

        'a boolean if the form submission was successful
        Dim success As Boolean = True

        'all of the user input
        Dim entityId As Integer = businessNameDrop.SelectedValue
        Dim entityName As String = entityNameInput.Text
        Dim street As String = streetInput.Text
        Dim city As String = cityInput.Text
        Dim state As String = stateInput.SelectedValue
        Dim website As String = siteInput.Text
        Dim phone As String = phoneInput.Text
        Dim zip As Integer = CInt(zipInput.Text)
        Dim lat As String = CDbl(latInput.Text)
        Dim lon As String = CDbl(lonInput.Text)
        Dim fkCatId As Integer = categoryDrop.SelectedValue
        Dim desc As String = descInput.Text

        'my sql connection
        Dim myConn As New Data.SqlClient.SqlConnection(conn)

        'the name of the stored procedure
        Dim strSQL = "updateEntity"

        Dim insertCommand As New Data.SqlClient.SqlCommand(strSQL, myConn)

        'add all of the parameters
        insertCommand.Parameters.AddWithValue("@entityId", entityId)
        insertCommand.Parameters.AddWithValue("@entityName", entityName)
        insertCommand.Parameters.AddWithValue("@street", street)
        insertCommand.Parameters.AddWithValue("@city", city)
        insertCommand.Parameters.AddWithValue("@state", state)
        insertCommand.Parameters.AddWithValue("@zip", zip)
        insertCommand.Parameters.AddWithValue("@lat", lat)
        insertCommand.Parameters.AddWithValue("@lon", lon)
        insertCommand.Parameters.AddWithValue("@phone", phone)
        insertCommand.Parameters.AddWithValue("@website", website)
        insertCommand.Parameters.AddWithValue("@desc", desc)
        insertCommand.Parameters.AddWithValue("@fkCatId", fkCatId)

        'tell the system its a stored procedure
        insertCommand.CommandType = CommandType.StoredProcedure

        Try
            myConn.Open()
            insertCommand.ExecuteNonQuery()
        Catch ex As Exception
            toolTip.Text = "<span style='color:red;'>There was an error in adding the Place.<br>" & _
                          "Please contact the system administrator if the problem persists. "
            'output.Text = ex.ToString
            toolTip.Visible = True
            success = False
        Finally
            myConn.Close()
        End Try

        If (success) Then

            toolTip.Visible = True
            toolTip.Text = "<span class='successText'>The entity was successfully updated.</span>"

        End If
    End Sub
    'this sub returns a data table to bind to the dropdown
    Private Function createTable()

        'a new data table
        Dim table As DataTable = New DataTable()
        table.Columns.Add("id")
        table.Columns.Add("text")

        'my sql connection
        Dim myConn As New Data.SqlClient.SqlConnection(conn)

        'the name of the stored procedure
        Dim strSQL = "getAllBusinesses"

        'add the initial - Please Select -
        table.Rows.Add(New String() {"-1", "- Please Select -"})

        Try

            myConn.Open()
            Dim readCommand As New Data.SqlClient.SqlCommand(strSQL, myConn)

            'while we have rows from the stored procedure
            'we will add them to a data table
            Dim cdr As SqlDataReader = readCommand.ExecuteReader()
            While cdr.Read()

                If (cdr.Item(0).ToString <> "") Then

                    table.Rows.Add(New String() {cdr.Item(0), cdr.Item(1)})

                End If

            End While 'while cdr.Read()

        Catch ex As Exception
            output.Text = "There was an internal error. Please reload the page.<br>" & _
                        "If the problem persists, contact the system administrator"
        End Try
        myConn.Close()

        Return table

    End Function 'createTable
End Class

Thanks,
Svetlina Anati
Telerik team
 answered on 11 Dec 2009
3 answers
128 views
is there a way to assign the skin to templated controls based on the parent controls skin? or is there an eay way to assign the skin based on formdecorator?
Dimo
Telerik team
 answered on 11 Dec 2009
2 answers
214 views
Hi All,

I have a FileUpload control in radgrid edit itmetemplate,
but i am not able to access the file in c# by doing FUDoc = (FileUpload)e.Items.FindControl("RadUpload1") always this code return null.

please helpme regarding this.
PM
Top achievements
Rank 1
 answered on 11 Dec 2009
2 answers
178 views
Hi Guys,

I want to implement Grid / Virtual Scrolling and Paging without Rad Ajax Manager. On the site of telerik all the demos made with the help of red Ajax Manager. But i have a constraint i cannt use rad ajax manager. i am  using script manager of ajax.

How to implement Grid / Virtual Scrolling and Paging with script manager?????????

Thanks in advance.


Please do reply ASAP.
Yavor
Telerik team
 answered on 11 Dec 2009
1 answer
142 views
Hi,

I converted existing ajax ModalPopupExtender window to rad window. The existing page had a ajax felexbox(jquery) ,after i convert to rad window it disappears.

Any help.

Thanks.
Eva
Georgi Tunev
Telerik team
 answered on 11 Dec 2009
1 answer
254 views
Hi there,

I am loading UserControls dynamically onto my Page as shown in your Samples. Now I have a problem with following Setup:

<Page>
 <ContentPanel>
    <UserControl A>
          <Repeater>
               <User Control B>
                       <DIV id=container runat=server>
                                 <Button1>  ( OnClick= Should replace Dynamic User Control A with another Control)
                                 <Button2>  ( OnClick= Update "container")
                       <DIV runat=server>                
               <User Control B>
               .
               .
          </Repeater>
    </UserControl A>
 <ContentPanel>
</Page>

The problem now is that nothing gets updated if I press Button1. All events on the server side occur as expected. In the Button1 click event I load the new User Control into the ContentPanel (which is ajaxified with RadAjaxManager).

If I move Button1 above the container all works as expected (because the whole ContentPanel is ajaxified as far as I know) . Only if I put the button into the div container which is ajaxified with Button2 this doesn't work. Am I missing something or doing something wrong?
Veli
Telerik team
 answered on 11 Dec 2009
9 answers
386 views
Hi,

We are trying to display a RadGrid with horizontal scroll bar as we have sevreal number of coulns to display.Iam generating the RadGrid programatically with dynamic columns.When i set the width of the Radgrid and also the columns in pixels iam able to see the horizonatal scrollbar. But we need to set the width in percentage,but it doesn't show the horizontal scrollbar.
Below is the code to create the radgrid

private

 

void DefineRadGridMarketsStructure()

 

{

 

object objDbId = SessionManager.GetSessionObject("INSTR_ID");

 

 

if (objDbId != null)

 

{

_dbId = (

int)objDbId;

 

}

 

grid =

new RadGrid();

 

grid.ID =

"radGridMarkets";

 

 

//grid.DataSourceID = "objContDSMarkets";

 

grid.AutoGenerateColumns =

false;

 

grid.AllowSorting =

true;

 

grid.AllowMultiRowSelection =

true;

 

grid.AllowMultiRowEdit =

true;

 

 

grid.GridLines =

GridLines.None;

 

grid.Height =

Unit.Pixel(400);

 

grid.Width =

Unit.Percentage(100);

 

grid.AllowPaging =

true;

 

grid.PageSize = 1000;

grid.GroupingSettings.CaseSensitive =

false;

 

grid.EnableLinqExpressions =

false;

 

 

String htmlColor = "#EDEFF1";

 

 

Color backColor = ColorTranslator.FromHtml(htmlColor);

 

grid.AlternatingItemStyle.BackColor = backColor;

 

String editColor = "#A2A2A2";

 

 

Color editbackColor = ColorTranslator.FromHtml(editColor);

 

grid.EditItemStyle.BackColor = editbackColor;

grid.EditItemStyle.Font.Name =

"arial";

 

grid.EditItemStyle.Font.Size =

new FontUnit("11px");

 

 

//grid.BorderColor = Color.Blue;

 

grid.MasterTableView.Width =

Unit.Percentage(100);

 

grid.MasterTableView.AllowFilteringByColumn =

true;

 

grid.MasterTableView.AllowPaging =

true;

 

grid.MasterTableView.PagerStyle.AlwaysVisible =

true;

 

grid.MasterTableView.PagerStyle.Position =

GridPagerPosition.TopAndBottom;

 

grid.MasterTableView.PagerStyle.Mode =

GridPagerMode.NextPrevNumericAndAdvanced;

 

 

grid.ClientSettings.AllowKeyboardNavigation =

true;

 

grid.ClientSettings.Selecting.AllowRowSelect =

true;

 

grid.ClientSettings.Scrolling.AllowScroll =

true;

 

grid.ClientSettings.Scrolling.UseStaticHeaders =

true;

 

grid.ClientSettings.Resizing.AllowColumnResize =

true;

 

grid.ClientSettings.Resizing.AllowRowResize =

true;

 

grid.ClientSettings.Resizing.ResizeGridOnColumnResize =

true;

 

grid.ClientSettings.Resizing.EnableRealTimeResize =

true;

 

grid.ClientSettings.Scrolling.ScrollHeight =

Unit.Pixel(320);

 

 

grid.FilterMenu.EnableTheming =

true;

 

grid.FilterMenu.CollapseAnimation.Duration = 200;

grid.FilterMenu.CollapseAnimation.Type =

AnimationType.OutQuint;

 

 

//Add Master table

 

grid.MasterTableView.Name =

"Market";

 

grid.MasterTableView.PageSize = 1000;

 

grid.MasterTableView.EditMode =

GridEditMode.InPlace;

 

grid.MasterTableView.TableLayout =

GridTableLayout.Fixed;

 

 

GridClientSelectColumn col0 = new GridClientSelectColumn();

 

col0.UniqueName =

"marketcheckBoxColumn";

 

grid.MasterTableView.Columns.Add(col0);

grid.MasterTableView.Columns[0].HeaderStyle.Width =

Unit.Percentage(10);

 

grid.MasterTableView.Columns[0].ItemStyle.Width =

Unit.Percentage(10);

 

 

//grid.MasterTableView.Columns[0].HeaderStyle.HorizontalAlign = HorizontalAlign.Center;

 

 

//grid.MasterTableView.Columns[0].ItemStyle.HorizontalAlign = HorizontalAlign.Center;

 

 

GridEditCommandColumn col1 = new GridEditCommandColumn();

 

col1.ButtonType =

GridButtonColumnType.ImageButton;

 

col1.UpdateImageUrl =

"../images/Update.gif";

 

col1.EditImageUrl =

"../images/Edit.gif";

 

col1.InsertImageUrl =

"../images/Insert.gif";

 

col1.CancelImageUrl =

"../images/Cancel.gif";

 

 

col1.UniqueName =

"EditCommandColumn";

 

grid.MasterTableView.Columns.Add(col1);

grid.MasterTableView.Columns[1].HeaderStyle.Width =

Unit.Percentage(10);

 

grid.MasterTableView.Columns[1].ItemStyle.Width =

Unit.Percentage(10);

 

 

GridButtonColumn col2 = new GridButtonColumn();

 

col2.Text =

"Delete";

 

col2.ConfirmText =

"Delete this product?";

 

col2.ButtonType =

GridButtonColumnType.ImageButton;

 

col2.ImageUrl =

"../images/Delete.gif";

 

col2.CommandName =

"Delete";

 

col2.UniqueName =

"DeleteColumn";

 

grid.MasterTableView.Columns.Add(col2);

grid.MasterTableView.Columns[2].HeaderStyle.Width =

Unit.Percentage(10);

 

grid.MasterTableView.Columns[2].ItemStyle.Width =

Unit.Percentage(10);

 

 

GridCheckBoxColumn col3 = new GridCheckBoxColumn();

 

col3.UniqueName =

"colActive";

 

col3.HeaderText =

"Active";

 

col3.AllowFiltering =

false;

 

grid.MasterTableView.Columns.Add(col3);

grid.MasterTableView.Columns[3].HeaderStyle.Width =

Unit.Percentage(10);

 

grid.MasterTableView.Columns[3].ItemStyle.Width =

Unit.Percentage(10);

 

 

 

GridBoundColumn col4 = new GridBoundColumn();

 

 

//col4.DataField = "Tag";

 

col4.DataField =

"mkt_tag";

 

col4.UniqueName =

"colTag";

 

col4.HeaderText =

"Tag";

 

 

//col3.ReadOnly = true;

 

grid.MasterTableView.Columns.Add(col4);

grid.MasterTableView.Columns[4].HeaderStyle.Width =

Unit.Percentage(10);

 

grid.MasterTableView.Columns[4].ItemStyle.Width =

Unit.Percentage(10);

 

 

 

string templateColumnName = "Country";

 

 

GridTemplateColumn col5 = new GridTemplateColumn();

 

col5.ItemTemplate =

new ItemTemplate(templateColumnName);

 

col5.EditItemTemplate =

new EditItemTemplate(templateColumnName,_dbId);

 

col5.HeaderText =

"Country";

 

col5.UniqueName =

"colCountry";

 

grid.MasterTableView.Columns.Add(col5);

grid.MasterTableView.Columns[5].HeaderStyle.Width =

Unit.Percentage(10);

 

grid.MasterTableView.Columns[5].ItemStyle.Width =

Unit.Percentage(10);

 

 

 

 

GridBoundColumn col6 = new GridBoundColumn();

 

 

//col6.DataField = "ShortDescription";

 

col6.DataField =

"mkt_sdesc";

 

col6.UniqueName =

"colShortDescription";

 

col6.HeaderText =

"Short Description";

 

col6.MaxLength = 40;

grid.MasterTableView.Columns.Add(col6);

grid.MasterTableView.Columns[6].HeaderStyle.Width =

Unit.Percentage(10);

 

grid.MasterTableView.Columns[6].ItemStyle.Width =

Unit.Percentage(10);

 

 

GridBoundColumn col7 = new GridBoundColumn();

 

col7.DataField =

"mkt_sdesc2";

 

col7.UniqueName =

"colShortDescription2";

 

col7.HeaderText =

"Short Description 2";

 

col7.MaxLength = 40;

grid.MasterTableView.Columns.Add(col7);

grid.MasterTableView.Columns[7].HeaderStyle.Width =

Unit.Percentage(10);

 

grid.MasterTableView.Columns[7].ItemStyle.Width =

Unit.Percentage(10);

 

 

GridBoundColumn col8 = new GridBoundColumn();

 

 

//col8.DataField = "LongDescription";

 

col8.DataField =

"mkt_ldesc";

 

col8.UniqueName =

"colLongDescription";

 

col8.HeaderText =

"Long Description";

 

col8.MaxLength = 80;

grid.MasterTableView.Columns.Add(col8);

grid.MasterTableView.Columns[8].HeaderStyle.Width =

Unit.Percentage(10);

 

grid.MasterTableView.Columns[8].ItemStyle.Width =

Unit.Percentage(10);

 

templateColumnName =

"QCInstructions";

 

 

GridTemplateColumn col9 = new GridTemplateColumn();

 

col9.DataField =

"QCInstructions";

 

col9.ItemTemplate =

new ItemTemplate(templateColumnName);

 

col9.EditItemTemplate =

new EditItemTemplate(templateColumnName, _dbId);

 

col9.HeaderText =

"QC Instructions";

 

col9.UniqueName =

"colQCInstructions";

 

grid.MasterTableView.Columns.Add(col9);

grid.MasterTableView.Columns[9].HeaderStyle.Width =

Unit.Percentage(10);

 

grid.MasterTableView.Columns[9].ItemStyle.Width =

Unit.Percentage(10);

 

 

GridBoundColumn col11 = new GridBoundColumn();

 

col11.DataField =

"nshops";

 

col11.UniqueName =

"colNShops";

 

col11.HeaderText =

"NShops";

 

col11.MaxLength = 5;

grid.MasterTableView.Columns.Add(col11);

grid.MasterTableView.Columns[10].HeaderStyle.Width =

Unit.Percentage(10);

 

grid.MasterTableView.Columns[10].ItemStyle.Width =

Unit.Percentage(10);

 

 

GridTemplateColumn col12 = new GridTemplateColumn();

 

col12.ItemTemplate =

new ItemTemplate("PeriodLength");

 

col12.EditItemTemplate =

new EditItemTemplate("PeriodLength", _dbId);

 

col12.UniqueName =

"colPeriodLength";

 

col12.HeaderText =

"Period Length";

 

grid.MasterTableView.Columns.Add(col12);

grid.MasterTableView.Columns[11].HeaderStyle.Width =

Unit.Percentage(10);

 

grid.MasterTableView.Columns[11].ItemStyle.Width =

Unit.Percentage(10);

 

 

 

DataSet ds = new DataSet();

 

 

DBConnectionUtility dbcon = new DBConnectionUtility();

 

ds = dbcon.GetDataTable(

"Select db_char_name_id , 'Char_' || char_name as Char_name from axnadmin.gs_clt_db_char_names where clt_db_id= " + _dbId +

 

 

" and dimension_id = 1");

 

_noOfChars = ds.Tables[0].Rows.Count;

_dtCharNames = ds.Tables[0];

 

StringBuilder sb = new StringBuilder();

 

sb.Append(

"clt_db_id,mkt_id,mkt_tag,country,qcinstructions,periodlength,Active");

 

 

for (int i = 0; i < _noOfChars ; i++)

 

{

 

GridTemplateColumn col13 = new GridTemplateColumn();

 

col13.ItemTemplate =

new ItemTemplate(ds.Tables[0].Rows[i]["Char_Name"].ToString());

 

col13.EditItemTemplate =

new EditItemTemplate(ds.Tables[0].Rows[i]["Char_Name"].ToString(),_dbId);

 

col13.HeaderText = ds.Tables[0].Rows[i][

"Char_Name"].ToString();

 

col13.UniqueName =

"colChar" + ds.Tables[0].Rows[i]["Char_Name"];

 

sb.Append(

",");

 

sb.Append(ds.Tables[0].Rows[i][

"Char_Name"].ToString());

 

grid.MasterTableView.Columns.Add(col13);

grid.MasterTableView.Columns[i + 12].HeaderStyle.Width =

Unit.Percentage(10);

 

grid.MasterTableView.Columns[i + 12].ItemStyle.Width =

Unit.Percentage(10);

 

}

 

string dataKeyNames = sb.ToString();

 

grid.MasterTableView.DataKeyNames = dataKeyNames.Split(

',');

 

grid.NeedDataSource +=

new GridNeedDataSourceEventHandler(this.RadGridMarkets_NeedDataSource);

 

 

//grid.DeleteCommand += new GridCommandEventHandler(this.RadGridMarkets_DeleteCommand);

 

 

//grid.UpdateCommand += new GridCommandEventHandler(this.RadGridMarkets_UpdateCommand);

 

 

//grid.InsertCommand += new GridCommandEventHandler(this.RadGridMarkets_InsertCommand);

 

grid.ItemDataBound +=

new GridItemEventHandler(this.RadGridMarkets_ItemDataBound);

 

grid.ItemCommand +=

new GridCommandEventHandler(this.RadGridMarkets_ItemCommand);

 

 

MessageControl MessageUserControl = (MessageControl)LoadControl("~/Common/CommonUI/MessageControl/MessageControl.ascx");

 

MessageUserControl.ID =

"lblMessageUserControl";

 

 

 

//objContainer.Selecting += new EventHandler<ObjectContainerDataSourceSelectingEventArgs>(this.objContDSMarkets_Selecting);

 

grid.MasterTableView.CommandItemTemplate =

new MarketCommandItemTemplate();

 

grid.MasterTableView.CommandItemDisplay =

GridCommandItemDisplay.Top;

 

 

// Add the grid to the placeholder

 

 

this.radAjaxPanelMarkets.Controls.Add(MessageUserControl);

 

 

this.radAjaxPanelMarkets.Controls.Add(grid);

 

 

//this.radAjaxPanelMarkets.Controls.Add(objContainer);

 

}

Thanks and Regards
V.Balamurali

Pavlina
Telerik team
 answered on 11 Dec 2009
3 answers
227 views
Hello,

I want to add my custom fonts to the editor. How to do it without code?

Regards
NLV
NLV
Top achievements
Rank 1
 answered on 11 Dec 2009
Narrow your results
Selected tags
Tags
+? more
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?