Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
132 views
hi, i'm using SQLdatasource with the Delete command:

DeleteCommand="DELETE FROM Vocabulary WHERE (ID =@id)">


this is my grid:


<telerik:RadGrid ID="RadGrid1" runat="server" AllowFilteringByColumn="True" 
        AllowPaging="True" AllowSorting="True" DataSourceID="SqlDataSourceVoca" 
        GridLines="None" onneeddatasource="RadGrid1_NeedDataSource" PageSize="100" 
        ShowGroupPanel="True" Skin="Sunset">
        <PagerStyle Mode="NextPrevNumericAndAdvanced" Position="TopAndBottom" />
<MasterTableView AllowMultiColumnSorting="True" AutoGenerateColumns="False" 
            DataSourceID="SqlDataSourceVoca" ShowFooter="True" AllowAutomaticDeletes="True" DataKeyNames="id,ID">
<RowIndicatorColumn>
<HeaderStyle Width="20px"></HeaderStyle>
</RowIndicatorColumn>

<ExpandCollapseColumn>
<HeaderStyle Width="20px"></HeaderStyle>
</ExpandCollapseColumn>
    <Columns>
        <telerik:GridBoundColumn DataField="ID" DataType="System.Int64" HeaderText="ID" 
            ReadOnly="True" SortExpression="ID" UniqueName="ID">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="Vocabulary" HeaderText="Vocabulary" 
            SortExpression="Vocabulary" UniqueName="Vocabulary">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="Type" HeaderText="Type" 
            SortExpression="Type" UniqueName="Type">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="Meaning" HeaderText="Meaning" 
            SortExpression="Meaning" UniqueName="Meaning">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="Synonyms" HeaderText="Synonyms" 
            SortExpression="Synonyms" UniqueName="Synonyms">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="Comments" HeaderText="Comments" 
            SortExpression="Comments" UniqueName="Comments">
        </telerik:GridBoundColumn>
        <telerik:GridClientDeleteColumn ConfirmText="Are you sure you want to delete the selected row?" 
            HeaderStyle-Width="35px" ConfirmTitle="Delete item" >
<HeaderStyle Width="35px"></HeaderStyle>
        </telerik:GridClientDeleteColumn>
        <telerik:GridEditCommandColumn>
        </telerik:GridEditCommandColumn>
    </Columns>

<EditFormSettings>
<EditColumn UniqueName="EditCommandColumn1"></EditColumn>
</EditFormSettings>

    <PagerStyle Mode="NextPrevNumericAndAdvanced" Position="TopAndBottom" />
</MasterTableView>

        <ClientSettings AllowDragToGroup="True">
        </ClientSettings>

<FilterMenu EnableTheming="True">
<CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>
</FilterMenu>
    </telerik:RadGrid>

when i click delete. The selected item inside the Rad grid disappeared , but the actually item in the database did not get deleted.

Why ?? 
Vlad
Telerik team
 answered on 05 Jan 2009
4 answers
96 views
Hi,
I have a RadChart with its SeriesOrientation="Horizontal".

Can you give me a C# code example to write a custom text above each horizontal bar?

Thanks!
Vladimir Milev
Telerik team
 answered on 05 Jan 2009
1 answer
97 views
Is there a way to have multiple titles in a chart?  We need the ability to have a main title, sub title and then some footnotes at the bottom of the chart.  Does RadChart provide any method for that?
Vladimir Milev
Telerik team
 answered on 05 Jan 2009
1 answer
122 views
Hi,

I came across an article that helps to format the grid - Header Grouping. It is accessible from Customizing with GridTemplateColumn  . Now my problem - I have got a numerical column within the GridTemplateColumn. Is it possible to aggregate the values present in that column and display it in its own footer.

Output should be

Col1    Col2
   X    Y
A        x1    10
B        x2     0
C       x3      20
  total: 30

On the above grid, col2 is divided into X an Y sub columns. I need aggregation of Y column.

Any sort of help is highly appreciated.

Thanks a lot.

Milan G

Princy
Top achievements
Rank 2
 answered on 05 Jan 2009
1 answer
249 views
Hi I want to hide edit button of child grid item at run time for some specific roles............I am not getting how can i do that.......below is my grid design code..having yellow back n bold code is the button..

<telerik:RadGrid ID="grdExams"runat="server"DataSourceID="LinqDataSource1"

        AllowFilteringByColumn="True" AllowSorting="True" 

        AutoGenerateColumns="False" AllowPaging="True"

        Skin="Office2007" OnItemDataBound="grdExams_ItemDataBound"

        GridLines="None" AllowAutomaticDeletes="True"

        OnItemCommand="grdExams_ItemCommand" OnPreRender="grdExams_PreRender"

        GroupingEnabled="False" ondatabound="grdExams_DataBound"

        ondetailtabledatabind="grdExams_DetailTableDataBind"

        oninsertcommand="grdExams_InsertCommand"

        ondeletecommand="grdExams_DeleteCommand"

        onitemcreated="grdExams_ItemCreated" >

        <ClientSettings AllowDragToGroup="True" AllowExpandCollapse="true" AllowKeyboardNavigation="True">

            <Selecting AllowRowSelect="True" />

            <ClientEvents OnGridCreated="gridCreated" />

        </ClientSettings>

        <GroupPanel Visible="True">

        </GroupPanel>

        <MasterTableView GridLines="None" DataKeyNames="ID" DataSourceID="LinqDataSource1"

            CommandItemDisplay="TopAndBottom" Width="100%" Name="Examinations">

            <DetailTables>

                <telerik:GridTableView HierarchyLoadMode="Client" DataSourceID="LinqDataSource2" DataKeyNames="ID"

                    Width="100%" runat="server" EnableViewState="true" CommandItemDisplay="Bottom" AllowAutomaticDeletes="true"

                    AllowFilteringByColumn="false" Name="Detractions">

                    <ParentTableRelation>

                        <telerik:GridRelationFieldsMasterKeyField="ID"DetailKeyField="ExaminationID"/>

                    </ParentTableRelation>

                    <DetailTables>

                       <telerik:GridTableView DataKeyNames="ID" DataSourceID="LinqDataSource3"

Width="100%" runat="server">

                                <ParentTableRelation>

                                    <telerik:GridRelationFieldsDetailKeyField="ID"

 

MasterKeyField="ID" />

                                </ParentTableRelation>

<RowIndicatorColumn Visible="False">

<HeaderStyle Width="20px"></HeaderStyle>

</RowIndicatorColumn>

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

<HeaderStyle Width="20px"></HeaderStyle>

</ExpandCollapseColumn>

                                <Columns>

                                    <telerik:GridBoundColumn SortExpression="Remark"HeaderText="Remark"DataField="Remark"UniqueName="Remark"AllowFiltering="false">

                                    </telerik:GridBoundColumn> 

                                </Columns>

                             

<EditFormSettings>

<PopUpSettings ScrollBars="None"></PopUpSettings>

</EditFormSettings>

                             

                            </telerik:GridTableView>

                    </DetailTables>

                    <EditFormSettings>

                        <PopUpSettings ScrollBars="None"></PopUpSettings>

                    </EditFormSettings>

                    <CommandItemTemplate>

                        <div style="width: 100%; text-align:center">                           

                            <div style="float: right;padding: 5px; padding-right: 10px">

                                <asp:LinkButton ID="lnkRefreshDetraction" runat="server"CommandName="RefreshDetractions">

                                    <asp:Image ID="imgRefreshDetraction"runat="server"ImageAlign="AbsMiddle"ImageUrl="~/Images/radimg/Refresh.gif"

                                        AlternateText="AddDetractopm Record" />

                                    <asp:Label ID="lblRefreshDetraction"runat="server"Style="text-decoration:none;"

                                        Text=" Refresh DetractionList"></asp:Label>

                                </asp:LinkButton>

                            </div>

                             <div style="float: left;padding: 5px; padding-right: 10px">

                                <asp:LinkButton ID="LinkButton1"runat="server"CommandName="InitInsert">

                                    <asp:Image ID="Image1" runat="server"ImageAlign="AbsMiddle"ImageUrl="~/Images/AddRecord.gif"

                                        AlternateText="Add a newDetraction to the current record." />

                                    <asp:Label ID="Label1" runat="server"Style="text-decoration:none;" Text="Add Detraction...">

                                    </asp:Label>

                                </asp:LinkButton>

                            </div>

                        </div>

                    </CommandItemTemplate>

                    <RowIndicatorColumn Visible="False">

                        <HeaderStyle Width="20px"></HeaderStyle>

                    </RowIndicatorColumn>

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

                        <HeaderStyle Width="20px"></HeaderStyle>

                    </ExpandCollapseColumn>

                    <Columns>

                        <telerik:GridTemplateColumnUniqueName="TemplateDetractionEditColumn"AllowFiltering="false"

                            ShowSortIcon="false">

                            <ItemTemplate>

                                <asp:ImageButton ID="cmdDelete" runat="server" CommandName="Delete" OnClientClick="return confirm('Are you sure want to Delete?');"

                                    ImageUrl="~/Images/Delete.gif"/>

                                <asp:ImageButton ID="cmdEdit"runat="server"CommandName="Edit"ImageUrl="~/Images/Edit.gif"/>

                            </ItemTemplate>

                        </telerik:GridTemplateColumn>

                        <telerik:GridBoundColumn DataField="Severity"HeaderText="Severity"SortExpression="Severity"

                            UniqueName="Severity">

                        </telerik:GridBoundColumn>

                        <telerik:GridBoundColumn DataField="DetractionType"HeaderText="Type"SortExpression="DetractionType"

                            UniqueName="DetractionType">

                        </telerik:GridBoundColumn>

                        <telerik:GridBoundColumn DataField="DetractionSourceID"HeaderText="DetractionSourceID"ReadOnly="True"

                            SortExpression="DetractionSourceID"UniqueName="DetractionSourceID">

                        </telerik:GridBoundColumn>

                        <telerik:GridBoundColumn DataField="DetractionSource"HeaderText="Source"ReadOnly="True"

                            SortExpression="DetractionSource"UniqueName="DetractionSource">

                        </telerik:GridBoundColumn>

                        <telerik:GridBoundColumn DataField="TechnologistFault"DataType="System.Decimal"HeaderText="Technologist"

                            SortExpression="TechnologistFault"UniqueName="TechnologistFault">

                        </telerik:GridBoundColumn>

                        <telerik:GridBoundColumn DataField="EquipmentFault"DataType="System.Decimal"HeaderText="Equipment"

                            SortExpression="EquipmentFault"UniqueName="EquipmentFault">

                        </telerik:GridBoundColumn>

                        <telerik:GridBoundColumn DataField="PatientFault"DataType="System.Decimal"HeaderText="Patient"

                            SortExpression="PatientFault"UniqueName="PatientFault">

                        </telerik:GridBoundColumn>

                        <telerik:GridBoundColumn DataField="ProcessFault"DataType="System.Decimal"HeaderText="Process"

                            SortExpression="ProcessFault"UniqueName="ProcessFault">

                        </telerik:GridBoundColumn>

                        <telerik:GridBoundColumn Visible="false"DataField="DV"DataType="System.Decimal"HeaderText="DV"

                            SortExpression="DV"UniqueName="DV">

                        </telerik:GridBoundColumn>

                        <telerik:GridBoundColumn DataField="ID"Visible="false"DataType="System.Int32"HeaderText="ID"

                            ReadOnly="True"SortExpression="ID"UniqueName="DetractionID">

                        </telerik:GridBoundColumn>

                        <telerik:GridBoundColumn Visible="false"DataField="ExaminationID"DataType="System.Int32"

                            HeaderText="ExaminationID"SortExpression="ExaminationID"UniqueName="ExaminationID">

                        </telerik:GridBoundColumn>

                    </Columns>

                </telerik:GridTableView>

            </DetailTables>

            <RowIndicatorColumn Visible="False">

                <HeaderStyle Width="20px"></HeaderStyle>

            </RowIndicatorColumn>

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

                <HeaderStyle Width="20px"></HeaderStyle>

            </ExpandCollapseColumn>

            <CommandItemTemplate>

                <div style="width: 100%; text-align: center">

                    <div style="float:left; padding:5px; padding-left:10px">

                        <asp:LinkButton ID="lnkAddRecord" runat="server" CommandName="InitInsert">

                            <div style="float:left;padding-left:5px">

                                <asp:Image ID="imgAddRecord"runat="server"ImageAlign="Top"ImageUrl="~/Images/Icons/24/ExamAdd.png"

                                    AlternateText="Add anExamination record" /></div>

                            <div style="float: left;padding-left: 5px; text-align: left; text-decoration: none;">

                                <asp:Label ID="lblAddRecord"runat="server"Text="Add<br/>Examination..."></asp:Label></div>

                        </asp:LinkButton>

                    </div>

                    <div style="float: left; padding: 5px; padding-left:10px">

                        <asp:LinkButton ID="lnkImportExams" runat="server" CommandName="ImportExams">

                            <div style="float: left;padding-left: 5px">

                                <asp:Image ID="imgImportExams"runat="server"ImageAlign="Top"ImageUrl="~/Images/Icons/24/Examimport.png"

                                    AlternateText="ImportExamination records" /></div>

                            <div style="float: left;padding-left: 5px; text-align: left; text-decoration: none;">

                                <asp:Label ID="lblImportExams"runat="server"Text="Import<br/>Examination Records...">

                                </asp:Label></div>

                        </asp:LinkButton>

                    </div>

                    <div style="float: right; padding: 5px; padding-right:10px">

                        <asp:LinkButton ID="lnkRefresh" runat="server" CommandName="RefreshExams">

                            <div style="float: left;padding-left: 5px">

                                <asp:Image ID="imgRefresh"runat="server"ImageAlign="Top"ImageUrl="~/Images/Icons/24/ExamRefresh.png"

                                    AlternateText="Refreshcurrent list of Examinations" /></div>

                            <div style="float: left;padding-left: 5px; text-align: left; text-decoration: none;">

                                <asp:Label ID="lblRefresh"runat="server"Text="Refresh<br />Examination List"></asp:Label></div>

                        </asp:LinkButton>

                    </div>

                </div>

            </CommandItemTemplate>

            <Columns>

                <telerik:GridTemplateColumn ItemStyle-Width="35px" UniqueName="TemplateEditColumn" AllowFiltering="false"ShowSortIcon="false">

                    <ItemTemplate>

                        <asp:ImageButton ID="cmdDelete" OnClientClick="return confirm('All records related to thisExamination will also be deleted. Are you sure?');"

                            runat="server"CommandName="Delete"ImageUrl="~/Images/Delete.gif"/>

                        <asp:ImageButton ID="cmdEdit" runat="server" CommandName="Edit" ImageUrl="~/Images/Edit.gif"/>

                    </ItemTemplate>

                <ItemStyle Width="35px"></ItemStyle>

                </telerik:GridTemplateColumn>

                <telerik:GridBoundColumn DataField="ID" DataType="System.Int32"

                    HeaderText="ID" SortExpression="ID" UniqueName="ID" ReadOnly="True" Visible="false">

                </telerik:GridBoundColumn>

                 <telerik:GridBoundColumn DataField="AccessionCode" HeaderText="Accession #"

                    SortExpression="AccessionCode" UniqueName="AccessionCode" ReadOnly="True">

                </telerik:GridBoundColumn>

                <telerik:GridBoundColumn DataField="ExaminationDate" HeaderText="Exam Date"

                    SortExpression="ExaminationDate" UniqueName="ExaminationDate"

                    DataType="System.DateTime" ReadOnly="True">

                </telerik:GridBoundColumn>

                  <telerik:GridBoundColumn DataField="Modality" HeaderText="Modality" SortExpression="Modality"

                    UniqueName="Modality" ReadOnly="True">

                    <ItemStyle Width="5px" />

                </telerik:GridBoundColumn>

                <telerik:GridBoundColumn DataField="ExaminationType"

                    HeaderText="Examin Type" SortExpression="ExaminationType"

                    UniqueName="ExaminationType" ReadOnly="True">

                    <ItemStyle Width="300px" />

                </telerik:GridBoundColumn>

              

             

                <telerik:GridBoundColumn DataField="ModalityID" Visible="false" >

               

                </telerik:GridBoundColumn>

                <telerik:GridBoundColumn DataField="Facility" HeaderText="Facility" SortExpression="Facility"

                    UniqueName="Facility" ReadOnly="True">

                </telerik:GridBoundColumn>

               

                  <telerik:GridBoundColumn

                    DataField="Technologist" HeaderText="Technologist" ReadOnly="True"

                    SortExpression="Technologist" UniqueName="Technologist">

                </telerik:GridBoundColumn>

               

                <telerik:GridTemplateColumn ItemStyle-Width="35px" DataField="DVSum" DataType="System.Decimal" HeaderText="DV"

                    SortExpression="DVSum" UniqueName="DVSum">

                 

                 

                    <ItemTemplate>

                        <asp:Label ID="DVSumLabel" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "DVSum") %>'></asp:Label>

                        &nbsp;

                        <asp:Image ID="imgSlight" runat="server" ImageAlign="absMiddle" ImageUrl="~/Images/icons/16/slight.gif" />

                        <asp:Image ID="imgModerate" runat="server" ImageAlign="absMiddle" ImageUrl="~/Images/icons/16/moderate.gif" />

                        <asp:Image ID="imgSevere" runat="server" ImageAlign="absMiddle" ImageUrl="~/Images/icons/16/severe.gif" />

                    </ItemTemplate>

                 

                </telerik:GridTemplateColumn>

             

            </Columns>

<EditFormSettings>

<PopUpSettings ScrollBars="None"></PopUpSettings>

</EditFormSettings>

        <PagerStyle Mode="NextPrevNumericAndAdvanced"></PagerStyle>

        </MasterTableView>

        <ExportSettings>

            <Pdf PageBottomMargin="" PageFooterMargin="" PageHeaderMargin="" PageHeight="11in"

                PageLeftMargin="" PageRightMargin="" PageTopMargin="" PageWidth="8.5in" />

        </ExportSettings>

    </telerik:RadGrid>



can any body help me ....

Thanks,

Viv


I have tried with below code also but not hiding the buttons (also not throwing any error)

 protected void grdExams_DetailTableDataBind(object source, GridDetailTableDataBindEventArgs e)

    {

        

        try

        {

            GridDataItemCollection Items = (GridDataItemCollection)e.DetailTableView.Items;

            foreach (GridDataItem Item in Items)

            {

                ImageButton ImageButtonDelete = (ImageButton)Item["TemplateDetractionEditColumn"].FindControl("cmdDelete");

                ImageButtonDelete.Visible = false;

                ImageButtonDelete.ToolTip = "dasdasdasdasdasdasdasdasd";

                

            }

        }

        catch (Exception ex)

        {

           

        }

    }

Shinu
Top achievements
Rank 2
 answered on 05 Jan 2009
1 answer
161 views
Hello!

How can I access delete and edit auto generated columns from ItemDataBound event? I want to hide edit/delete if currently bound item not fits some of my conditions.

Thanks
Shinu
Top achievements
Rank 2
 answered on 05 Jan 2009
1 answer
194 views
Hi All,

I am trying to used SelectedIndexChanged to call a method that take a value from the databoundfield as parameter 

my question is how can I get that value from this event???
 
thanks
ghadeer
Shinu
Top achievements
Rank 2
 answered on 05 Jan 2009
1 answer
100 views
Hi,
i just need to have more than one templates in my radGrid. I have made a context menu which will be shown on right click over each row. Context menu have three options, delete, forward and noteback. I just want three different kinds of editing mode or template columns for each of the option which will have different controls.
Please guide me in it.....
And it would be better if the process of showing these templates will be at client side. 
Thank you!
Phil
Top achievements
Rank 2
 answered on 04 Jan 2009
1 answer
108 views

Hi

I have coded the following per http://www.telerik.com/help/aspnet/grid/grddifferenteditformsoneditandinsert.html , but this url is not to the Ajax help, and I can not find a similar page under Ajax help:

Protected Sub RadGrid1_ItemCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles RadGrid1.ItemCommand
    If (e.CommandName = RadGrid.InitInsertCommandName) Then
        e.Canceled = True
        RadGrid1.EditIndexes.Clear()
        e.Item.OwnerTableView.EditFormSettings.UserControlName = "~/uc/InvoiceAdd.ascx"
        e.Item.OwnerTableView.InsertItem()
    End If
End Sub

When I run it, does not insert the user control into the insert template.  Is this still supported?  Or am I not doing enough?

Phil
Top achievements
Rank 2
 answered on 04 Jan 2009
0 answers
88 views
 
dan
Top achievements
Rank 1
 asked on 04 Jan 2009
Narrow your results
Selected tags
Tags
+? more
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?