Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
93 views
I have a RadGrid with single row edit capability, and a button that acts as a "Submit" button.  I'm handling the grid's UpdateCommand event on the server, doing some processing, and trying to change the submit button's OnClientClick event.  Basically, depending on what happens when the server processes the update, I want the submit button to hit one of a few different js functions.  I'm having trouble reliably updating the button's event.  It seems as though it needs a full page postback to take effect.  What is the recommended approach for this?
Eyup
Telerik team
 answered on 24 Dec 2012
3 answers
149 views
I have problem in radgrid when biding data by List (not EntitiesDataSource or LinqDataSource or SqlDatasource).

<telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="True" AllowSorting="True"
        CellSpacing="0" AllowAutomaticDeletes="True" AllowAutomaticInserts="True" AllowAutomaticUpdates="True"
        ShowStatusBar="True" OnDeleteCommand="RadGrid1_DeleteCommand" OnInsertCommand="RadGrid1_InsertCommand"
        OnNeedDataSource="RadGrid1_NeedDataSource" OnUpdateCommand="RadGrid1_UpdateCommand"
        GridLines="None" Skin="Metro" OnItemDataBound="RadGrid1_ItemDataBound">
        <ExportSettings ExportOnlyData="True" IgnorePaging="True" OpenInNewWindow="True">
            <Excel Format="Biff" />
        </ExportSettings>
        <MasterTableView CommandItemDisplay="Top" EditMode="InPlace" InsertItemPageIndexAction="ShowItemOnCurrentPage"
            AutoGenerateColumns="False" DataKeyNames="ID" GridLines="Both">
            <CommandItemSettings ExportToPdfText="Export to PDF" AddNewRecordText="Thêm mới"
                ExportToExcelText="Xuất Excel" RefreshText="Làm mới" ShowExportToExcelButton="True">
            </CommandItemSettings>
            <RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column">
                <HeaderStyle Width="20px"></HeaderStyle>
            </RowIndicatorColumn>
            <ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column">
                <HeaderStyle Width="20px"></HeaderStyle>
            </ExpandCollapseColumn>
            <Columns>
                <telerik:GridDropDownColumn DataField="ProviderId" DataType="System.Int64" FilterControlAltText="Filter ProviderId column"
                    HeaderText="Nhà cung cấp" SortExpression="ProviderId" ListTextField="ProviderName"
                    ListValueField="ProviderId" UniqueName="ProviderId" ColumnEditorID="GridDropDownColumnEditor1"
                    DropDownControlType="RadComboBox" runat="server">
                </telerik:GridDropDownColumn>
           <%--     <telerik:GridTemplateColumn HeaderText="Nhà cung cấp" UniqueName="ProviderID">
                     <ItemTemplate>
                         <asp:DropDownList ID="ddlProvider" runat="server"/>
                     </ItemTemplate>
                 </telerik:GridTemplateColumn>--%>
                <telerik:GridBoundColumn DataField="Buys" DataType="System.Decimal" FilterControlAltText="Filter Buys column"
                    HeaderText="Buys" SortExpression="Buys" UniqueName="Buys">
                </telerik:GridBoundColumn>
                <telerik:GridDateTimeColumn DataField="Date" DataType="System.DateTime" FilterControlAltText="Filter Date column"
                    HeaderText="Date" SortExpression="Date" UniqueName="Date">
                </telerik:GridDateTimeColumn>
                <telerik:GridBoundColumn DataField="Commen" FilterControlAltText="Filter Commen column"
                    HeaderText="Commen" SortExpression="Commen" UniqueName="Commen">
                </telerik:GridBoundColumn>
                <telerik:GridButtonColumn ConfirmText="Bạn muốn xóa hóa đơn này ?" ConfirmDialogType="RadWindow"
                    ConfirmTitle="Delete" ButtonType="ImageButton" CommandName="Delete" />
                <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn">
                    <ItemStyle CssClass="MyImageButton" Width="30px"></ItemStyle>
                </telerik:GridEditCommandColumn>
            </Columns>
            <EditFormSettings>
                <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                </EditColumn>
            </EditFormSettings>
        </MasterTableView>
        <FilterMenu EnableImageSprites="False">
        </FilterMenu>
    </telerik:RadGrid>

And here is code behind


protected void Page_Load(object sender, EventArgs e)
{
    
}
 
protected void RadGrid1_DeleteCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
{
    Int64 purchaseId = Convert.ToInt64((e.Item as GridDataItem).GetDataKeyValue("ID"));
    INPUTITEMDAO.Delete(purchaseId);
    RadGrid1.Rebind();
    //Reresh grid
    RadGrid1.MasterTableView.ClearEditItems();
}
 
protected void RadGrid1_InsertCommand(object sender, GridCommandEventArgs e)
{
    GridEditableItem item = e.Item as GridEditableItem;
    Hashtable values = new Hashtable();
    item.ExtractValues(values);
    INPUTITEM objInputItem=new INPUTITEM();
    item.UpdateValues(objInputItem);
 
    INPUTITEMDAO.InsertAndUpdate(objInputItem);
    RadGrid1.Rebind();
    RadGrid1.MasterTableView.ClearEditItems();
}
 
protected void RadGrid1_UpdateCommand(object sender, GridCommandEventArgs e)
{
    GridEditableItem item = e.Item as GridEditableItem;
    Int64 purchaseId =Convert.ToInt64(item.GetDataKeyValue("ID").ToString());
    INPUTITEM objInputItem = DataOut.GetAllINPUTITEMList().Where(i => i.ID == purchaseId).FirstOrDefault();
    item.UpdateValues(objInputItem);
    INPUTITEMDAO.InsertAndUpdate(objInputItem);
    RadGrid1.Rebind();
    RadGrid1.MasterTableView.ClearEditItems();
}
 
protected void RadGrid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
{
    RadGrid1.DataSource = DataOut.GetAllINPUTITEMList();
}
 
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
{
    GridEditableItem editedItem = e.Item as GridEditableItem;
    GridDataItem dataItem = e.Item as GridDataItem;
    if (e.Item is GridEditableItem&& (e.Item as GridEditableItem).IsInEditMode)
    {
        GridEditManager editMan = editedItem.EditManager;
        GridDropDownListColumnEditor editor = editMan.GetColumnEditor("ProviderId") as GridDropDownListColumnEditor;
        //in case you have RadComboBox editor for the GridDropDownColumn (this is the default editor),  
        //you will need to use ComboBoxControl below instead of DropDownListControl
        //Then you can modify the list control as per your custom conventions
        if (editor != null)
        {
            editor.DataSource = PROVIDERDAO.GetAllPROVIDERList();
            editor.DataBind();
        }
    }
}
i don't know what problem that i run project not show ProviderId column but when i click edit it is show
I Want grid show ProviderId column with ListTextField = "ProviderName" when page loading because eidt i had done ok.
Please help me ?
Daniel
Telerik team
 answered on 24 Dec 2012
1 answer
58 views

Hi,

I want to add a RadListBoxItem into a RadListBox from javascript.
 
Can anybody help me to achieve this scenario ASAP?


Thanks in advance

Princy
Top achievements
Rank 2
 answered on 24 Dec 2012
3 answers
869 views

Hi,
How do a RadGrid be in View mode or non editable mode?

Scenario:
Based on the user role, RadGrid should be in Disable mode(no Add/Update/Remove functionalities ) or Enable mode. This should happen dynamically.

Thanks,
Chaitanya
Eyup
Telerik team
 answered on 24 Dec 2012
5 answers
168 views
I am creating RadTreeNode as follows:

protected RadTreeNode BuildOption(Options option, string questionType)
    {
RadTreeNode nodeOption =
new RadTreeNode();
 
       nodeOption.Text = "(" + option.OrderID.ToString() + ") " + option.Name;
       nodeOption.Value = option.OptionsID.ToString();
       nodeOption.Attributes.Add(SurveyTreeNodeAttributes.SurveyTreeNodeType, ((int)EnumsBL.SurveyTreeNodeType.Option).ToString());      
       nodeOption.Attributes.Add(SurveyTreeNodeAttributes.QuestionType, questionType);
       nodeOption.ImageUrl = "~/images/ConstIcons/icon-question-option.png";
       return nodeOption;
}
I am also loading the tree nodes on demand as follows:   
Code Behind:
[WebMethod]
public static RadTreeNodeData[] LoadNodes(RadTreeNodeData node, object context)
{
    EnumsBL.SurveyTreeNodeType nodeType = (EnumsBL.SurveyTreeNodeType)Enum.Parse(typeof(EnumsBL.SurveyTreeNodeType), node.Attributes[SurveyTreeNodeAttributes.SurveyTreeNodeType].ToString());
    TreeNodeBuilder treeNodeBuilder = QuestionnaireTreeBuilderFactory.GetQuestionnaireTreeBuilder(nodeType);
    return treeNodeBuilder.BuildChildNodesData(node.Value);
}
ASCX:
<telerik:RadTreeView ID="radTree"
          Skin="Default"
          BackColor="White"
          BorderStyle="Solid"
          BorderColor="#CCCCCC"
          BorderWidth="1px"
          AllowNodeEditing="true"
          Style="cursor: hand;"
          Height="250px"
          EnableDragAndDrop="false"
          OnNodeClick="NodeClick"
           SingleExpandPath="true"
          runat="server">
         <WebServiceSettings  Path="../../Constructor/AdaptiveAnswerBuilder.aspx" Method="LoadNodes" />
      </telerik:RadTreeView>
I have debugged method "LoadNodes" and checked that RadTreeNodeData object array contains the two attributes added to the node at the top.

However when a node is selected I only get(after debugging) one node custom attributes, not two:
protected void TreeNodeClicked(object sender, RadTreeNodeEventArgs e)
   {
       RadTreeNode selectedNode = e.Node; //only one of the attributes, assigned during node creation, are present
       switch ((EnumsBL.SurveyTreeNodeType)Enum.Parse(typeof(EnumsBL.SurveyTreeNodeType), selectedNode.Attributes[SurveyTreeNodeAttributes.SurveyTreeNodeType]))
       {          
           case EnumsBL.SurveyTreeNodeType.Option:
               SetViewstateVariables(selectedNode);
               SetConditionValueHolder(int.Parse(selectedNode.Value));
               EnableSaveButton();
               break;
           default:
                pnlCondEqual.Visible = false;
                DisableSaveButton();
               break;
       }       
   }

How do I get the other attribute?

Regards,
--Fahmi
Dimitar Terziev
Telerik team
 answered on 24 Dec 2012
1 answer
197 views
Hi,

I am having an issue getting the RadGrid-MasterTableView on client-side. I have a RadGrid on the page which does not have static defined columns and I cannot get the mastertableview. Also I defined some static columns and still cannot get the MasterTableVIew.

My final goal is add columns to my RadGrid on the fly using client-side. I could defined to static columns there but other columns are going to be added on dynamically.

What I am missing in my code that I cannot get the MasterTable to add my data to the grid
Thank you in advance


This the code that I am using to get those intance and I can get the grid object but not the MasterTable
   var grid = $find("<%=RadGrid1.ClientID %>");
                       var MasterTable = grid.get_masterTableView();  
                       
//                       var tableView = $find("<%= RadGrid1.ClientID %>").get_masterTableView();

<telerik:RadGrid ID="RadGrid1" runat="server" autogeneratecolumns="false" allowsorting="true" allowpaging="true">
<PagerStyle AlwaysVisible="true" />
   <MasterTableView>
     <Columns>
       <telerik:GridBoundColumn DataField="automobile" UniqueName="automobile" HeaderText="automobile" ></telerik:GridBoundColumn>
       <telerik:GridBoundColumn DataField="betrayal" UniqueName="betrayal" HeaderText="betrayal" ></telerik:GridBoundColumn>
       <telerik:GridBoundColumn DataField="DataSourceRecordID" UniqueName="DataSourceRecordID" HeaderText="DataSourceRecordID" ></telerik:GridBoundColumn>
     </Columns>
   </MasterTableView>
</telerik:RadGrid>
Jayesh Goyani
Top achievements
Rank 2
 answered on 24 Dec 2012
1 answer
61 views
Hi,

Would it be possible to implement selective drill down on RadChart?  Say, only certain chart items have sub-data behind it, while others don't.  I would like to "disable" the click event for those that don't.  Is this possible?

Thanks.


Evgenia
Telerik team
 answered on 24 Dec 2012
1 answer
68 views
Hi
I have a dynamically added UserControl inside my RadTreeView. During a serverside event, I need to get the control to extract the data inside, but I cannot seem to find the control. The binding is executed both on post and postback.

This is the binding of the control:
foreach (Event item in eventList)
{
    RadTreeNode rootNode = new RadTreeNode(item.Name, item.Id.ToString());
    rootNode.Expanded = true;
    RadTreeNode childNode = new RadTreeNode();
 
    ActorNode actorNode = (ActorNode)LoadControl("ComponentControls/ActorNode.ascx");
    actorNode.ID = ACTOR_NODE_ID + item.Id;
 
    List<Actor> actorList = Actor.GetActorList(item.Id);
    List<MunicipalityActor> munActorList = MunicipalityActor.GetMunActorList(MunCode);
 
    actorNode.InitializeControl(municipalityActorList, actorList);
 
    childNode.Controls.Add(actorNode);
    rootNode.Nodes.Add(childNode);
 
    RadTreeView_Actors.Nodes.Add(rootNode);
}

This is the serverside event, where I am trying to get hold of the data...
foreach (RadTreeNode rootNode in RadTreeView_Actors.Nodes)
{
    Control control = rootNode.Nodes[0].FindControl(ACTOR_NODE_ID + rootNode.Value);
}

Is the control-id not what i set it to?

Bozhidar
Telerik team
 answered on 24 Dec 2012
5 answers
309 views
for the example listed here http://demos.telerik.com/aspnet-ajax/grid/examples/hierarchy/autogeneratedhierarchy/defaultcs.aspx

I want to hide a column in child table from code behind .. for example if I wanted to hide the order_ID in the child view how would I do that from code behind when the grid has been created programtically.
Eyup
Telerik team
 answered on 24 Dec 2012
1 answer
50 views
hi
i want to visible or invisible a radpane with javascript in my app.
but not working by collapse and expand well.
if there are a different method please help me.
Princy
Top achievements
Rank 2
 answered on 24 Dec 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?