Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
273 views
I have a radgrid with the following definition
        <telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="True"
            AllowMultiRowEdit="True"
            GridLines="None" Skin="Web20" OnPreRender="RadGrid1_PreRender"
            OnItemCommand="RadGrid1_ItemCommand"
            OnCreateColumnEditor="RadGrid1_CreateColumnEditor"

            >
        <MasterTableView EditMode="InPlace" CommandItemDisplay="Bottom">
            <RowIndicatorColumn>
                <HeaderStyle Width="20px"></HeaderStyle>
            </RowIndicatorColumn>

            <ExpandCollapseColumn>
                <HeaderStyle Width="20px"></HeaderStyle>
            </ExpandCollapseColumn>
            <Columns>
                <telerik:GridBoundColumn ConvertEmptyStringToNull="False" DataField="Name"
                    HeaderText="Name Column" MaxLength="50" ReadOnly="True" UniqueName="NameColumn">
                </telerik:GridBoundColumn>
            </Columns>
            <CommandItemTemplate>
                <asp:Button runat="server" Text="Save All" ID="SaveButton" visible="true" CommandName="UpdateAll" />
            </CommandItemTemplate>
        </MasterTableView>
        </telerik:RadGrid>


Most of the columns come from a databound source.  I need to add an additional row where there is a single checkbox for each column. For example (forgive the ascii art):
--------------------------------------------------------------------------
|Name Column |Col 1              | Col 2             | Col 3             |
--------------------------------------------------------------------------
|Some Name    | <drop down> | <drop down> | <drop down>|
--------------------------------------------------------------------------
|Another Name | <drop down> | <drop down> |<drop down> |
--------------------------------------------------------------------------
| Check These | <checkbox>   | <checkbox>   | <checkbox> |
--------------------------------------------------------------------------
|<submit button>                                                                  |
--------------------------------------------------------------------------

I have it creating all of the drop down lists in the CreateColumnEditor event. Also, all of the rows (except the checkbox one) come from the datasource.

How can I add footer row that contains those checkboxes?
Shinu
Top achievements
Rank 2
 answered on 29 Sep 2010
4 answers
100 views
Hi,

I'm using the radGrid with the Linq datasource to load 10 000 rows with paging.
This really works perfect because in 1 sec the whole page is loaded.

But because my website is in 2 language and there are too many filter options I want to change those options with the codebehind.
But when I tried this solution : http://www.telerik.com/help/aspnet-ajax/grdreducingfiltermenuoptions.html the whole datagrid need more than 5 sec to load which is not acceptable, is there any solution to change this?

protected void RadGrid1_Init(object sender, System.EventArgs e)
{
 GridFilterMenu menu = RadGrid1.FilterMenu;
 int i = 0;
 while(i < menu.Items.Count)
 {
   if(menu.Items[i].Text == "NoFilter" ||
      menu.Items[i].Text == "Contains" ||
      menu.Items[i].Text == "EqualTo" ||
      menu.Items[i].Text == "GreaterThan" ||
      menu.Items[i].Text == "LessThan")
   {
     i++;
   }
   else
   {
     menu.Items.RemoveAt(i);
   }
 }
}

Thnx you!
Kevin
Shinu
Top achievements
Rank 2
 answered on 29 Sep 2010
1 answer
651 views
Team,

In my application am generating Datatable at runtime. Then directly binding this Datatable to Radgrid.
My need is I want to apply sorting through code behind on the Dynamically generated columns.
Pls. help on this.

Markup is as below:

<

 

telerik:RadGrid ID="MainGrid2" runat="server" ShowHeader = "true"

 

 

GridLines="Both" OnPreRender="AnswerGenMainGrid1_PreRender" Skin="none"

 

 

OnItemDataBound="MainGrid2_ItemDataBound" EnableEmbeddedSkins = "false" OnItemCreated = "MainGrid2_ItemCreated" >

 

 

 

 

 

</telerik:RadGrid>

Thanks in Advance
r

 

Princy
Top achievements
Rank 2
 answered on 29 Sep 2010
2 answers
122 views
Hi Everyone,

I have a problem in editing multiple rows inside detail table. I don't know how to check if row is selected and get the value of edited row.

The hierarchy of my grid is :
<mastertable>
<detail table 2>
<detail table 3>
</detail table 3>
<detail table 2>
</master table>

Requirement:
-detail table 2 allows to edit/delete multiple rows

ASPX:
<DetailTables>
                    <rad:GridTableView Name="Detail2"  DataKeyNames="cp_id" DataMember="visit"  CommandItemDisplay="Top" EditMode="InPlace" Width="100%">
                    <CommandItemTemplate>
                        <table width="100%" border="0" cellspacing="0" cellpadding="0">
                            <tr>
                                <td style="width:60%">
                                    <div style="padding:3px 4px 3px 4px">
                                        <table border="0" cellpadding="1" cellspacing="1">
                                            <tr style="font: normal 11px tahoma, Verdana, Helvetica, Sans-serif;vertical-align:middle">
                                                <td>
                                                    <div class="toolbarIconDivider">|</div>
                                                </td>
                                                <td>
                                                    <asp:LinkButton ID="btnAdd" CssClass="mu" onmouseover="this.className='mo'" onmouseout="this.className='mu'" runat="server" CommandName="InitInsert"><img style="border:0px" alt="" src="../images/addemail.gif" /> Add</asp:LinkButton>
                                                    <asp:LinkButton ID="lnkPerformInsert" CssClass="mu" onmouseover="this.className='mo'" onmouseout="this.className='mu'" runat="server" CommandName="PerformInsert" Visible="false"><img style="border:0px" alt="" src="../images/save.gif" /> Save</asp:LinkButton>
                                                </td>
                                                <td>
                                                    <div class="toolbarIconDivider">|</div>
                                                </td>
                                                <td>
                                                    <asp:LinkButton ID="btnEditSelected"  CssClass="mu" onmouseover="this.className='mo'" onmouseout="this.className='mu'" runat="server" CommandName="EditSelected" ><img style="border:0px" alt="" src="../images/edit.gif" /> Edit</asp:LinkButton>
                                                    <asp:LinkButton ID="btnUpdateEdited" CssClass="mu" onmouseover="this.className='mo'" onmouseout="this.className='mu'" runat="server" CommandName="Update" Visible="false"><img style="border:0px" alt="" src="../images/save.gif" /> Save</asp:LinkButton>
                                                    <asp:LinkButton ID="btnCancel" CssClass="mu" onmouseover="this.className='mo'" onmouseout="this.className='mu'" runat="server" CommandName="CancelAll"  Visible="false" CausesValidation="false"><img style="border:0px" alt="" src="../images/cancel.gif" /> Cancel</asp:LinkButton>
                                                </td>
                                                <td>
                                                    <div class="toolbarIconDivider">|</div>
                                                </td>
                                                <td>
                                                    <asp:LinkButton ID="btnDelete" CssClass="mu" onmouseover="this.className='mo'" onmouseout="this.className='mu'" runat="server" CommandName="Delete"  OnClientClick="javascript:return confirm('Are you sure you want to delete this Clinical Pathway Instruction?')" ><img style="border:0px" alt="" src="../images/delete.gif" /> Delete</asp:LinkButton>
                                                </td>
                                            </tr>
                                        </table>
                                    </div>
                                </td>
                            </tr>
                        </table>
                     </CommandItemTemplate>                   
                        <DetailTables>
                            <rad:GridTableView  Name="Detail3" DataKeyNames="cpi_id" DataMember="instruction" CommandItemDisplay="Top" EditMode="InPlace" Width="100%">
                            <CommandItemTemplate>
                            <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                <tr>
                                    <td style="width:60%">
                                        <div style="padding:3px 4px 3px 4px">
                                            <table border="0" cellpadding="1" cellspacing="1">
                                                <tr style="font: normal 11px tahoma, Verdana, Helvetica, Sans-serif;vertical-align:middle">
                                                    <td>
                                                        <div class="toolbarIconDivider">|</div>
                                                    </td>
                                                    <td>
                                                        <asp:LinkButton ID="btnAdd" CssClass="mu" onmouseover="this.className='mo'" onmouseout="this.className='mu'" runat="server" CommandName="InitInsert" ><img style="border:0px" alt="" src="../images/addemail.gif" /> Add</asp:LinkButton>
                                                        <asp:LinkButton ID="lnkPerformInsert" CssClass="mu" onmouseover="this.className='mo'" onmouseout="this.className='mu'" runat="server" CommandName="PerformInsert" Visible="false"><img style="border:0px" alt="" src="../images/save.gif" /> Save</asp:LinkButton>
                                                    </td>
                                                    <td>
                                                        <div class="toolbarIconDivider">|</div>
                                                    </td>
                                                    <td>
                                                        <asp:LinkButton ID="btnEditSelected"  CssClass="mu" onmouseover="this.className='mo'" onmouseout="this.className='mu'" runat="server" CommandName="EditSelected" ><img style="border:0px" alt="" src="../images/edit.gif" /> Edit</asp:LinkButton>
                                                        <asp:LinkButton ID="btnUpdateEdited" CssClass="mu" onmouseover="this.className='mo'" onmouseout="this.className='mu'" runat="server" CommandName="Update" Visible="false"><img style="border:0px" alt="" src="../images/save.gif" /> Save</asp:LinkButton>
                                                        <asp:LinkButton ID="btnCancel" CssClass="mu" onmouseover="this.className='mo'" onmouseout="this.className='mu'" runat="server" CommandName="CancelAll" Visible="false" CausesValidation="false"><img style="border:0px" alt="" src="../images/cancel.gif" /> Cancel</asp:LinkButton>
                                                    </td>
                                                    <td>
                                                        <div class="toolbarIconDivider">|</div>
                                                    </td>
                                                    <td>
                                                        <asp:LinkButton ID="btnDelete" CssClass="mu" onmouseover="this.className='mo'" onmouseout="this.className='mu'" runat="server" CommandName="Delete"  OnClientClick="javascript:return confirm('Are you sure you want to delete this Clinical Pathway Instruction?')" ><img style="border:0px" alt="" src="../images/delete.gif" /> Delete</asp:LinkButton>
                                                    </td>
                                                </tr>
                                            </table>
                                        </div>
                                    </td>
                                </tr>
                            </table>
                            </CommandItemTemplate>
                             
                            <Columns>
                            <rad:GridBoundColumn DataField="cpi_id" HeaderText="CPI_ID" UniqueName="CPI_ID" Visible="false"></rad:GridBoundColumn>
                            <rad:GridBoundColumn DataField="instructions" HeaderText="instructions" UniqueName="instructions" Visible="false"></rad:GridBoundColumn>
                            <rad:GridTemplateColumn HeaderText="Instructions" UniqueName="instructions" DataField="instructions">
                                <ItemTemplate>
                                    <%# DataBinder.Eval(Container.DataItem, "instructions")%>
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:TextBox ID="tbIns" runat="server" Text='<%# Bind( "instructions") %>' width="100%" TabIndex="1" TextMode="MultiLine" Rows="4"></asp:TextBox>
                                    <asp:RequiredFieldValidator ID="descValidator" Runat="server" Display="Dynamic" ControlToValidate="tbIns" ErrorMessage="* Required Field">
                                </asp:RequiredFieldValidator>
                            </EditItemTemplate>
                            <HeaderStyle Width="90%" />
                            </rad:GridTemplateColumn>
                            <rad:GridTemplateColumn HeaderText="Sort Order" UniqueName="sortorder" DataField="sortorder">
                                <ItemTemplate>
                                    <%# DataBinder.Eval(Container.DataItem, "sortorder")%>
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:TextBox ID="tbSortOrder" runat="server" Text='<%# Bind( "sortorder") %>' width="30px" TabIndex="2"></asp:TextBox>
                                    <asp:RequiredFieldValidator ID="descValidator2" Runat="server" Display="Dynamic" ControlToValidate="tbSortOrder" ErrorMessage="* Required Field">
                                </asp:RequiredFieldValidator>
                                <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" Display="Dynamic" ControlToValidate="tbSortOrder" ErrorMessage="Please enter a valid sort order number." ValidationExpression="^\d+$"></asp:RegularExpressionValidator>
                            </EditItemTemplate>
                            </rad:GridTemplateColumn>
                         </Columns>
                            </rad:GridTableView>
                        </DetailTables>
                     
                    <Columns>
                        <rad:GridBoundColumn DataField="cp_id" HeaderText="CP_ID" UniqueName="CP_ID" Visible="false"></rad:GridBoundColumn>
                        <rad:GridBoundColumn DataField="VisitFrequency" HeaderText="VisitFrequency" UniqueName="VisitFrequency" Visible="false"></rad:GridBoundColumn>
                        <rad:GridClientSelectColumn UniqueName="ClientSelectColumnDetail1"></rad:GridClientSelectColumn>
                        <rad:GridTemplateColumn HeaderText="Visit Frequency" UniqueName="VisitFrequency" DataField="VisitFrequency">
                            <ItemTemplate>
                                <%# DataBinder.Eval(Container.DataItem, "VisitFrequency")%>
                            </ItemTemplate>
                            <EditItemTemplate>
                                <asp:TextBox ID="tbVisit" runat="server" Text='<%# Bind( "VisitFrequency") %>' width="100%" TabIndex="1" ></asp:TextBox>
                                <asp:RequiredFieldValidator ID="descValidator" Runat="server" Display="Dynamic" ControlToValidate="tbVisit" ErrorMessage="* Required Field">
                            </asp:RequiredFieldValidator>
                        </EditItemTemplate>
                        <HeaderStyle Width="80%" />
                        </rad:GridTemplateColumn>
                        <rad:GridTemplateColumn HeaderText="Sort Order" UniqueName="Sortorder" DataField="Sortorder">
                            <ItemTemplate>
                                <%# DataBinder.Eval(Container.DataItem, "Sortorder")%>
                            </ItemTemplate>
                            <EditItemTemplate>
                                <asp:TextBox ID="tbVisitSortOrder" runat="server" Text='<%# Bind( "Sortorder") %>' width="30px" TabIndex="2" Visible="false"></asp:TextBox>
                                <asp:RequiredFieldValidator ID="descValidator2" Runat="server" Display="Dynamic" ControlToValidate="tbVisitSortOrder" ErrorMessage="* Required Field" >
                            </asp:RequiredFieldValidator>
                            <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" Display="Dynamic" ControlToValidate="tbVisitSortOrder" ErrorMessage="Please enter a valid sort order number." ValidationExpression="^\d+$"></asp:RegularExpressionValidator>
                        </EditItemTemplate>
                        </rad:GridTemplateColumn>               
 
                     </Columns>
                    </rad:GridTableView>
                 </DetailTables>

C# code:
protected void gridCPDiag_ItemCommand(object sender, GridCommandEventArgs e)
{
  if (e.Item.OwnerTableView.Name == "Detail2" and e.Item is GridCommandItem)
  {
  if (e.CommandName == "Update")
  {
   foreach (GridEditableItem editedItem in e.Item.OwnerTableView.Items)
    {
     int cpid = Convert.ToInt32(editedItem.SavedOldValues["cp_id"]);
     TextBox txtVisitFreq = (TextBox)editedItem.FindControl("tbVisit");
     TextBox txtVisitSortOrder = (TextBox)editedItem.FindControl("tbVisitSortOrder");
 
     UpdateVisitFreq(cpid, txtVisitFreq.Text, Convert.ToInt32(txtVisitSortOrder.Text));
      editedItem.Edit = false;
    }
   }
  }
}

the code is working fine when i select all rows using the header checkbox, but when i select one or two rows only, an error will occur.


Please help.

Thanks!
Lyzel 
zel
Top achievements
Rank 1
 answered on 29 Sep 2010
2 answers
100 views
Hi
I am using RadScheduler, My requirement is that when user is on  day view , Week View , Month View. User clicks on summarize menu in the Context menu.Respective Day,Week,Month wise summarize data should be shown. For eg. If there are 4 meeting booked for today then, date should be shwon at top with all the four meeting details below.    If user is in the week view then data will be shown as Grouped by days(Sunday Monday etc.. in that week).   If user is in the Monthly view then data will be shown as Grouped by dated(1st Sep 2010, 3rd Sep 2010 etc.. in that month)
Regards
Nelson marian
nelson
Top achievements
Rank 1
 answered on 29 Sep 2010
1 answer
78 views
Hi,
    I have a Hierarchy grid 3 levels. My data is all in the session. Grid is ViewState=false. Now in the update i have to also update all the levels for the item (parent, grand parent). The edit for is only at the deepest level (3). Update works fine with the detail table (3 level). now to update upper levels i have to set the grid data source = null so that i can call  the needdatasource, also need to call rebind() for the detail tables.
   If i do not Rebind(), after the update the edit form disappears ( proper behaviour) BUT when i use the datasource=null and Rebind() then data do get updated in all levels but the eidt form does not go away. I even tried calling clearedititems() but no avail. editmode makes no difference.
    Note : The edit form does go away if i click update again (2nd time) , also it does not call the updatecommand event the second time.
   As a quick fix, probably i can just redirect to the page so the edit form would not open initially.

whats the proper way of doing it ?

Thanks,

Regards,

Osman

plz : do not reply after 3 days asking for sample code ;)

I tried attaching ascreen shot, may be your radupload doesn't work properly...
Iana Tsolova
Telerik team
 answered on 29 Sep 2010
1 answer
111 views
Is it possible to change the EditText property of a gridEditCommand column programatically?
Princy
Top achievements
Rank 2
 answered on 29 Sep 2010
5 answers
224 views
On a page, we have a RadGrid. We're running into some problems that I am thinking might have to do with events firing, and in what order they fire. The error comes if you sort a column, then click to sort it again. After tracing down the code-behind, I think I see the problem, but I am curious if this is intended behavior, or if there's something we can do. The problem on our end stems from a particular variable in the code-behind. The variable is actually an object reference, and the error is a null reference exception thrown inside the Grid's ItemCreated event. The object is set in a  private method called in the Page_Load event.

I would post the code, but it is well over 1,000 lines long. So for simplicity's sake, here's the order of events I traced:

1) I enter the page -> Page_Load fires, populates the object reference and binds the RadGrid, also firing ItemCreated and using the reference with no problems
2) I click a column -> Page_Load fires again, populates the object reference again and apparently re-binds the RadGrid, firing the ItemCreated event and using the reference with no problems.
3) I click the same column to sort in the opposite direction -> ItemCreated fires and the object reference is null, crashing.

The private method call in Page_Load is NOT dependent on the page being a postback or not, - it is always called on Page_Load. So why does Page_Load fire on the first sort, but not on the second sort?

Thanks in advance for any help offered!

Ando Poore
Marin
Telerik team
 answered on 29 Sep 2010
3 answers
218 views
Greetings:

For a RadGrid with the following settings;

 

<ClientSettings EnablePostBackOnRowClick="true">

 

 

<Selecting AllowRowSelect="True" />

 

 

</ClientSettings>

 


And a RadContextMenu is configured as shown;

<

 

telerik:RadContextMenu ID="rcmContextMenu" iscontext="True" runat="server" Skin="Outlook"

 

 

OnItemClick="rcmContextMenu_ItemClick" contextmenuelementid="none">

 

 

<Items>

 

 

<telerik:RadMenuItem Text="Edit" />

 

 

 

<telerik:RadMenuItem Text="Delete" />
</

 

Items>

 

</

 

telerik:RadContextMenu>

 



The following occurs when a RadContextMenu is used on the RadGrid;

1) Right click on selected grid row.
2) Context menu appears as expected
3) An item is selected off of the context menu
4) RadGrid_SelectedIndexChanged event is fired
5) RadContextMenu_ItemClick event is fired

How is it possible to use a RadContextMenu when RadGrid_SelectedIndexChanged fires when an item is selected off of the context menu before RadContextMenu_ItemClick fires?


Marin
Telerik team
 answered on 29 Sep 2010
3 answers
568 views
Is it possible to store an attribute to the combo box instead of each item?  What I want to do is that when the SelectedItem is changed to update a different control.  I can't use find(<% %>) because my combobox is part of a user control and the control I want to update is part of a separate user control.

Any suggestions?
Kevin Donahue
Top achievements
Rank 1
 answered on 29 Sep 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Andrey
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Andrey
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?