Telerik Forums
UI for ASP.NET AJAX Forum
4 answers
158 views
Hi All,

I have a radgrid and also i have a Next button above the grid.

I wanted to show next row selected from current row on next button click through javascript
(i do not want to postback the page while doing all this activity).

if no any row is selected previously than 1st row should get selected

Please help me it's very urgent.

Thanks in advance

Chandan
Princy
Top achievements
Rank 2
 answered on 11 Jan 2013
4 answers
1.0K+ views
Hi,

I am trying to get a column value of a selected row in the radgrid.
I am using "DataKeyValues" in my C# code to retrieve the value. But it always returns an empty string. When I debug I can see the key but the value for that is empty. 
Following is my code. Please let me know if I am missing something.

Thank you,
Lahiru

ASPX page
<telerik:RadGrid ID="gridDevices" runat="server" Width="900" AllowSorting="true"   
                  AllowCustomPaging="True" AllowPaging="True" AllowFilteringByColumn="true" 
                    PageSize="10" AllowMultiRowSelection="true" OnItemCommand="RadGrid1_ItemCommand">
                <MasterTableView DataKeyNames="DeviceID"   ClientDataKeyNames="DeviceID">
            <Columns>            
                <telerik:GridBoundColumn DataField="DeviceID"  Visible="false" UniqueName="DeviceID">
                </telerik:GridBoundColumn>
             <telerik:GridTemplateColumn HeaderText="IP Address" 
                ShowFilterIcon="false" AutoPostBackOnFilter="true" UniqueName="IPAddress" DataField="IPAddress" SortExpression="IPAddress">  
                <ClientItemTemplate>
                <span title="View device web page"><a href="http://#=IPAddress#" target="_blank">#=IPAddress#</a>
</span>
                </ClientItemTemplate>
                </telerik:GridTemplateColumn> 
                <telerik:GridTemplateColumn Visible="true" HeaderText="MAC Address" ShowFilterIcon="false" AutoPostBackOnFilter="true" UniqueName="MACAddress" DataField="MACAddress" SortExpression="MACAddress">
                <ClientItemTemplate>
                <span title="#=MACAddress#> #=MACAddress# </span>
                </ClientItemTemplate>
                </telerik:GridTemplateColumn> 
        </Columns>
        </MasterTableView>
        <PagerStyle Mode="Slider" AlwaysVisible="true" ></PagerStyle>      
       <ClientSettings>
            <DataBinding Location="SupplyGridData.asmx" SelectMethod="GetDeviceRecords">
            </DataBinding>
            <ClientEvents  OnDataBinding="DevicesGrid_DataBinding" >          
            </ClientEvents>        
            <Selecting AllowRowSelect="True"></Selecting>
        </ClientSettings>
                </telerik:RadGrid>


C# Code
protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e)
        {
            if (e.Item is GridDataItem)
            {
                GridDataItem dataItem = (GridDataItem)e.Item;
                string deviceID = dataItem.OwnerTableView.DataKeyValues[dataItem.ItemIndex]["DeviceID"].ToString();
            }
            
        }
Shinu
Top achievements
Rank 2
 answered on 11 Jan 2013
1 answer
248 views
I have a .aspx/web form that uses the Rad Decorator.  I am using one of the Responsive frameworks on the page and have constructed a menu using ul/li that will morph into a combo box when the page width decreases past a certain point.  This is all working fine.

I would like to use the RadComboBox for the mobile-sized menu container but I cannot seem to control visibility of the RadComboBox during page size changes using the normal method of doing so from media queries -- see below.

nav select {
    display: none;
}
nav RadComboBox { display: none; }
 
@media (max-width: 800px) {
  nav ul     { display: none; }
  nav select { display: inline-block; }
  nav RadComboBox { display: inline-block; }
}

When I try to use the styles, they appear to have no effect whatsoever on the RadComboBox.  I have tried telling the Rad Decorator to ignore SELECT controls to no avail.

Is there a way through the CSS that I can control the visibility of the RadComboBox when the RadDecorator is being used?

Thanks in advance!

Lynn
Lynn
Top achievements
Rank 2
 answered on 11 Jan 2013
1 answer
91 views
We are looking to implement a responsive UI application which allows server-side events (i.e. data, sql, etc.) to be pushed to clients and have the UI refresh but not lose context. For example, we have a prototype working w/INotifyRefresh and a WPF app. However, we would like to explore the idea of doing a web app.

The new ASP.NET version has support for SignalR which allows for server events and data to be pushed to the client. Can we achieve this in ASP.NET or MVC w/out writing a massive amount of code? The application uses listviews w/checkboxes, the underlying data (ids & text) is changed, added or removed while leaving valid, existing checked state.
Alex
Top achievements
Rank 1
 answered on 10 Jan 2013
2 answers
243 views
I have a RadGrid where I am auto generating columns because they can changed depending on the source. And I want to display only certain columns and in a specific order. Its easiest for me to store the columns to display in a comma delimited string. I created the code below to try to do this. However it fails because in the Page_Load method the grid.MasterTableView.Columns is always empty, even though I do a DataBind first. Any idea how I can get this to work?

Thanks,
Jason

protected void Page_Load(object sender, EventArgs e)
{
    if (!IsPostBack)
    {
        // bind
        grid.MasterTableView.DataBind();
        grid.DataBind();
  
        // columns
        var cols = grid.MasterTableView.Columns;
        foreach (GridColumn c in cols)
        {
            c.Visible = false;
        }
        // fieldNames is a comma delimited list of column names in the correct order
        var fields = fieldNames.Split(new char[',']);
        for (var j = 0; j < fields.Length; j++)
        {
            var c = cols.FindByUniqueNameSafe(fields[j]);
            if (c != null)
            {
                c.Visible = true;
                c.OrderIndex = j;
            }
        }
    }
}
Jason
Top achievements
Rank 1
 answered on 10 Jan 2013
5 answers
229 views
for test , we download the trial version of telerik and face following problems 
It Dosnot have  any problem on local Dnn Portal,but it takes us the bellow error on main website
 " Error loading RadChart inage ..." .
we added the tag Shown on first load of radchart in Web.Config > httphandler Section .
and add folder radcontrols>chart wich contains file image.aspx.
Please Guid us as soon as posible.
Lori
Top achievements
Rank 1
 answered on 10 Jan 2013
0 answers
83 views
One of our users alerted us to a problem in Chrome with the RAD grid control.  He has about 100 items and after the operation (insert/delete) completes, the grid doesn't redraw.  If you move the mouse over the rows, it will redraw around the cursor as you move it.   Once you scroll the screen, it redraws the pieces that go off screen.   See attached screenshots.

We were only able to reproduce the problem in Chrome.  It worked fine in IE and Firefox.  I was just wondering if anyone else has seen similar issues.  We had not seen such problems before and I wondered if it wasn't something broken in the last Chrome update.

Thanks!
HorseFly
Top achievements
Rank 1
 asked on 10 Jan 2013
6 answers
578 views
I'm trying to change the tab text in javascript.  I thought it would be a simple task but I haven't had any success with anything I've tried.

The first thing I tried was tab.set_text("NewValue").  This set the text property in the tab client object but didn't update the text currently visible to users. 

I then tried to get the DOM element for the tab text to update it directly using tab.get_textElement() but that comes back as null.

Does anyone have any idea how to update the tab text so it's updated in the browser?
Chris
Top achievements
Rank 1
 answered on 10 Jan 2013
2 answers
215 views
Hi there,

I cannot get the correct pagesize selected when I use AllowCustomPaging="true".
When you look in the code below I can see PAGESIZE_NEW is set to the new pagesize selected (f.e. 50) in the grHit_PageSizeChanged event.
After that it hits the grHit_NeedDataSource event. The PAGESIZE variable is set to it's original value of 25 instead of 50 like the value in the grHit_PageSizeChanged event.

Any idea?

I am using Telerik: 202.3.1016.35.


Regards,

Marcel

    <head>
        <title>HitGrid</title>
    </head>
    <body
        <telerik:RadGrid ID="grHit" runat="server"
            OnNeedDataSource="grHit_NeedDataSource"
            OnDetailTableDataBind="grHit_DetailTableDataBind"  OnPageSizeChanged="grHit_PageSizeChanged"
            OnItemCreated="grHit_ItemCreated">
 
            <MasterTableView AutoGenerateColumns="False"
                AllowSorting="true"
                AllowNaturalSort="false"
                AllowFilteringByColumn="true"
                AllowPaging="true"
                AllowCustomPaging="true"
                DataKeyNames="Date hit, User id, Application id, Function id">
 
                <Columns>
                    <telerik:GridDateTimeColumn UniqueName="coDateHit" HeaderText="Date"
                        MinDate="1899/12/30"
                        DataField="Date hit" >
                    </telerik:GridDateTimeColumn>
                     
                    <telerik:GridBoundColumn UniqueName="coUserName" HeaderText="User"
                        DataField="User name" >
                    </telerik:GridBoundColumn>
                     
                    <telerik:GridBoundColumn UniqueName="coFunctionName" HeaderText="Function"
                        DataField="Function name" >
                    </telerik:GridBoundColumn>
                      
                    <telerik:GridBoundColumn UniqueName="coIPAddress" HeaderText="IP address"
                        DataField="User host address" >
                    </telerik:GridBoundColumn>
                     
                    <telerik:GridBoundColumn UniqueName="coBrowser" HeaderText="Browser"
                        DataField="Browser" >
                    </telerik:GridBoundColumn>
                </Columns>
 
                <DetailTables>
                    <telerik:GridTableView Name="HitDetail"
                        AutoGenerateColumns="False"
                        ShowHeader="false"
                        Width="100%">
                         
                        <Columns>
                            <telerik:GridBoundColumn UniqueName="coColumn1"
                                DataField="Column 1" >
                            </telerik:GridBoundColumn>
                             
                            <telerik:GridBoundColumn UniqueName="coColumn2"
                                DataField="Column 2" >
                            </telerik:GridBoundColumn>
                        </Columns>
                         
                    </telerik:GridTableView>
                </DetailTables>
 
            </MasterTableView>
             
        </telerik:RadGrid>
    </body>
</html>

public partial class HitGrid : System.Web.UI.UserControl
    {
        public int WIDTH
        {
            //totale breedte
            set
            {
                grHit.Width = Unit.Percentage(value);
            }
        }
 
        override protected void OnInit(EventArgs e)
        {
            InitializeComponent();
            base.OnInit(e);
        }
 
        private void InitializeComponent()
        {
            //sorting
            Telerik.Web.UI.GridSortExpression sortExpr = new Telerik.Web.UI.GridSortExpression();
            sortExpr.FieldName = "Date hit";
            sortExpr.SortOrder = Telerik.Web.UI.GridSortOrder.Descending;
            grHit.MasterTableView.SortExpressions.AddSortExpression(sortExpr);
 
            //paging
            grHit.PageSize = Convert.ToInt16(ConfigurationManager.AppSettings.Get("Page size"));
        }
 
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //initialise
                HITGRID_INIT();
            }
        }
 
        private void HITGRID_INIT()
        {}
 
        protected void grHit_ItemCreated(object sender, Telerik.Web.UI.GridItemEventArgs e)
        {
            if (e.Item is Telerik.Web.UI.GridFilteringItem)
            {
                Telerik.Web.UI.GridFilteringItem FilterItem = e.Item as Telerik.Web.UI.GridFilteringItem;
 
                //User
                TextBox txtUserName = FilterItem["coUserName"].Controls[0] as TextBox;
                txtUserName.Width = Unit.Pixel(100);
 
                //Function
                TextBox txtFunctionName = FilterItem["coFunctionName"].Controls[0] as TextBox;
                txtFunctionName.Width = Unit.Pixel(100);
 
                //IP address
                TextBox txtIPAddress = FilterItem["coIPAddress"].Controls[0] as TextBox;
                txtIPAddress.Width = Unit.Pixel(80);
 
                //Browser
                TextBox txtBrowser = FilterItem["coBrowser"].Controls[0] as TextBox;
                txtBrowser.Width = Unit.Pixel(100);
            }
        }
 
        protected void grHit_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
        {
            int PAGESIZE = grHit.PageSize;
 
            //get hits
            NMHG.Data.NMHGHome.HOH100PF.GetHits2 HOH100PF_List = new NMHG.Data.NMHGHome.HOH100PF.GetHits2();
            HOH100PF_List.H1APID = "";
            HOH100PF_List.H1USID = "";
            HOH100PF_List.PageNumber = grHit.CurrentPageIndex;
            HOH100PF_List.Main();
 
            //fill grid
            grHit.DataSource = HOH100PF_List.HitTable;
 
            //set virtual item count
            grHit.VirtualItemCount = HOH100PF_List.COUNT;
        }
 
        protected void grHit_PageSizeChanged(object source, Telerik.Web.UI.GridPageSizeChangedEventArgs e)
        {
            int PAGESIZE_NEW = e.NewPageSize;
        }
 
        protected void grHit_DetailTableDataBind(object source, Telerik.Web.UI.GridDetailTableDataBindEventArgs e)
        {
            Telerik.Web.UI.GridDataItem DataItem = (Telerik.Web.UI.GridDataItem)e.DetailTableView.ParentItem;
            switch (e.DetailTableView.Name)
            {
                case "HitDetail":     //Hit detail
 
                    //get hit
                    NMHG.Data.NMHGHome.HOH100PF.Hit HOH100PF = new NMHG.Data.NMHGHome.HOH100PF.Hit();
                    HOH100PF.H1DATE = (DateTime)DataItem.GetDataKeyValue("Date hit");          //Date hit
                    HOH100PF.H1USID = DataItem.GetDataKeyValue("User id").ToString();           //User id
                    HOH100PF.H1APID = DataItem.GetDataKeyValue("Application id").ToString();    //Application id
                    HOH100PF.H1FNID = DataItem.GetDataKeyValue("Function id").ToString();       //Function id
                    HOH100PF.GetHit();
 
                    //initialise datatable
                    DataTable HitTable = new DataTable("Hit detail data");
                    HitTable.Columns.Add("Column 1", System.Type.GetType("System.String"));
                    HitTable.Columns.Add("Column 2", System.Type.GetType("System.String"));
 
                    //Date
                    DataRow HitRow = HitTable.NewRow();
                    HitRow["Column 1"] = "Date:";
                    HitRow["Column 2"] = HOH100PF.H1DATE;
                    HitTable.Rows.Add(HitRow);
 
                    //get username
                    NMHG.Data.NMHGHome.AUUS00PF.User AUUS00PF = new NMHG.Data.NMHGHome.AUUS00PF.User();
                    AUUS00PF.USUSID = HOH100PF.H1USID;
                    AUUS00PF.GetUser();
 
                    //User
                    HitRow = HitTable.NewRow();
                    HitRow["Column 1"] = "User:";
                    HitRow["Column 2"] = AUUS00PF.USUSNM;
                    HitTable.Rows.Add(HitRow);
 
                    //get application function name
                    NMHG.Data.NMHGHome.AUAF00PF.ApplicationFunction AUAF00PF = new NMHG.Data.NMHGHome.AUAF00PF.ApplicationFunction();
                    AUAF00PF.AFAPID = HOH100PF.H1APID;
                    AUAF00PF.AFFNID = HOH100PF.H1FNID;
                    AUAF00PF.GetApplicationFunction();
 
                    //Function
                    HitRow = HitTable.NewRow();
                    HitRow["Column 1"] = "Function:";
                    HitRow["Column 2"] = AUAF00PF.AFFNNM;
                    HitTable.Rows.Add(HitRow);
 
                    //URL
                    HitRow = HitTable.NewRow();
                    HitRow["Column 1"] = "URL:";
                    HitRow["Column 2"] = HOH100PF.H1URL;
                    HitTable.Rows.Add(HitRow);
 
                    //IP address
                    HitRow = HitTable.NewRow();
                    HitRow["Column 1"] = "IP address:";
                    HitRow["Column 2"] = HOH100PF.H1ADDR;
                    HitTable.Rows.Add(HitRow);
 
                    //Platform
                    HitRow = HitTable.NewRow();
                    HitRow["Column 1"] = "Platform:";
                    HitRow["Column 2"] = HOH100PF.H1PLAT;
                    HitTable.Rows.Add(HitRow);
 
                    //Browser
                    HitRow = HitTable.NewRow();
                    HitRow["Column 1"] = "Browser:";
                    HitRow["Column 2"] = HOH100PF.H1BRWS;
                    HitTable.Rows.Add(HitRow);
 
                    //fill grid
                    grHit.DataSource = HitTable;
 
                    break;
            }
        }
    }

Marcel
Top achievements
Rank 1
 answered on 10 Jan 2013
7 answers
192 views
RadDockZone1.Docks.Sort(Function(dock1 As RadDock, dock2 As RadDock) dock1.Index.CompareTo(dock2.Index))
 
       For Each dock As RadDock In RadDockZone1.Docks
           For Each control As Control In dock.ContentContainer.Controls(0).Controls
               If (TypeOf control Is CheckBox) Then
                   checkBox = CType(control, CheckBox)
                   If checkBox.Checked Then
                       selectedWebParts.Add(dock.ID)
                   End If
               End If
           Next
       Next

I have a RadDockZone in which i am adding docks at runtime.
User can drap and drop any dock and can change their position in RadDockZone.
Now on postback, I am trying to get the docks from Raddockzone ordered be Dock index.
I am using the above code but it is not working the way I want.

Could you please help me to get the docks from Raddockzone ordered by their index.
Slav
Telerik team
 answered on 10 Jan 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?