Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
98 views
Hello,

Is there a way to have a template column with a linkbutton containing a pop-up context menu, allowing to update the data on that row? I have a grid populated with data (from the NeedDatasource handler). I'd like to allow user to left-click on the link button to pop-up a menu, and select a menu item which will update the underline record's data according to the menu item's value. I couldn't find any message/knowledge base to allow me to pass the datakey's value from the client to server to pass on to the DAL. I want to use left-click on a linkbutton to restrict users only to click on the button to activate the allowable command (and also, make it more user-friendly!)

Since I don't know where to start, it'd be tough to provide some code. Any help would be greatly appreciated.

Tri.
Tri Nguyen
Top achievements
Rank 1
 answered on 07 Jun 2011
10 answers
161 views
We tried to check the spelling for data item inside Grid.
How do we fire up spelling control when we click update button of grid?
Here is the following code modified from your example:

GridEditableItem editedItem = (e.Item as GridEditableItem);

                        LinkButton actionButton;

                        //insert mode

                        if (editedItem.OwnerTableView.IsItemInserted)

                        {

                            actionButton = editedItem.FindControl("PerformInsertButton") as LinkButton;

                        }

                        //edit mode

                        else

                        {

                            actionButton = editedItem.FindControl("UpdateButton") as LinkButton;

                        }

                        actionButton.OnClientClick = "return StartCheck();";

                        HiddenField1.Value = actionButton.ClientID;

                        IGridColumnEditor editor = editedItem.EditManager.GetColumnEditor("Comment");

                        string editorID = editor.ContainerControl.Controls[1].ClientID;

                        RadSpell1.ControlsToCheck = new string[1] { editorID };

                        RadSpell1.IsClientID = true;

Rumen
Telerik team
 answered on 07 Jun 2011
0 answers
55 views
I have a template in my grid that has a radtextbox in it.  When updating the field, I'm having issues updating the data programmically.

ASPX:

 

<telerik:RadGrid ID="grdProducts" runat="server" Skin="DMID" AutoGenerateColumns="False"

 

 

GridLines="None" GroupingEnabled="False" PageSize="5" AllowPaging="True" EnableEmbeddedSkins="False"

 

 

AllowSorting="True" CellSpacing="0" Width="90%" OnNeedDataSource="grdProducts_NeedDataSource"

 

 

OnUpdateCommand="grdProducts_UpdateCommand" Height="300px" ShowStatusBar="True"

 

 

OnPreRender="grdProducts_PreRender" >

 

 

<HeaderContextMenu EnableEmbeddedSkins="False" CssClass="GridContextMenu GridContextMenu_DMID">

 

 

</HeaderContextMenu>

 

 

<MasterTableView NoMasterRecordsText="No supplies available." TableLayout="Fixed"

 

 

DataKeyNames="SupplyID" AllowAutomaticUpdates="True" EditMode="InPlace">

 

 

<CommandItemSettings ExportToPdfText="Export to Pdf" />

 

 

<RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">

 

 

</RowIndicatorColumn>

 

 

<ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">

 

 

</ExpandCollapseColumn>

 

 

<Columns>

 

 

<telerik:GridBoundColumn FilterControlAltText="Filter ID column" ReadOnly="True"

 

 

SortExpression="SupplyID" UniqueName="SupplyID" DataField="SupplyID" Visible="false"

 

 

DataType="System.Int32">

 

 

</telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn FilterControlAltText="Filter Product column" HeaderText="Product"

 

 

DataType="System.String" ReadOnly="True" SortExpression="Product" UniqueName="Product"

 

 

DataField="Product">

 

 

<HeaderStyle HorizontalAlign="Center" Width="15%" />

 

 

<ItemStyle HorizontalAlign="Left" />

 

 

</telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn FilterControlAltText="Filter Description column" HeaderText="Description"

 

 

ReadOnly="True" SortExpression="Description" UniqueName="Description" DataField="Description">

 

 

<HeaderStyle HorizontalAlign="Center" Width="20%" />

 

 

</telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn FilterControlAltText="Filter Shipping Unit column" HeaderText="Shipping Unit"

 

 

ReadOnly="True" SortExpression="ShippingUnit" UniqueName="ShippingUnit" DataField="ShippingUnit">

 

 

<HeaderStyle HorizontalAlign="Center" Width="15%" />

 

 

<ItemStyle HorizontalAlign="Center" />

 

 

</telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn DataType="System.Int32" FilterControlAltText="Filter Units Requested column"

 

 

HeaderText="Units Requested" SortExpression="URequested" UniqueName="URequested"

 

 

DataField="URequested">

 

 

<HeaderStyle HorizontalAlign="Center" Width="7%" />

 

 

<ItemStyle HorizontalAlign="Center" />

 

 

</telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn DataType="System.Boolean" FilterControlAltText="Filter Display column"

 

 

HeaderText="Display" SortExpression="Display" UniqueName="Display" DataField="Display"

 

 

Visible="false" ReadOnly="true">

 

 

</telerik:GridBoundColumn>

 

 

<telerik:GridTemplateColumn FilterControlAltText="Filter TemplateColumn column"

 

 

 

HeaderText="Comments" UniqueName="txtComments" DataField="Comments" >

 

 

<HeaderStyle HorizontalAlign="Center" Width="30%" />

 

 

<ItemTemplate>

 

 

<telerik:RadTextBox ID="txtComments" Runat="server" Columns="30"

 

 

 

TextMode="MultiLine" Width="150px" Text='<%# Eval("Comments") %>' Enabled="false">

 

 

</telerik:RadTextBox>

 

 

</

 

ItemTemplate>

 

 

<EditItemTemplate>

 

 

<telerik:RadTextBox ID="txtComments" Runat="server" Columns="30"

 

 

 

TextMode="MultiLine" Width="150px" EnableEmbeddedSkins="false" Skin="DMID" Text='<%# Bind("Comments") %>'>

 

 

</telerik:RadTextBox>

 

 

</EditItemTemplate>

 

 

 

</telerik:GridTemplateColumn>

 

 

<telerik:GridEditCommandColumn UniqueName="EditCommandColumn" HeaderText=""

 

 

 

Visible="true" ButtonType="ImageButton">

 

 

<HeaderStyle HorizontalAlign="Center" Width="40%" />

 

 

</telerik:GridEditCommandColumn>

 

 

 

</Columns>

 

 

<EditFormSettings>

 

 

<

 

EditColumn InsertImageUrl="Update.gif" UpdateImageUrl="Update.gif" EditImageUrl="Edit.gif" CancelImageUrl="Cancel.gif" UniqueName="EditCommandColumn1" FilterControlAltText="Filter EditCommandColumn1 column"></EditColumn>

 

 

</

 

EditFormSettings>

 

 

</MasterTableView>

 

 

<ClientSettings Scrolling-AllowScroll="true" EnableRowHoverStyle="true" Selecting-AllowRowSelect="true">

 

 

<Resizing AllowColumnResize="true" />

 

 

<Selecting AllowRowSelect="True" />

 

 

<Scrolling AllowScroll="true" UseStaticHeaders="true" />

 

 

</ClientSettings>

 

 

<FilterMenu EnableImageSprites="False" EnableEmbeddedSkins="False">

 

 

</FilterMenu>

 

 

</telerik:RadGrid>

c#:

 

 

 

protected void grdProducts_UpdateCommand(object sender, GridCommandEventArgs e)

 

 

{

 

 

 

lblTableError.Text += " Table to be updated: " + e.Item.OwnerTableView.DataMember + "<br>";

 

 

 

 

GridEditableItem editedItem = e.Item as GridEditableItem;

 

 

 

 

GridEditManager editMan = editedItem.EditManager;

 

 

 

 

DataTable GridSource = (DataTable)ViewState["Products"];

 

 

 

 

string operation = string.Empty;

 

 

 

 

foreach (GridColumn column in e.Item.OwnerTableView.RenderColumns)

 

 

{

 

 

 

if (column is IGridEditableColumn)

 

 

{

 

 

 

IGridEditableColumn editableCol = (column as IGridEditableColumn);

 

 

 

 

if (editableCol.IsEditable)

 

 

{

 

 

 

try

 

 

 

 

 

 

 

{

 

 

 

IGridColumnEditor editor = editMan.GetColumnEditor(editableCol);

 

 

 

 

string editorText = "unknown";

 

 

 

 

string oldEditorText = "";

 

 

 

 

object editorValue = null;

 

 

 

 

if (editor is GridTextColumnEditor)

 

 

{

 

 

 

editorText = (editor as GridTextColumnEditor).Text;

 

 

 

 

editorValue = (editor as GridTextColumnEditor).Text;

 

 

}

 

 

 

if (editor is GridTemplateColumnEditor)

 

 

{

 

 

 

GridEditableItem item = e.Item as GridEditableItem;

 

 

 

 

editorValue = (item.FindControl("txtComments") as RadTextBox).Text;

 

 

 

 

}

 

 

 

DataRow[] changedRows = GridSource.Select("SupplyID = '" + editedItem.OwnerTableView.DataKeyValues[editedItem.ItemIndex]["SupplyID"].ToString() + "'");

 

 

 

 

changedRows[0][column.UniqueName] = editorValue;

 

 

 

 

GridSource.AcceptChanges();

 

 

 

 

ViewState["Products"] = GridSource;

 

}

 

 

catch (Exception ex)

 

 

{

 

 

 

lblTableError.Text = "<strong>Unable to set value of column '" + column.UniqueName + "'</strong> - " + ex.Message;

 

 

 

 

e.Canceled = true;

 

 

 

 

break;

 

 

}

 

}

 

}

 

}

 

 

 

grdProducts.Rebind();

 

 

 

 

e.Item.Edit = false;

 

 

}

 

 

 

Annette
Top achievements
Rank 1
 asked on 07 Jun 2011
4 answers
99 views
Hello I'm trying to implement an editable grid in place and some filters but it fails. When i filter i need to do Radgri1.Databind() and if i to the binding the update command of the sqldatasorce don't work property. I reed that i have to implemented with advanced databindign but if I do it I don't know how to do the updates without the sqldatasource. Please could you help me.
Thanks in advance
Pau
Top achievements
Rank 1
 answered on 07 Jun 2011
4 answers
551 views
My Scenario:

Single web page with TabStrip and MultiPage.  Tab1/Page1 has a RadEditor that is used by the user to enter html.  Tab2/Page2 has an editor that allows the user to create a stylesheet.  When the user switches from Tab2, server side the users styles are written out to a file.  The CSSFiles in the RadEditor are cleared and the newly created CSSFile is added to the editor.  This works and the "Apply Styles Class" gets the styles in the drop down.

After going back to Tab 2 and making changes to the style sheet, when the user switches back to Tab 1, the new styles are applied to the file and the file is again removed and added to CSSFiles (Same File name).  Even though the file has changed, the RadEditor is using the contents from the previous version of the file.

So, I am pretty sure that the file does not get loaded again, because of caching by the browser.  I don't think this is an issue with the RadEditor itself. 

So my question is, "Is there a way to force the css to reload on these subsequent changes to pickup the changes to the CSS file?"
TazDeveloper
Top achievements
Rank 1
 answered on 07 Jun 2011
15 answers
355 views
Hello, i have some problem with ClientSelectColumn of Radgridview
in Radgrid1 : i want when  i select  a checkbox or  select full checkbox and click TEST button , i can binding all rows selected from grid1 to grid2 or getting primary key(column makh) of all rows selected
What should i do ?
THANK
http://nguy-hiem.co.cc/share/hoi.png
Shinu
Top achievements
Rank 2
 answered on 07 Jun 2011
4 answers
149 views
I have a RadGrid. It contains multiple controls inside of it. One of them is a linkbutton whose clientClick triggers window.open. After the grid is loaded, I want to trigger the linkbutton's click if and only if the grid contains only one item.

I am defining the grid as follows:
<rad:RadGrid ID="rg" runat="server">
    <ClientSettings>
        <ClientEvents OnDataBound="rg_DataBound" />
    </ClientSettings>
    <MasterTableView PageSize="50" DataSourceID="ods" DataKeyNames="Id">
            <rad:GridTemplateColumn HeaderText="Name" SortExpression="a.Name">
                <ItemTemplate>
                    <asp:LinkButton ID="lblName" runat="server" />
                </ItemTemplate>
            </rad:GridTemplateColumn>
    </MasterTableView>
</rad:RadGrid>

In my codebehind, I am definining the ClientClick at the ItemCreated method.
var lb = (LinkButton)e.Item.FindControl("lbName");
lb.OnClientClick = "window.open('NewPage.aspx?id=" + obj.Id + "'); return false;";

I implemented the client grid databound as follows:
function rg_DataBound(sender, e) {
   var masterTable = $find('<%= rg.ClientID %>').get_masterTableView;
   var dataItems = masterTable.get_dataItems();
 
   if (masterTable.get_pageCount() == 1 && dataItems.get_count() == 1) {
      var lb = dataItems[0].findControl('lbName');
      lb.click();
   }
}

But this javascript method does not even get fired. Basically I have two questions at this time:
1. Am I in the right track?
2. Why is rg_DataBound not firing?

Thanks.
Baal
Top achievements
Rank 1
 answered on 07 Jun 2011
1 answer
180 views
Hi,

Actually I am facing a problem in menu bar that is on  mouse hover  menu items is flickering. So how can i remove flickering ?



Thanks
Jaichand Sahany
Princy
Top achievements
Rank 2
 answered on 07 Jun 2011
1 answer
132 views
I'm creating a load on demand treeview and using multiskin mechanism .
and every node on the tree has a forecolor and i need to load it dynamic with the node expand but i can't every time with any post back the tree take the skin default color ,i tried to save the datasource to the viewstate and every time in post back i set the colors again but the load on demand don't work then,it seams that the viewstate been locked 

please advise  
Tamer Gamal
Top achievements
Rank 1
 answered on 07 Jun 2011
0 answers
80 views
Hello Sir,

I am using RadTreeList in my project. I assign a data it properly. But control not display child data.

I use same control another place but there it's work completely.

I attached screen shot for that.

Write Code as below.

------------------------------------------------------ Code --------------------------------------------------------
 <telerik:RadTreeList runat="server" ID="treeListTasks" AllowPaging="false" AutoGenerateColumns="false"
                    OnNeedDataSource="treeListTasks_NeedDataSource" Width="800px" DataKeyNames="ID"
                    ParentDataKeyNames="ParentTaskId" OnItemCommand="treeListTasks_ItemCommand" AllowNaturalSort="false"
                    AllowMultiItemSelection="false" AllowSorting="false" OnItemDataBound="treeListTasks_ItemDataBound">
                    <Columns>
                        <telerik:TreeListBoundColumn DataField="Name" UniqueName="Name" HeaderText="Name" />
                    </Columns>
</telerik:RadTreeList>
----------------------------------------------------------------------------------------------------------------------


Please give me proper solution.

Thanks.
Kishor Dalwadi
Top achievements
Rank 2
 asked on 07 Jun 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Edmond
Top achievements
Rank 1
Iron
fabrizio
Top achievements
Rank 2
Iron
Veteran
RobMarz
Top achievements
Rank 2
Iron
Fakhrul
Top achievements
Rank 1
Iron
Tejas
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Edmond
Top achievements
Rank 1
Iron
fabrizio
Top achievements
Rank 2
Iron
Veteran
RobMarz
Top achievements
Rank 2
Iron
Fakhrul
Top achievements
Rank 1
Iron
Tejas
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?