Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
163 views
Hi,

On Row Seleted or Edit, I'm displaying info in a TextArea and dynamically setting focus to the TextArea. Below is the code.

The functionality works fine in Firefox. However, in IE, I get Focus on the TextArea and then loose it as I found out, that the RadGrid's script of displaying the ActiveRow is executed after my script is executed. Please advice as to how can I resolve this. I have Keyboard Support enabled.

public static void SetFocus(Control control)
        {
            StringBuilder sb = new StringBuilder();
 
            sb.Append("\r\n<script language='JavaScript'>\r\n");
            sb.Append("<!--\r\n");
            sb.Append("window.onload = function ()\r\n");
            sb.Append("{\r\n");
            sb.Append("\tdocument.getElementById('");
             sb.Append(control.ClientID);
            sb.Append("').focus();\r\n");
            sb.Append("\tdocument.getElementById('");
 
            sb.Append(control.ClientID);
            sb.Append("').scrollIntoView(true);\r\n");
            sb.Append("alert('Got Focus');");
            //sb.Append("'].focus();\r\n");
            sb.Append("};\r\n");
            //sb.Append("window.onload = SetFocus;\r\n");
            sb.Append("// -->\r\n");
            sb.Append("</script>");
 
            control.Page.RegisterStartupScript("SetFocus", sb.ToString());
           
        }
 
        protected void RadGrid2_ItemCommand(object source, Telerik.WebControls.GridCommandEventArgs e)
        {
            if ((e.CommandName == "RowClick" || e.CommandName == "Edit") && e.Item is GridDataItem)
            {
                textBoxData.Text = "Row clicked " + e.Item.RowIndex.ToString();
                SetFocus(textBoxData);
            }
           
            if (e.CommandName == "Edit" && e.Item is GridDataItem)
            {
                e.Item.Edit = false;
               
            }
        }
Rosen
Telerik team
 answered on 15 Sep 2008
2 answers
109 views
Hie all,
I have got a small problem, im using the code below to close a page. It works only when its under a button(ie button click event) but when i use a toolbar click event its not closing the page, even though it runs through the code without any errors. does anyone know whats wrong.

protected void RadToolBar1_ButtonClick1(object sender, Telerik.Web.UI.RadToolBarEventArgs e)
{
if ((e.Item.Text == "Save & Close")
{
string scriptString = "<script language="JavaScript"> window.close();</script>
Page.ClientScript.RegisterClientScriptBlock(this.GetType()), "submitScript", scriptString);
}
}
Omlac
Top achievements
Rank 1
 answered on 15 Sep 2008
2 answers
327 views
hi

I am trying use RAD Scheduler and exploring on it ..
I have some queries ...

Is there any way to bind dataset to the RAD Scheduler control ?
One more thing I don not need the delete button on the Appointments,Please let me know how to do it....

My appointment titles are big. How to show them fully ?

I want the the appointment titles to be hyperlinks so that if user clicks on it, it will open a new page with the details of the appointments..

The queries may be basic but please help me out

Thanks in Advance
Archan
Simon
Telerik team
 answered on 15 Sep 2008
1 answer
151 views
Is there a way to have the doc automatically expand to the size of it's content?  Can't seem to find an answer in help.
Sophy
Telerik team
 answered on 15 Sep 2008
1 answer
136 views
I am having a heck of a time trying to get our custom RadMenu to wrap text within IE.  It works great in Firefox.

We are building our menu item nodes dynamically on the ItemDataBound event.  The code is below, and then under that is the CSS we are using.  We had tried adding "white-space:normal" but that didn't work.  In fact, when using IE Developer Toolbar, the white-space style was always set to nowrap no matter what we used - even when using !important (this was all for the .EntityDescription class).

Also, I am not sure if this way of building the menu is the best, but we experimented until everything seemed to work out.  I could not find much in the documentation about building a dynamic menu where the root and children are using different "templates".  As you can see, I am not really using templates to accomplish this.

    protected void rmEntities_ItemDataBound(object sender, RadMenuEventArgs e) 
    { 
      string targetURL =  
          ( (DataBinder.Eval(e.Item.DataItem, "TargetURL") == null) 
            ||  
            (string.IsNullOrEmpty(DataBinder.Eval(e.Item.DataItem, "TargetURL").ToString())) 
          ) 
          ? "#" 
          : DataBinder.Eval(e.Item.DataItem, "TargetURL").ToString(); 
 
      if (e.Item.Level == 0) 
      { 
        // start a link tag with our node class 
        e.Item.Controls.Add(new LiteralControl("<a href='" + targetURL + "' class='EntityParentNode'>")); 
 
        // add title 
        Panel pnlTitle = new Panel(); 
        pnlTitle.CssClass = "EntityParentTitle"; 
        pnlTitle.Controls.Add(new LiteralControl(DataBinder.Eval(e.Item.DataItem, "NodeName").ToString())); 
 
        e.Item.Controls.Add(pnlTitle); 
      } 
      else if (e.Item.Level > 0) 
      { 
        // start a link tag with our node class 
        e.Item.Controls.Add(new LiteralControl("<a href='" + targetURL + "' class='EntityNode'>")); 
 
        // add image 
        Image img = new Image(); 
        img.ImageUrl = PortalConfig.CategoryImagePath 
            + DataBinder.Eval(e.Item.DataItem, "ImageFile").ToString(); 
        img.Height = new Unit("75px"); 
        img.Width = new Unit("75px"); 
        img.CssClass = "EntityImage"; 
 
        e.Item.Controls.Add(img); 
 
        // add title 
        Panel pnlTitle = new Panel(); 
        pnlTitle.CssClass = "EntityTitle"; 
        pnlTitle.Controls.Add(new LiteralControl(DataBinder.Eval(e.Item.DataItem, "NodeName").ToString())); 
 
        e.Item.Controls.Add(pnlTitle); 
 
        // add description 
        Panel pnlDescription = new Panel(); 
        pnlDescription.CssClass = "EntityDescription"; 
        pnlDescription.Controls.Add(new LiteralControl(DataBinder.Eval(e.Item.DataItem, "EntityDescription").ToString())); 
 
        e.Item.Controls.Add(pnlDescription); 
      } 
 
      // close the link tag 
      e.Item.Controls.Add(new LiteralControl("</a>")); 
 
      // set additional css classes 
      e.Item.ExpandedCssClass = "NodeHighlight"; 
      e.Item.FocusedCssClass = "NodeHighlight"; 
    } 

CSS:

.rmItem 
{ 
  font-family: Verdana; 
  background-color: White; 
} 
 
.rmItem a, 
.rmItem a:visited 
{ 
  display: block; 
  color: #000000; 
  text-decoration: none; 
} 
 
.rmItem a:hover 
{ 
  color: #00847C;   
  text-decoration: none; 
} 
 
.NodeHighlight 
{ 
} 
 
.HasChildren 
{ 
  background-image:url("images/arrowright.png"); 
  background-position: right center; 
  background-repeat: no-repeat; 
} 
 
.rmGroup 
{ 
  border: 1px solid #666666; 
} 
 
.EntityParentNode 
{ 
  font-size: 12px; 
  text-align: left; 
  vertical-align: middle; 
  line-height: 20px;  
  cursor: pointer; 
  width: 190px; 
} 
 
.EntityParentTitle 
{ 
  padding-left: 2px; 
  width: 176px; 
  overflow: hidden;   
  white-space: nowrap; 
} 
 
.EntityNode 
{ 
  padding: 2px; 
  width: 285px; 
  cursor: pointer; 
  white-space: normal !important; 
  width: 290px; 
  text-align: left; 
} 
 
.EntityImage 
{ 
  float: left; 
} 
 
.EntityTitle 
{ 
  padding-left: 2px; 
  vertical-align: middle; 
  font-size: 12px; 
  font-weight: bold; 
  overflow: hidden; 
  height: 18px; 
  width: 200px; 
} 
 
.EntityDescription 
{ 
  padding-left: 2px; 
  vertical-align: middle; 
  font-size: 11px; 
  overflow: hidden; 
  height: 56px; 
  width: 200px; 
  white-space: normal !important;   
} 


Any chance you see what is needed?

Thanks for all your help and support!

Michael
Yana
Telerik team
 answered on 15 Sep 2008
2 answers
505 views
The onupdatecommand and oninsertcommand no longer fire for my grids.  I also get and error that I need a scriptmanager, never got this before.  The ondeletecommand does fire.There was a recent change to the master file, only in format (images etc.).  Any ideas what I should do?

<%@ Page Language="C#" MasterPageFile="~/Masters/Site.Master" AutoEventWireup="true" 
    CodeBehind="Nouns.aspx.cs" Inherits="MIDI_Internal.Lookups.NSNs.Nouns" Title="MIDI - Manage Nouns" %> 
<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" 
    Namespace="System.Web.UI" TagPrefix="asp" %> 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
 
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">  
</asp:Content> 
<asp:Content ID="Content2" ContentPlaceHolderID="cphPageTitle" runat="server">  
    Manage Nouns  
</asp:Content> 
<asp:Content ID="Content3" ContentPlaceHolderID="cphMainBody" runat="server">  
 
<script type="text/javascript">  
 
 
function KeyPressed(sender, eventArgs)  
 
 {  
    //alert(eventArgs.get_keyCode());  
    if (eventArgs.get_keyCode()==13)  
    {  
      
        //alert('Cancel me');  
        //selectedRow = -1;  
        eventArgs.set_cancel(true);  
        //FireCommandEvent ("Update", GridCommandEventArgs);  
        //return false;  
          
 
    }  
 }  
 
</script> 
 
    <asp:ObjectDataSource ID="ObjectDataSourceLookup" runat="server"   
        DeleteMethod="Delete" InsertMethod="Insert"   
        SelectMethod="GetDT" UpdateMethod="Update" 
        TypeName="MIDI_Internal.BLL_Noun" > 
        <DeleteParameters> 
            <asp:Parameter Name="NounID" Type="Int32" /> 
        </DeleteParameters> 
        <UpdateParameters> 
            <asp:Parameter Name="NounID" Type="Int32" /> 
            <asp:Parameter Name="Noun" Type="String" /> 
        </UpdateParameters> 
        <SelectParameters> 
            <asp:Parameter Name="NounID" Type="Int32" /> 
        </SelectParameters> 
        <InsertParameters> 
            <asp:Parameter Name="Noun" Type="String" /> 
        </InsertParameters> 
    </asp:ObjectDataSource> 
 
    <telerik:RadGrid ID="RadGridLookup" runat="server" AllowFilteringByColumn="True" 
        AllowPaging="True" AllowSorting="True" GridLines="None" Skin="Mac"   
        EnableAJAX="True" width="60%" AllowAutomaticDeletes="true" 
        AllowAutomaticInserts="true" AllowAutomaticUpdates="true"   
        PagerStyle-Mode="NextPrevNumericAndAdvanced" ClientSettings-Resizing-AllowColumnResize="true" 
        DataSourceID="ObjectDataSourceLookup"   
        OnItemDeleted="RadGridLookup_ItemDeleted" OnItemDataBound="RadGridLookup_ItemDataBound" 
        OnDeleteCommand="RadGridLookup_DeleteCommand" OnItemInserted="RadGridLookup_ItemInserted" 
        OnInit="RadGridLookup_Init" OnColumnCreated="RadGridLookup_ColumnCreated"   
        OnInsertCommand="RadGridLookup_InsertCommand"   
        OnItemUpdated="RadGridLookup_ItemUpdated"   
        OnUpdateCommand="RadGridLookup_UpdateCommand"   
        onitemcommand="RadGridLookup_ItemCommand"   
        onitemcreated="RadGridLookup_ItemCreated"  > 
        <ClientSettings AllowKeyboardNavigation="true" ClientEvents-OnKeyPress="KeyPressed">  
            <Selecting AllowRowSelect="true" /> 
        </ClientSettings> 
 
        <PagerStyle Mode="NextPrevNumericAndAdvanced" AlwaysVisible="true" Position="Bottom"></PagerStyle> 
 
        <MasterTableView allowmulticolumnsorting="True" pagesize="15" CommandItemDisplay="TopAndBottom" 
                    autogeneratecolumns="False" DataKeyNames="NounID" datasourceid="ObjectDataSourceLookup" > 
          
        <RowIndicatorColumn Visible="False">  
        <HeaderStyle Width="20px"></HeaderStyle> 
        </RowIndicatorColumn> 
 
        <ExpandCollapseColumn Visible="False" Resizable="False">  
        <HeaderStyle Width="20px"></HeaderStyle> 
        </ExpandCollapseColumn> 
            <Columns> 
                <telerik:GridEditCommandColumn ButtonType="ImageButton" UpdateImageUrl="~\RadControls\Skins\Mac\Grid\Update.gif"   
                        EditImageUrl="~\RadControls\Skins\Mac\Grid\Edit.gif" InsertImageUrl="~\RadControls\Skins\Mac\Grid\AddRecord.gif"   
                        CancelImageUrl="~\RadControls\Skins\Mac\Grid\Cancel.gif"   
                        UniqueName="EditCommandColumn" EditText="Edit Noun">  
                </telerik:GridEditCommandColumn> 
              
                <telerik:GridBoundColumn   DataField="NounId" DataType="System.Int32" HeaderText="ID"   
                    ReadOnly="True" SortExpression="NounId" UniqueName="NounId" Visible="false">  
                </telerik:GridBoundColumn> 
 
                <telerik:GridTemplateColumn HeaderText="Noun" DataField="Noun" SortExpression="Noun" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" UniqueName="NounTemplate">  
                    <ItemTemplate > 
                        <asp:Label ID="lblNoun" runat="server" Text='<%#Eval("Noun")%>' /> 
                    </ItemTemplate> 
                    <EditItemTemplate > 
                        <asp:TextBox ID="txtNoun" Text='<%#Bind("Noun")%>' runat="server" Width="80%" /><asp:RequiredFieldValidator ID="rValNoun" runat="server" ControlToValidate="txtNoun" ErrorMessage="*" Enabled="true" Text="Required Field" /> 
                    </EditItemTemplate> 
                </telerik:GridTemplateColumn> 
                  
                <telerik:GridButtonColumn ConfirmText="Are you sure you want to delete this record?" ButtonType="ImageButton" ImageUrl="~\RadControls\Skins\Mac\Grid\Delete.gif" CommandName="Delete" Text="Delete" UniqueName="DeleteColumn">  
                        <HeaderStyle Width="20px" /> 
                </telerik:GridButtonColumn>                  
            </Columns> 
        </MasterTableView> 
        <ClientSettings> 
            <Selecting AllowRowSelect="true" /> 
        </ClientSettings>          
    </telerik:RadGrid> 
 
</asp:Content> 
 

using System;  
using System.Collections;  
using System.Configuration;  
using System.Data;  
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.Collections.Generic;  
using Telerik.Web.UI;  
 
 
namespace MIDI_Internal.Lookups.NSNs  
{  
    public partial class Nouns : MIDI_Internal.AppCode._libraries.LookupBasePage  
    {  
        protected void Page_PreInit(object sender, EventArgs e)  
        {  
            Page.Theme = (string)Session["MyTheme"];  
        }  
 
        protected void Page_Load(object sender, EventArgs e)  
        {  
            RadGridLookup.MasterTableView.EditMode = GridEditMode.InPlace;  
            // wire sort event handler to take care of sorting after an insert occurs (see base class event handler)  
            RadGridLookup.SortCommand += new GridSortCommandEventHandler(RadGridLookup_SortCommand);  
 
        }  
 
        /// <summary> 
        /// handles users selection to change the paging style at the footer of the grid  
        /// </summary> 
        /// <param name="sender"></param> 
        /// <param name="e"></param> 
        protected virtual void ddlPaging_SelectedIndexChanged(object sender, EventArgs e)  
        {  
            // Get current selected Paging Option //  
            //string currentPager = ddlPaging.SelectedValue.ToString();  
            //UpdatePagingThemes(RadGridLookup, currentPager);  
        }  
 
        /// <summary> 
        /// When a noun is inserted in the grid, ascertain there are no duplicate nouns in the tbMIDI_noun table that exist with this noun,   
        /// this event will look for this Noun and cancel the insert if a duplicate exist, display to user.  
        /// Requirements met:   
        ///         4.5.3.1.4 NOUN-1 Noun - no duplicates  
        ///         4.5.3.1.2 NOUN-2 Ability to add a new noun  
        /// </summary> 
        /// <param name="source">RadGrid</param> 
        /// <param name="e"></param> 
        protected void RadGridLookup_InsertCommand(object source, GridCommandEventArgs e)  
        {  
            if ((e.Item is GridDataInsertItem) && (e.Item.OwnerTableView.IsItemInserted))  
            {  
                GridDataInsertItem edititem = (GridDataInsertItem)e.Item;  
                string strVal = ((TextBox)edititem["NounTemplate"].FindControl("txtNoun")).Text;  
 
                AppCode.DALs.MIDI_DAL.tbMIDI_NounDataTable _noun = new MIDI_Internal.AppCode.DALs.MIDI_DAL.tbMIDI_NounDataTable();  
                _noun = BLL_Noun.GetDT(null);  
 
 
                DataRow[] _dr1 = _noun.Select("Noun='" + strVal.Replace("'", "''").ToString() + "'");  
 
                if (_dr1.Length > 0)  
                {  
                    e.Canceled = true;  
                    DisplayAlertMessage("Can not insert this noun, the noun already exists");  
                }  
                _noun.Dispose();  
                _noun = null;  
 
            }  
        }  
 
        /// <summary> 
        /// When an item is deleted from the noun grid, ascertain there are no NSNs that exist with this noun, user must delete these first.  
        /// this event will look for thise NSNs and cancel the delete if NSNs exist, display to user.  
        /// Requirements met:   
        ///         4.5.3.1.4 NOUN-4  
        ///         4.5.3.1.4 NOUN-4.1  
        /// </summary> 
        /// <param name="source">RadGrid</param> 
        /// <param name="e"></param> 
        protected override void RadGridLookup_DeleteCommand(object source, GridCommandEventArgs e)  
        {  
            base.RadGridLookup_DeleteCommand(source, e);  
            int id = 0;  
            AppCode.DALs.MIDI_DAL.tbMIDI_NSNDataTable _nsn = new MIDI_Internal.AppCode.DALs.MIDI_DAL.tbMIDI_NSNDataTable();  
 
            //data key value not in the GridCommandEventArgs object, need to extract  
            //id = int.Parse(((GridTableCell)(RadGridLookup.MasterTableView.Controls[0] as Table).Rows[e.Item.RowIndex].Cells[3]).Text);  
            id = int.Parse(e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["NounID"].ToString());  
 
            //_nsn = BLL_NSN.GetDT(null);  
            _nsn = BLL_NSN.RetrieveNSNByNounForm(-1, id);  
 
            DataRow[] _dr1 = _nsn.Select("nounId=" + id.ToString());  
 
            if (_dr1.Length > 0)  
            {  
                e.Canceled = true;  
                string NSNs = "";  
                for (int i = 0; i < _dr1.Length; i++)  
                {  
                    NSNs += @"\n";  
                    NSNs += "" + _dr1[i]["NSN"].ToString() + "";  
                }  
                DisplayAlertMessage("Can not delete this noun, NSN records exist: " + NSNs);  
            }  
 
            _nsn.Dispose();  
            _nsn = null;  
        }  
 
        /// <summary> 
        /// When a noun is updated in the grid, ascertain there are no nouns that match the updated value in the tbMIDI_Noun table,  
        /// can not add duplicates  
        /// this event will look for this noun in tbMIDI_Noun and cancel the update if it exist, display to user.  
        /// Requirements met:  
        ///         4.5.3.1.4 NOUN-3  Ability to select and modify an existing noun  
        /// </summary> 
        /// <param name="source">RadGrid</param> 
        /// <param name="e"></param> 
        protected override void RadGridLookup_UpdateCommand(object source, GridCommandEventArgs e)  
        {  
 
            //Get the GridEditableItem of the RadGrid          
            GridEditableItem eeditedItem = e.Item as GridEditableItem;  
            //Get the primary key value using the DataKeyValue.          
            string NounID = editedItem.OwnerTableView.DataKeyValues[editedItem.ItemIndex]["NounID"].ToString();  
            //Access the textbox from the edit form template and store the values in string variables.          
            string strVal = (editedItem["NounTemplate"].FindControl("txtNoun") as TextBox).Text;  
 
            AppCode.DALs.MIDI_DAL.tbMIDI_NounDataTable _noun = new MIDI_Internal.AppCode.DALs.MIDI_DAL.tbMIDI_NounDataTable();  
            _noun = BLL_Noun.GetDT(null);  
 
            DataRow[] _dr1 = _noun.Select("Noun='" + strVal.Replace("'", "''").ToString() + "'");  
 
            if (_dr1.Length > 0 && (string.Compare(strVal, (string)Session["savedOldValue"], StringComparison.CurrentCultureIgnoreCase) != 0))  
            {  
                e.Canceled = true;  
                DisplayAlertMessage("Can not update this noun, the noun name already exists in the database.");  
                (editedItem["NounTemplate"].FindControl("txtNoun") as TextBox).Text = (string)Session["savedOldValue"];  
            }  
            _noun.Dispose();  
            _noun = null;  
 
        }  
 
        protected override void RadGridLookup_ItemCreated(object sender, GridItemEventArgs e)  
        {  
            base.RadGridLookup_ItemCreated(sender, e);  
            if (e.Item is GridFilteringItem)  
            {  
                AdjustFilterColumnTextBox("NounTemplate", 80, e);  
            }  
        }  
 
 
    }  
}  
 

Gary
Top achievements
Rank 1
 answered on 15 Sep 2008
5 answers
99 views
Hello,

I am using the last release of the treeview with the embedded skin "Gray"

Every link in the treeview does not have a css style, and they look like normal unstyled links

Every node with subnodes (so whithout a link to navigate to) are looking fine

I tried changing the skin, and actually the only one without css problems is the "Default" one

Any clue about this problem?

Francesco
Sophy
Telerik team
 answered on 15 Sep 2008
6 answers
189 views
Hello,

I've been trying to keep a menu open after a selection of an item (the menu has checkbox stuff and I need to allow the user to select the items before close it).

So far I only can get that behavior creating a fake function and generating a javascript error:

<telerik:RadContextMenu ID="contextColumns" runat="server" Flow="Vertical" Skin="Hay" OnClientItemClicked="OnMenuClick"> 
        <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> 
        <Items> 
            <telerik:RadMenuItem runat="server" Text="Show Columns" Value="Columns"> 
                <Items> 
                    <telerik:RadMenuItem runat="server" Text="Id" State="checked" /> 
                    <telerik:RadMenuItem runat="server" Text="First Name" State="checked" /> 
                    <telerik:RadMenuItem runat="server" Text="Last Name" State="checked" /> 
                    <telerik:RadMenuItem runat="server" IsSeparator="true" /> 
                    <telerik:RadMenuItem runat="server" Text="Apply" Value="menuApply" /> 
                </Items> 
            </telerik:RadMenuItem> 
            </telerik:RadMenuItem> 
        </Items> 
</telerik:RadContextMenu> 

And this is the way I try to do it in js:

function OnMenuClicked(sender, args) { 
   var item = args.get_item(); 
   switch(item.get_value()) { 
       case "menuApply" : 
          // Here I need to apply changes and that's all 
       break; 
       default : 
          ToggleCheckImage(item); 
          this_function_does_not_exists();  // the only way to keep the menu open 
   } 
} 

The user need to select the items in the menu and then apply the changes when select "Apply", the only way I could keep the menu open until the user select apply is using a simple javascript error.

Is any better way to do what I want? just to keep the menu displayed until the user select the correct menu option?

Thanks a lot for your help!


Daniel Plomp
Top achievements
Rank 2
 answered on 15 Sep 2008
3 answers
144 views

Hi

I have built a dynamic grid on the Page Init

Now I need to hook up the client side events (OnRowDblClick etc…) for this type of grid. Is this possible??

P

Sebastian
Telerik team
 answered on 15 Sep 2008
1 answer
223 views

I  created grid dynamically and placed button on the page.It is working fine except column width when i browse the page first time.
 I am also  displaying seach conditions in RadWindow when user clicks on button.
Note : I created xml file for columns definations and using to generate the bound columns.

1. I am getting extra columns when i click on pager to selct particular page or  column for sort.This is exactly the same number of columns in the grid.
   Let assume, I am displaying 5 columns in grid. It is displaying 10 columns after i clicked on paging or sorting, third time 15 and so on. I am not really sure how and where these columns are creating. the value in extra columns is System.Data.DataRowView.

2.4. I am getting the popup with retry and cancel buttons with the below message when i seach the records other than first page or before selecting the column sort or paging. Can you please advice me on this?
 
To Display the webpage again, Internet Explorer needs to resend the information you've previously submited

If you were making a purchase, you should click Cancel to avoid a duplicate transaction. Otherwise, click Retry to display the webpage again.

3. the sort image is coming second line when i click on column for sort. Can please help me to fix this issue?
4. Select Column with is very large when i browse the first time. But it is adjusting the column width automatically after i click on paging or sorting. Can please help me to fix this issue?

5. I set EnableAjax = true but still it is doing post back. Can please help me to fix this issue?

I pasted code below because i didn't see any buttom for file attachment.

Page 1:
HTML :

<%

@ Page Language="C#" MasterPageFile="~/DealerFinance.master" AutoEventWireup="true" CodeFile="DealerList.aspx.cs" Inherits="Dealer_DealerList" Title="Untitled Page" %>

<%

@ MasterType VirtualPath="~/DealerFinance.master" %>

<%

@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

<

asp:Content ID="Content2" ContentPlaceHolderID="DealerFinancePlaceHolder" Runat="Server">

<

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

function LookupParameter()

{

var popWin = window.open('DealersSearch.aspx','SearchDealer','width=400,height=350,top=100,toolbar=no,location=no,directories=no,status=no,scrollbars=no,menubar=no,resizable=yes,left=200','');

// window.open('/DealersFinanceApplication/Dealer/DealersSearch.aspx', 'Sai', '','');

popWin.focus();

return false;

}

function ParentFormPostBack()

{

__doPostBack(

'btnSearch','');

}

</

script>

 

<table>

<tr>

<td align="left">

<!-- <asp:Button ID="tempbtnSearch" runat="server" CausesValidation="false" OnClientClick="LookupParameter()" SkinID="DisplayButton"

Text="Search" /> -->

<asp:Button ID="btnSearch" runat="server" CausesValidation="false" SkinID="DisplayButton"

Text="Search" />

&nbsp;

</td>

</tr>

<tr>

<td>

<telerik:RadGrid ID="grdDealerList" runat="server" AllowSorting="true" ItemStyle-BackColor= "AliceBlue" AlternatingItemStyle-BackColor="#ffffff" GridLines="None">

</telerik:RadGrid>

<asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder>

</td>

</tr>

</table>

<telerik:radwindow openerelementid="<%# btnSearch.ClientID %>" navigateurl="DealersSearch.aspx"

runat="server" width="400px" height="450px" id="Radwindow4" visiblestatusbar="false"

skin="Mac"></telerik:radwindow>

</

asp:Content>

codebehind:

using

System;

using

System.Collections;

using

System.Configuration;

using

System.Data;

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

System.Web.UI.WebControls.WebParts;

using

System.Xml.Linq;

using

Telerik.Web.UI;

using

System.Data.SqlClient;

using

System.Xml;

using

System.Drawing;

public

partial class Dealer_DealerList : System.Web.UI.Page

{

public string searchCondition = "";

protected void Page_Load(object sender, EventArgs e)

{

if (!IsPostBack)

{

Master.SelectedDealerTab = 1;

//DealSearchFields dealerSeachFieldsObj = (DealSearchFields)Session["DealerSearchFields"];

//if (dealerSeachFieldsObj != null)

//{

// searchCondition = dealerSeachFieldsObj.DealerNumber;

//}

//else

//{

// searchCondition = "";

//}

//btnSearch.Attributes.Add("onclick", "return LookupParameter();");

//Dynaic code for Rad Grid Starts here

 

}

 

}

protected void RadGrid1_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)

{

grdDealerList.DataSource = BindGrid();

}

private DataTable BindGrid()

{

string searchCondition = "";

DealSearchFields dealerSeachFieldsObj = (DealSearchFields)Session["DealerSearchFields"];

if (dealerSeachFieldsObj != null)

{

searchCondition = dealerSeachFieldsObj.DealerNumber;

}

else

{

searchCondition =

"";

}

string sql = "SELECT ROW_ID ,DEALER_NUM ,NAME, LEGAL_NAME, SALES_DISTRICT, BUSINESS_TYPE FROM KF_DEALER where DEALER_NUM LIKE '%" + searchCondition + "%' order by DEALER_NUM";

SqlDataAdapter adapter = new SqlDataAdapter(sql,

ConfigurationManager.ConnectionStrings["KC_DealerFinanceConnectionString"].ConnectionString);

DataTable dt = new DataTable();

adapter.Fill(dt);

return dt;

}

protected void RadGrid1_ItemCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)

{

if (e.CommandName == "Select")

{

GridDataItem dataItem = (GridDataItem)e.Item;

string strTxt = dataItem.GetDataKeyValue("DEALER_NUM").ToString();

string rowID = dataItem.GetDataKeyValue("ROW_ID").ToString();

Response.Redirect(

"/DealersFinanceApplication/Dealer/DealerDetails.aspx");

}

 

 

}

protected void Page_Init(object sender, System.EventArgs e)

{

DefineGridStructure();

}

 

private void DefineGridStructure()

{

bool isFromWindow = Convert.ToBoolean(Session["IsFromWindow"]);

//RadGrid grdDealerList = new RadGrid();

//grdDealerList.ID = "RadGrid1";

if (isFromWindow)

{

grdDealerList.DataSource =

"";

grdDealerList.Rebind();

}

grdDealerList.NeedDataSource +=

new GridNeedDataSourceEventHandler(this.RadGrid1_NeedDataSource);

grdDealerList.ItemCommand +=

new GridCommandEventHandler(this.RadGrid1_ItemCommand);

//grdDealerList.DataSource = BindGrid();

grdDealerList.Skin =

"Inox";

//grdDealerList.Width = Unit.Percentage(100);

grdDealerList.PageSize = 5;

grdDealerList.AllowPaging =

true;

grdDealerList.PagerStyle.Mode =

GridPagerMode.NextPrevAndNumeric;

grdDealerList.AutoGenerateColumns =

false;

//grdDealerList.GroupingEnabled = true;

//grdDealerList.ShowGroupPanel = true;

grdDealerList.ShowStatusBar =

true;

grdDealerList.ClientSettings.AllowDragToGroup =

true;

grdDealerList.AllowSorting =

true;

grdDealerList.Width =

Unit.Percentage(100);

grdDealerList.ItemStyle.CssClass =

"RadGrid";

grdDealerList.MasterTableView.PageSize = 30;

grdDealerList.MasterTableView.DataKeyNames =

new string[] { "ROW_ID", "DEALER_NUM" };

GridButtonColumn selectColumn = new GridButtonColumn();

selectColumn.DataTextField =

"DEALER_NUM";

selectColumn.CommandArgument =

"DEALER_NUM";

selectColumn.CommandName =

"Select";

selectColumn.HeaderText =

"DealerNumber";

selectColumn.DataTextFormatString =

"<nobr>{0}</nobr>";

selectColumn.SortExpression =

"DEALER_NUM";

//selectColumn.

grdDealerList.MasterTableView.Columns.Add(selectColumn);

 

XmlDocument xmlDoc = new XmlDocument();

xmlDoc.Load(Request.MapPath(

"~/App_Data/DataMapping.xml"));

XmlNodeList columnNodeList = XML.GetNodeList("/DealerGrids/DealerGrid[@Name ='DealerList']/Columns/Column", xmlDoc);

 

foreach (XmlNode columnNode in columnNodeList)

{

string headerText = "";

headerText =

XML.GetAttributeValue("/Column", "DisplayText", columnNode.OuterXml);

if (headerText != null && headerText.Length > 0)

{

GridBoundColumn boundColumn = new GridBoundColumn();

boundColumn.DataField =

XML.GetAttributeValue("/Column", "TableColumnName", columnNode.OuterXml);

boundColumn.HeaderText = headerText;

boundColumn.DataFormatString =

"<nobr>{0}</nobr>";

grdDealerList.MasterTableView.Columns.Add(boundColumn);

}

}

this.PlaceHolder1.Controls.Add(grdDealerList);

if (isFromWindow)

{

grdDealerList.DataSource = BindGrid();

grdDealerList.Rebind();

}

Session[

"IsFromWindow"] = false;

}

 

//public readonly RadGrid DealerListGrid

//{

// get

// {

// return grdDealerList;

// }

//}

}

Page 2(Which i am displaying in radwindow)

<%

@ Page Language="C#" AutoEventWireup="true" CodeFile="DealersSearch.aspx.cs" Inherits="Dealer_DealersSearch" %>

 

<!

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><%=Resources.DealerFinance.DealerSearchHeader%></title>

 

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

 

//This code is used to provide a reference to the radwindow "wrapper"

 

function GetRadWindow()

{

var oWindow = null;

if (window.radWindow) oWindow = window.radWindow; //Will work in Moz in all cases, including clasic dialog

 

else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;//IE (and Moz az well)

 

return oWindow;

}

function CloseOnReloadandReLoad()

{

RefreshParentPage();

//GetRadWindow().Close();

 

}

function CloseOnReload()

{

GetRadWindow().Close();

}

 

function RefreshParentPage()

{

GetRadWindow().BrowserWindow.location.reload();

}

function SelectAgency(code, name)

{

window.close();

window.opener.ParentFormPostBack(

'','');

window.opener.focus();

}

</script>

 

 

</

head>

<

body>

 

<form id="form1" runat="server">

 

<asp:Label ID="InjectScript" runat="server"></asp:Label>

 

<table>

 

<tr>

 

<td align="center" nowrap="nowrap" colspan="3" >

 

<div class="TitleTextNormal"> <%=Resources.DealerFinance.DealerSearchHeader%> </div>

 

</td>

 

</tr>

 

<tr>

 

<td height="10px" align="center" nowrap="nowrap" colspan="3" >

 

</td>

</tr>

 

<tr>

 

<td align="right" nowrap="nowrap">

 

<%

=Resources.DealerFinance.LegalName%>

</td>

 

<td align="left">

 

<asp:TextBox ID="txtLegalName" TabIndex="100" runat="server" MaxLength="30" size="30" ></asp:TextBox>

 

</td>

 

<td align="right" width="10px">

 

</td>

 

</tr>

 

<tr>

 

<td align="right" nowrap="nowrap">

 

<%

=Resources.DealerFinance.DBAName%>

</td>

 

<td align="left">

 

<asp:TextBox ID="txtDBAName" TabIndex="101" runat="server" MaxLength="30" size="30"></asp:TextBox>

 

</td>

 

<td align="right" width="10px">

 

</td>

 

</tr>

 

<tr>

 

<td align="right" nowrap="nowrap">

 

<%

=Resources.DealerFinance.KawasakiName%>

</td>

 

<td align="left">

 

<asp:TextBox ID="txtKawasakiName" TabIndex="102" runat="server" MaxLength="30" size="30"></asp:TextBox>

 

</td>

 

<td align="right" width="10px">

 

</td>

 

</tr>

 

<tr>

 

<td align="right" nowrap="nowrap">

 

<%

=Resources.DealerFinance.Address%>

</td>

 

<td align="left">

 

<asp:TextBox ID="txtAddress" TabIndex="103" runat="server" MaxLength="30" size="30"></asp:TextBox>

 

</td>

 

<td align="right" width="10px">

 

</td>

 

</tr>

 

<tr>

 

<td align="right" nowrap="nowrap">

 

<%

=Resources.DealerFinance.City%>

</td>

 

<td align="left">

 

<asp:TextBox ID="txtCity" TabIndex="104" runat="server" MaxLength="30" size="20"></asp:TextBox>

 

</td>

 

<td align="right" width="10px">

 

</td>

 

</tr>

 

<tr>

 

<td align="right" nowrap="nowrap">

 

<%

=Resources.DealerFinance.State%>

</td>

 

<td align="left">

 

<asp:TextBox ID="txtState" TabIndex="105" runat="server" MaxLength="10" size="10"></asp:TextBox>

 

</td>

 

<td align="right" width="10px">

 

</td>

 

</tr>

 

<tr>

 

<td align="right" nowrap="nowrap">

 

<%

=Resources.DealerFinance.Zip%>

</td>

 

<td align="left">

 

<asp:TextBox ID="txtZip" TabIndex="106" runat="server" MaxLength="10" size="10"></asp:TextBox>

 

</td>

 

<td align="right" width="10px">

 

</td>

 

</tr>

 

<tr>

 

<td align="right" nowrap="nowrap">

 

<%

=Resources.DealerFinance.PrincipalLastName%>

</td>

 

<td align="left">

 

<asp:TextBox ID="txtPrincipalLastName" TabIndex="107" runat="server" MaxLength="30"

 

size="30"></asp:TextBox>

 

</td>

 

<td align="right" width="10px">

 

</td>

 

</tr>

 

<tr>

 

<td align="right" nowrap="nowrap">

 

<%

=Resources.DealerFinance.PrincipalSSN%>

</td>

 

<td align="left">

 

<asp:TextBox ID="txtPrincipalSSN" TabIndex="108" runat="server" MaxLength="10" size="10"></asp:TextBox>

 

</td>

 

<td align="right" width="10px">

 

</td>

 

</tr>

 

<tr>

 

<td align="right" nowrap="nowrap">

 

<%

=Resources.DealerFinance.DealerNumber%>

</td>

 

<td align="left">

 

<asp:TextBox ID="txtDealerNumber" TabIndex="109" runat="server" MaxLength="10" size="10"></asp:TextBox>

 

</td>

 

<td align="right" width="10px">

 

</td>

 

</tr>

 

<tr>

 

<td align="center" colspan="2">

 

<br />

 

<!-- <asp:Button ID="btnSearch" runat="server" CausesValidation="false" OnClick="btnSearch_Click"

SkinID="DisplayButton" Text="Search" OnClientClick="SelectAgency()" /> -->

 

<asp:Button ID="Button1" runat="server" CausesValidation="false" OnClick="btnSearch_Click"

 

SkinID="DisplayButton" Text="Search" />

 

<asp:Button ID="btnCancel" runat="server" CausesValidation="false" OnClick="btnCancel_Click"

 

SkinID="DisplayButton" Text="Cancel" />

 

</td>

 

<td align="right" width="10px">

 

</td>

 

</tr>

 

</table>

 

</form>

</

body>

</

html>

code behind:

using

System;

using

System.Collections;

using

System.Configuration;

using

System.Data;

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

System.Web.UI.WebControls.WebParts;

using

System.Xml.Linq;

using

Telerik.Web.UI;

public

partial class Dealer_DealersSearch : System.Web.UI.Page

{

protected void Page_Load(object sender, EventArgs e)

{

//Teleric

this.Page.DataBind();

}

protected void btnSearch_Click(object sender, EventArgs e)

{

DealSearchFields dealerSearchFileldsObj = new DealSearchFields();

dealerSearchFileldsObj.LegalName = txtLegalName.Text;

dealerSearchFileldsObj.DBAName = txtDBAName.Text;

dealerSearchFileldsObj.KawasakiName = txtKawasakiName.Text;

dealerSearchFileldsObj.Address = txtAddress.Text;

dealerSearchFileldsObj.City = txtCity.Text;

dealerSearchFileldsObj.State = txtState.Text;

dealerSearchFileldsObj.Zip = txtZip.Text;

dealerSearchFileldsObj.PrincipalLastName = txtPrincipalLastName.Text;

dealerSearchFileldsObj.PrincipalSSN = txtPrincipalSSN.Text;

dealerSearchFileldsObj.DealerNumber = txtDealerNumber.Text;

//

Session[

"DealerSearchFields"] = dealerSearchFileldsObj;

Session[

"IsFromWindow"] = true;

//Teleric

InjectScript.Text =

"<script>CloseOnReloadandReLoad()</" + "script>";

}

protected void btnCancel_Click(object sender, EventArgs e)

{

//Teleric

InjectScript.Text =

"<script>CloseOnReload()</" + "script>";

}

}

Master Page:

 

@ Master Language="C#" AutoEventWireup="true" CodeFile="DealerFinance.master.cs" Inherits="DealerFinance"

%>

@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik"

%>

 

html xmlns

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

head runat

="server">

 

<title>Untitled Page</title

>

 

<link href="App_Themes/DealerFinance/DealerFinance.css" rel="Stylesheet" type="text/css"

/>

 

<link href="JavaScript/DealerFinance.js" type="text/javascript"

/>

 

<asp:ContentPlaceHolder ID="head" runat

="server">

 

</asp:ContentPlaceHolder

>

head

>

body

>

 

<form id="form1" runat

="server">

 

<telerik:RadScriptManager ID="RadScriptManager1" runat

="server">

 

</telerik:RadScriptManager

>

 

<table

>

 

<tr

>

 

<td

>

 

<telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" BorderColor

="Silver">

 

<telerik:RadTabStrip ID="rtsDealerMenu" runat="server" Skin="Web20" SelectedIndex

="0">

 

</telerik:RadTabStrip

>

 

</telerik:RadAjaxPanel

>

 

</td

>

 

</tr

>

 

<tr

>

 

<td

>

 

<asp:ContentPlaceHolder ID="DealerFinancePlaceHolder" runat

="server">

 

</asp:ContentPlaceHolder

>

 

</td

>

 

</tr

>

 

</table

>

 

</form

>

body

>

html

>

Master Page Code behind :

Yavor
Telerik team
 answered on 15 Sep 2008
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?