Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
572 views
Hi,

I am busy doing R&D to see if the RadGrid will work for us. So far it has been working fine, but I am struggling to retrieve a selected row's column names and values similar to the way you would do that for a DataTable. However, the e.Item.DataSetIndex appears to return the index of the current grid, not  the entire datatable bound to it which is incorrect for m purposes. I am using standard paging of 10 rows per page. I need a way to get hold of one or more column values for the current row selected, either by looking at the databable with the correct row index (as I have tried) or directly in the grid row itself.

The way I am implementing the RadGrid includes the following:

1. Making use of AutoGeneratedColumns
2. Binding DataTable to RadGrid followed by DataBind() event.
3. Subscribed to event handler OnNeedDataSource to rebind grid on postback.
4. Subscribed to event handler OnItemCommand to try and retrieve current row's values as described.

Here's a basic overview of my page class:

        protected void Page_Load(object sender, EventArgs e)
        {
                if (!Page.IsPostBack)
                {
                    BindGrid();
                }
        }

        private void BindGrid()
        {
            //Instantiate Buss Object
            buss_Menus = new CS_Business.CS_Menus(Session.SessionID);

            //Select Menu(s) from DB
            ds = buss_Menus.Select();
            
            Session["dataview_menus_list"] = ds.Tables[0].DefaultView;

            dv = (DataView)Session["dataview_menus_list"];

            rgDataGrid.DataSource = dv;
            rgDataGrid.DataBind();
        }

        protected void rgDataGrid_NeedDataSource(object source, GridNeedDataSourceEventArgs e)
        {
            dv = (DataView)Session["dataview_menus_list"];
            rgDataGrid.DataSource = dv;
        }

        protected void rgDataGrid_ItemCommand(object source, GridCommandEventArgs e)
        {
                DataView dv = (DataView)Session["dataview_menus_list"];
                DataRow dr = dv.Table.Rows[e.Item.DataSetIndex];
                string mnuName = dr["FRONTEND_NAME"].ToString();    //This is where the problem is right now
        }

Any help here would be appreciated.

Stefan Buys
Shinu
Top achievements
Rank 2
 answered on 22 May 2009
1 answer
62 views

 

I am attempting to rebind a grid (grdContributions) after the user has selected a row (client side selection) using the RowSelected event below:

function
RowSelected(sender, eventArgs)

 

{

 

 

 

 

 

 

 

    var tableView = $find("<%= grdContributionDetails.ClientID %>").get_masterTableView();

 

    tableView.set_dataSource(result);

    tableView.dataBind();

 

    

 

 

 

 

 

}

The following error is generated in the borwser when I compile the code:

    The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).


What I am trying to accomplish is to rebind a grid (grdContributionDetails) based upon the selection of a row in another grid (grdContribution).   The above event is fired when the user selects a row in grdContribution. 

What is causing this error and how can I resolve it?
Thank you,

Michael

Princy
Top achievements
Rank 2
 answered on 22 May 2009
8 answers
154 views
I have been trying to get resource views working with my Schedule control today and realized that it might not be fully implemented yet.  After doing some searching on your site, I found this article (http://blogs.telerik.com/tsvetomirtsonev/posts/09-02-20/web_service_binding_with_radscheduler_for_asp_net_ajax.aspx) that implied that grouped views are still pending completion. 

Is this true?  If so, do have a date for that release?

Thanks
SolutionStream
Top achievements
Rank 1
 answered on 21 May 2009
3 answers
219 views
Hello,

I've got an AJAX page with a modalpopupextender. The modal popup contains a text box and a link so that the user can spellcheck the text that they enter into the popup window.

The modal popup opens fine and displays the text to be edited. The user can click on the "Spell Check" link and the spell check dialog will open, but the dialog is BEHIND the modal popup.  Please let me know how to force the spell check dialog to appear in front of the modal popup. Thanks!

I will post sample page...
  - page runs and displays just a button.
  - click the button, and the modal popup window appears 
  - click the 'spell check' button.  The spell check dialog is behind the modal popup -- you can close the modal popup and the spell check dialog becomes visable.

I've looked at several other posts talking about z-index but can't find anything that solves this.

Thanks again
albert goodman
Top achievements
Rank 1
 answered on 21 May 2009
0 answers
92 views
I love Telerik Ajax components, but the weak link to me has always seemed to be RadUpload. One of the sites I use frequently is Elance. They have a file upload that is seamless, in-the-page, with no postback. You can easily demo this by going to elance.com, creating a new account, and then posting a new job. (You don't need to actually complete the process of posting a job to see this.) On the page where you post a job is a file upload component as I describe. There is a similar one in the workrooms, after you post a job, and apparently you can use this now to upload files of almost any size. I just uploaded a 40 GB file, it was slick.

How are they doing this? Why doesn't RadUpload work this way??? I would love to have this functionality available.
Michael Cranford
Top achievements
Rank 1
 asked on 21 May 2009
1 answer
137 views
I am trying to include an ImageDraw (Neodynamic) item in a RadRotator template. To use this object, I need to be able to access it through the Item_DataBound event. However, I cannot get "FindInControl" to function. Is there any way to do this?

    Protected Sub RadRotator1_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadRotatorEventArgs) Handles RadRotator1.ItemDataBound 
 
        Dim ImgElem As New ImageElement 
 
        Dim IDraw As Neodynamic.WebControls.ImageDraw.ImageDraw = RadRotator1.FindControl("ImageDraw1") 
        Dim labelPath As System.Web.UI.WebControls.Label = RadRotator1.FindControl("lblPath") 
        Dim labelUrl As System.Web.UI.WebControls.Label = RadRotator1.FindControl("lblUrl") 
 
        Dim Shadow As New Neodynamic.WebControls.ImageDraw.DropShadow 
        Shadow.Color = Drawing.Color.DimGray 
        Dim ResizeH As New Neodynamic.WebControls.ImageDraw.Resize 
        Dim ResizeW As New Neodynamic.WebControls.ImageDraw.Resize 
 
        ImgElem = ImageElement.FromFile(labelPath.Text.ToString) 
        ImgElem.Actions.Add(Shadow) 
        If ImgElem.Height > 400 Then 
            ResizeH.Height = 400 
            ResizeH.LockAspectRatio = LockAspectRatio.HeightBased 
            ImgElem.Actions.Add(ResizeH) 
        End If 
 
        If ImgElem.Width > 600 Then 
            ResizeW.Width = 600 
            ResizeW.LockAspectRatio = LockAspectRatio.WidthBased 
            ImgElem.Actions.Add(ResizeW) 
        End If 
        IDraw.Elements.Add(ImgElem) 
 
 
    End Sub 

ClarkSRoberts
Top achievements
Rank 1
 answered on 21 May 2009
0 answers
82 views
Hi,

I would like to have:
- an image to expand / collapse the panel bar
- an "iframe" just right to this image; this iframe contains some other form displayed on it
When I click the image, the panel bar (initially collapsed) should expand / collapse sliding over the iframe.

Is it possible?

Regards
Tomasz
tmlipinski
Top achievements
Rank 1
 asked on 21 May 2009
7 answers
275 views
Hi,
 I m having multiple datepicker on a page with customized footer, I want all of them to access a single javascript when an onclientclick() function is activated 
<telerik:RadDatePicker>
..
<FooterTemplate>
                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp
                            <asp:ImageButton ID="IBToday" runat="server" OnClientClick="SelectToday(); return false;" ImageUrl="~/Skins/Web20/Calendar/MonthYearTodayBtn.gif" />
</FooterTemplate>

</telerik:RadDatePicker>

function SelectToday()
{
    var currentDate = new Date()
    var picker = $find("<%= datepicker1.ClientID %>");
    
    picker.set_selectedDate(currentDate);   
    picker.hidePopup();     
}

Using $find can I identify the many date pickers on the page ? If yes ,How can i do it ? If No Please let me know the other way to do it .

Thanks
John
Top achievements
Rank 1
 answered on 21 May 2009
2 answers
293 views
Basically I have a RadPanel bar I want to use as a delete button.  I have the following PanelBar, take note of the onitemclick property:
<telerik:RadPanelBar ID="RadPanelBar1" runat="server" AppendDataBoundItems="True" 
                Skin="Web20" Width="198px" onitemclick="RadPanelBar1_ItemClick"
                <CollapseAnimation Type="None" Duration="100"></CollapseAnimation> 
                <Items> 
                    <telerik:RadPanelItem runat="server" Expanded="True" Text="Employees" SelectedCssClass="" 
                        ExpandedCssClass="" PreventCollapse="True" Value="Employees"
                        <Items> 
                            <telerik:RadPanelItem runat="server" Text="Add" SelectedCssClass="" CssClass="thickbox" 
                                NavigateUrl="CensusDetails.aspx?TB_iframe=true&height=550&width=600" title="Add New Employee"
                            </telerik:RadPanelItem> 
                            <telerik:RadPanelItem runat="server" Text="Terminate" SelectedCssClass=""  
                                Value="Terminate"
                            </telerik:RadPanelItem> 
                            <telerik:RadPanelItem runat="server" Text="Import (coming soon)" SelectedCssClass=""
                            </telerik:RadPanelItem> 
                        </Items> 
                    </telerik:RadPanelItem> 
                    <telerik:RadPanelItem runat="server" Text="Company" Value="Company" PreventCollapse="True"
                    </telerik:RadPanelItem> 
                </Items> 
                <ExpandAnimation Type="None" Duration="100"></ExpandAnimation> 
            </telerik:RadPanelBar> 

When any item is clicked, this server side code runs and checks the value of each item, if the value of the item is Terminate then it runs a delete method and deletes any items inside a radGrid on the same page:
    protected void RadPanelBar1_ItemClick(object sender, RadPanelBarEventArgs e) 
    { 
        switch (e.Item.Text) 
        { 
            case "Terminate"
                { 
                    foreach (GridDataItem row in CenusGrid.SelectedItems) 
                    { 
                         
                       TerminateEmployees(Convert.ToInt32(row.GetDataKeyValue("CensusID"))); 
                    } 
 
                    break
                } 
        } 
 
        CenusGrid.DataBind(); 
    } 

This works really well.  I wanted to add a confirm dialog to the mix so when they press the Terminate link it will confirm that they will indeed want to delete the selected records from the grid.  Usually I just add a client onclick event to buttons or links but I didn't see anything like that for the individual panel items.  So I put this in my PageLoad to add the attribute:
RadPanelItem radTerminate = RadPanelBar1.Items.FindItemByValue("Employees"); 
            switch (radTerminate.Items.FindItemByValue("Terminate").Value) 
            { 
                case "Terminate": 
                    { 
                        radTerminate.Items.FindItemByValue("Terminate").Attributes.Add("onclick", "javascript:return confirm('Are you sure you want to delete this record?')"); 
                        break; 
                    } 
            } 

This also works and I get a confirmation alert, however no matter what I press it still runs the serverside code and deletes the record.  Even if I press CANCEL it still deletes the record. 

Is there a way to get this to work with an alert even if I use the RadPanel?


drpcken
Top achievements
Rank 1
 answered on 21 May 2009
2 answers
629 views
is it possible to add a client-side onclick event to just one tab? i see there is the tabstrip event "onclienttabselected" but that fires when every tab is clicked. i only want to execute a function for one tab. if this is the case, the only option i can see is firing the event on every tab click and then checking if it is the tab i want (is there a way to look up tabs client-side by index?), then processing accordingly. any guidance here would be helpful.

thanks,
drew
Drew
Top achievements
Rank 1
 answered on 21 May 2009
Narrow your results
Selected tags
Tags
+? more
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?