Telerik Forums
UI for ASP.NET AJAX Forum
12 answers
181 views
When I go to Property Builder --> Master table --> Columns I can't see my database columns neither in Available columns pane nor in Selected columns pane.
Any idea why is this happening?
Princy
Top achievements
Rank 2
 answered on 14 Nov 2008
1 answer
445 views
Hi

Im trying to create a Grid entirely from code. But I am experiencing som problems when I add a "GridButtonColumn" and specify a CommandName. In "RadGrid_ItemCommand" when I check the value of e.CommandName I get an empty string.

This I how my column is defined:

Telerik.Web.UI.GridButtonColumn cColumn3 = new Telerik.Web.UI.GridButtonColumn();  
cColumn3.HeaderText = "Header1";  
cColumn3.UniqueName = "column1";  
cColumn3.DataTextField = "name";  
cColumn3.CommandName = "ModifyItem"; 

If the add the column to my grid the "standard" way like:

<MasterTableView> 
    <Columns> 
       <telerik:GridButtonColumn HeaderText="Header1" UniqueName="column1" CommandName="ModifyItem" DataTextField="name"/>
    </Columns> 
</MasterTableView> 
 

.. then it works fine (e.CommandName = "ModifyItem").

Does anyone know if the is a bug when setting the "CommandName" in code.

Could anyone please provide me with a working example of creating a GridButtonColumn from code with a CommandName that can be checked in the even "ItemCommand".

Thanks In advance
Shinu
Top achievements
Rank 2
 answered on 14 Nov 2008
3 answers
209 views
I programatically generate radgrid through PlaceHolder.
I also created a sub called "RadGrid1_ItemDataBound".
but how do I execute it since there is no property "OnItemDataBound" in runtime.

I need to be able to click on the link from boundLinkColumn and display radwindow.

Please help.
Thanks
Den
Shinu
Top achievements
Rank 2
 answered on 14 Nov 2008
3 answers
127 views
I have an grid where I am programatically handling the edit command (it displays a panel, etc...). However, I cannot seem to be able to prevent the auto-generated edit form from appearing below the item for which I clicked "Edit". I can make it a pop-up or even a custom form, but not prevent it. Is there a way to do this?
Shinu
Top achievements
Rank 2
 answered on 14 Nov 2008
3 answers
182 views
 Is there  a way dependency can be established between 2 dropdown controls in the grid.

Also if i have a dropdown control outside the grid on the form, can the dropdown control in grid be dependent on dropdown control outside the grid. Can this depenedency be established?

Thanks
Yavor
Telerik team
 answered on 14 Nov 2008
1 answer
162 views
I need to be able to create something like this
http://www.telerik.com/help/aspnet-ajax/grdcustomizewithgridtemplatecolumn.html

From the code behind but I couldn't find headerTemplate property

RadGrid1.Columns(1).headerTemplate()


Please help
Den
Princy
Top achievements
Rank 2
 answered on 14 Nov 2008
1 answer
130 views

Hi,

 

 

   I am generating the RadGrid (ASPNET AJAX Q1 2008) dynamically (Creating entire grid programmatically). Since the grid has child controls (as part of GridTemplateColumn & PagerTemplate) I had set EnableViewState = False for Grid as well as page (according to this article: http://www.telerik.com/help/aspnet-ajax/grdprogrammaticcreation.html). But the problem is I have “ImageButton” inside GridTemplateColumn. It has CommandName property set. When I click on the ImageButton, it does not trigger “ItemCommand” event handler. But the LinkButton works perfect. So, in order to make sure I am doing right; I had created a sample project which does the similar functionality. Here is the code:

 

 

<%@ Page Language="C#" AutoEventWireup="True" EnableEventValidation="false" CodeBehind="RadGridTest.aspx.cs" Inherits="Adc.Web.AdBid.Views.CampaignView.RadGridTest" %>

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

 

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

<head runat="server">

    <title></title>

</head>

<body>

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

     <asp:ScriptManager ID="ScriptManager1" runat="server"/>

        <telerik:RadGrid ID="rad" runat="server" runat="server" EnableViewState="False"  OnNeedDataSource="RadGrid_NeedDataSource"

             OnItemCommand="RadGrid_ItemCommand" OnItemDataBound="RadGrid_ItemDataBound"   AllowPaging="true" AutoGenerateColumns="false" 

             HeaderStyle-Wrap="true"  PagerStyle-AlwaysVisible="true">            

                <MasterTableView  PagerStyle-AlwaysVisible="true" EditMode="InPlace" TableLayout="Auto" ShowFooter="True" >

                <Columns>

                <telerik:GridTemplateColumn UniqueName="CampaignName" DataField="CampaignName" HeaderText="Campaign Name">

                        <ItemTemplate>

                            <asp:LinkButton ID="testCampaignBtn" runat="server" CommandName="Campaign" Text='<%# DataBinder.Eval(Container.DataItem,"CampaignName") %>'></asp:LinkButton>

                            <asp:ImageButton ID="testCBtn" runat="server" CommandName="EditCampaign" ImageUrl="~/Images/edit_icon.gif" EnableViewState="true" />

                        </ItemTemplate>

                    </telerik:GridTemplateColumn>

                   

                    <telerik:GridBoundColumn UniqueName="Status" DataField="Status" HeaderText="Status"></telerik:GridBoundColumn>

                    <telerik:GridTemplateColumn UniqueName="EditCampaignImage">

                        <ItemTemplate>

                            <asp:ImageButton ID="testImageBtn" runat="server" CommandName="EditCampaign" ImageUrl="~/Images/edit_icon.gif" EnableViewState="true" />

                        </ItemTemplate>

                    </telerik:GridTemplateColumn>

                </Columns>

                <RowIndicatorColumn Visible="False">

                    <HeaderStyle Width="20px" />

                </RowIndicatorColumn>

                <ExpandCollapseColumn Visible="False" Resizable="False">

                    <HeaderStyle Width="20px" />

                </ExpandCollapseColumn>

                <EditFormSettings>

                    <PopUpSettings ScrollBars="None" />

                </EditFormSettings>

                </MasterTableView>

        </telerik:RadGrid>

    </form>

</body>

</html>

 

 

Code Behind:

 

 

using System;

using System.Collections.Generic;

using System.Linq;

using System.Web;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.UI.HtmlControls;

using System.Globalization;

 

using Telerik.Web.UI;

 

using Adc.SelfService.Patterns;

using Adc.SelfService.Configuration;

using Adc.SelfService.AdBid;

using Adc.Data.AdBid;

using Adc.Web.AdBid.Common;

using Adc.Web.UI.Controls;

using Adc.Services.Adbid;

using Adc.SelfService;

 

namespace Adc.Web.AdBid.Views.CampaignView

{

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

    {

        Guid OrderId = new Guid("3bfd9791-daba-4e62-bb42-c02ba465992f");

        protected void Page_Load(object sender, EventArgs e)

        {

           

        }

        protected void RadGrid_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)

        {

            LoadCampaignData();

 

        }

        protected void RadGrid_ItemCommand(object sender, GridCommandEventArgs e)

        {

             switch(e.CommandName)

            {

                case "EditCampaign":

                    string str = "Do Something";

                    str = str + "...";

                    break;

                 case "Campaign":

                    string str1 = "Do Campaign";

                    str1 = str1 + "...";

                    break;

             }

        }

        protected void RadGrid_ItemDataBound(object sender, GridItemEventArgs e)

        {

        }

        private void LoadCampaignData()

        {

            if (OrderId != null && OrderId != Guid.Empty)

            {

                object[] param = new object[4];

                param[0] = OrderId;

                param[1] = null;// (string.IsNullOrEmpty(campaignSummaryView.SortFieldName)) ? "" : campaignSummaryView.SortFieldName;

                param[2] = null;// campaignSummaryView.SortOder;

                param[3] = Adc.Data.AdBid.CampaignStatus.All;

                CampaignPresenter p = new CampaignPresenter();

                CampaignDataMiner miner = new CampaignDataMiner();

                ISelfServiceViewData data = miner.GetData(param);

                CampaignCollection cc = ((Adc.Data.AdBid.Campaign)data).CampaignSummaryCollection; ;

                rad.DataSource = cc;

                rad.VirtualItemCount =  miner.GetVirtualItemCount(param);

            }

        }

     }

}

 

  Note that it’s a sample project for your reference. In actual project I am generating the grid programatically. Please provide the solution to this at the earliest. Some one can please help me with a better solution.

Shinu
Top achievements
Rank 2
 answered on 14 Nov 2008
1 answer
112 views
I have been playing around with the RadFormDecorator and find that if I place an ASP Panel on the page and then set the RadFormDecorator DecoratedControls to All that it renders the panel and the items in the panel wrong in IE7 but all looks good in FF3. First of all the panel will not heed to any width calls, for some reason it will shrink the panel to fit the controls in it. The next item is I have a table inside the panel and I set the TR to valign=TOP and once again in IE7 it does not move to the top but stays in the center of the row. Both of these issues work fine in FF3. I have traced it down to the Fieldset in the DecoratedControls that changes the panel display.

Thanks,
Walter Burditt
Martin
Telerik team
 answered on 14 Nov 2008
1 answer
97 views
How can I use the grid to assign data from the client side only?

I want to use if for a shopping cart: I'll add items via javascript to the grid when the user clicks on 'add to cart' for an item. But I'd rather not go back to the server with a postback for cart adds.

so, for example (roughly):

//...page init...  
var items = new Array()   
 
//...elsewhere when add item clicked...  
var item = {"PartNumber", partNumber, "Name":partName};
addToCart(item);  
 
function addToCart(item) {  
  var cartGrid = $find("cartGridId");  
  if(cartGrid) {  
    items.push(item);  
    cartGrid.DataSource = items;  
  }  
} 

I already know this isn't working, but it gives the sense of what I'd like to do.

Any guidance?

Thanks!
Scott
Princy
Top achievements
Rank 2
 answered on 14 Nov 2008
1 answer
101 views
hello
I have a RadGrid with MasterTableView and a DetailTableView. In my DetailTableView, when I edit my record, I have a RadDatePicker where I want to put the value of my field "DATE_DEBUT_EMPLOI" So I did it that way and that's working fine.

 

<telerik:GridTemplateColumn

 

 

UniqueName="TemplateColumnDateDebutEmploi"

 

 

HeaderText="Date de d‚but de l'emploi"

 

 

DataField="DATE_DEBUT_EMPLOI">

 

 

<ItemTemplate>

 

 

<asp:Label ID="LbDATE_DEBUT_EMPLOI" runat="server" Text='<%#Eval("DATE_DEBUT_EMPLOI") %>'></asp:Label>

 

 

</ItemTemplate>

 

 

<EditItemTemplate>

 

 

<telerik:RadDatePicker ID="DPicker_DATE_DEBUT_EMPLOI" selecteddate='<%#Eval("DATE_DEBUT_EMPLOI") %>' Runat="server">

 

 

<Calendar ID="Calendar_DATE_DEBUT_EMPLOI" UseColumnHeadersAsSelectors="False" runat="server" UseRowHeadersAsSelectors="False" ViewSelectorText="x"></Calendar>

 

 

</telerik:RadDatePicker>

 

 

</EditItemTemplate>

 

 

</telerik:GridTemplateColumn>

My problem is when I click on add new record for my detailTableView, I get the errror
"not a valid cast" (rapid traduction french to english by myself)
on the line 

 

<

telerik:RadDatePicker ID="DPicker_DATE_DEBUT_EMPLOI" selecteddate='<%#Eval("DATE_DEBUT_EMPLOI") %>' Runat="server">
What can I do to have the value of my field in that control when I edit but not having an erreur when I try to create a new record in my detailtableview

Thanks again in advance!

(I LOOOOVVVEEEE this forum!)

 

Shinu
Top achievements
Rank 2
 answered on 14 Nov 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?