Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
99 views
I have a three-level hierarchical grid, and I want to hide the column that contains the expand and collapse buttons.

Has anybody come up with a solution for this yet?  I'm using Q1 2010 Asp.Net AJAX, .Net 3.5, with the Web20 skin.
Ed McCarroll
Top achievements
Rank 1
 answered on 16 Jun 2010
1 answer
345 views
Hi
On thread:
http://www.telerik.com/community/forums/aspnet-ajax/grid/get-row-number-of-grid.aspx
It shows the following:
<script type="text/javascript" language="javascript">  
    function onFocus(sender, args)  
    {  
        var cell = sender.get_element().parentNode.parentNode;  
        alert(cell.parentNode.rowIndex);  
    } 
</script> 
The above gets the row index. 
It seem to me that parentNode.ParentNode gets one to the row.  If context is correct, so from there I should be able to find other controls in the grid data row.  So how do I find the data row object context (not html) and then find other controls.

Phil
Princy
Top achievements
Rank 2
 answered on 16 Jun 2010
1 answer
59 views
Team

In Our application, we are binding RadComboBox with SqlDataSource.

We are populating ComboBox with query "Select Col1, Col2, Col3, Col4 from Table1" and binding Col2 as datasource for the same.

Problem is sometime ComboBox showing Col4 data.

Pls. Clarify.
Thanks

Veronica
Telerik team
 answered on 16 Jun 2010
1 answer
182 views
I use uploadedfile.saveas(targetphysicalfolder) (version 2.3.2.0) to save file on server, but the temporary file is created in temp folder on server and not automatically deleted ever. It makes spaces on our server reduced and our network staff has to manually deleted them regularly. Is there any way to delete the temporary file immediately after uploading?

Here is my code in VB.Net
.aspx: 

<input type="file"

style="width: 95%"
runat="server"
id="inputFile" /> </td>
<td align="left" colspan="2"> <asp:button id="btnUpload"

 

Text=" Upload "

 

runat="server"

 

ToolTip="Click to upload file."

 

CssClass="Button">

 

</asp:button>

 

</td>

<td colspan="2">

 

<radU:RadProgressManager ID="RadProgressManager1" runat="server" UniquePageIdentifier="eae0adf1-8382-4884-8843-a38bf3b99b38" />  

 

 

<radU:RadProgressArea ID="RadProgressArea1" runat="server">  

 

</radU:RadProgressArea>

 

</td>


.aspx.vb

Protected Sub btnUpload_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnUpload.Click

 

 

'Store current user token in a variable...

 

 Dim tokenCurrentUser As System.IntPtr = System.Security.Principal.WindowsIdentity.GetCurrent.Token

Try
file = RadUploadContext.Current.UploadedFiles(inputFile.UniqueID)

'validating

 

 

If validating() = False Then

 

 

 

 

Exit Sub

 

End If


fileName = file.GetName

 

 

fileExt = file.GetExtension

 

filesize = file.ContentLength

 

'Impersonate ASPNETRW account ...  

 

 

Dim szASPNETRWPassword As String = Trim(All.DecryptPassWord(Trim(ConfigurationManager.AppSettings("ASPNETRWPassWord"))))

 

 

 

 

If Not ImpersonateUser.ImpersonateValidUser("aspnetrw", "HCA_LAN", szASPNETRWPassword) Then

 

'Notify user of error...

ClientScripts.CallMsgBox(

 

Me, "Error", "Sorry, unable to access archive at this time.")

Exit Sub

End If

 

 

 

file.SaveAs(ConfigurationManager.AppSettings(

 

"UploadFilePath") & fileName)

'update database
NewPHI_Request()
'send email notice

sendMail()

Response.Redirect("xThankyou.aspx", False)

 

 

 

 

 

 

Catch ex As Exception

 

 Try

 

'pass error to web service...

 xLogError.LogError(ex.Message, ex.StackTrace)

 

 

 

Catch exLogError As Exception  

 

End Try

 

 

 

 

'place error message into session and redirect to error page...

Session.Item(

 

 

 

"ErrorMessage") = ex.Message.ToString()

Response.Redirect(

 

 

 

"xError.aspx", False)  

 

Finally  

 

'Set impersonation back to previous user...  

ImpersonateUser.UndoImpersonation()

System.Security.Principal.WindowsIdentity.Impersonate(tokenCurrentUser)

 

 

 

 

End Try

 

End Sub

 

 

 

 

 

Genady Sergeev
Telerik team
 answered on 16 Jun 2010
2 answers
96 views
Hi all,

I have a very complex page with many sub-levels of hierarchy and I'm encountering some problems on a NestedViewTemplate binding:

System.Web.HttpException was unhandled by user code
  Message=DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'Domicilio'.
  Source=System.Web
  ErrorCode=-2147467259
  WebEventCode=0
 
Here is the code of the problematic level:

<telerik:GridTableView runat="server" AutoGenerateColumns="False" Caption="Elenco Dipendenti" 
                            CommandItemDisplay="Bottom" DataKeyNames="DipendentiID" DataSourceID="SqlDipendentiSource" 
                            AllowSorting="False" EditMode="PopUp" Name="DipendentiView" NoDetailRecordsText="Nessun dipendente per la sede corrente."
                            <CommandItemSettings AddNewRecordText="Aggiungi Dipendente" ShowRefreshButton="False" /> 
                            <Columns> 
                                <telerik:GridButtonColumn ButtonType="ImageButton" UniqueName="DipendentiEditCommandColumn" 
                                    CommandName="Edit" HeaderStyle-Width="30px"
                                    <HeaderStyle Width="30px"></HeaderStyle> 
                                    <ItemStyle CssClass="MyImageButton" /> 
                                </telerik:GridButtonColumn> 
                                <telerik:GridButtonColumn ButtonType="ImageButton" UniqueName="DipendentiDeleteCommandColumn" 
                                    CommandName="Delete" HeaderStyle-Width="30px"
                                    <HeaderStyle Width="30px"></HeaderStyle> 
                                    <ItemStyle CssClass="MyImageButton" /> 
                                </telerik:GridButtonColumn> 
                                <telerik:GridBoundColumn DataField="DipendentiID" HeaderText="ID" SortExpression="DipendentiID" 
                                    UniqueName="DipendentiID" DataType="System.Int32" ReadOnly="True" HeaderStyle-Width="35px" 
                                    HeaderStyle-HorizontalAlign="Center" AllowFiltering="False"
                                    <HeaderStyle HorizontalAlign="Center" Width="35px"></HeaderStyle> 
                                    <ItemStyle HorizontalAlign="Center" /> 
                                </telerik:GridBoundColumn> 
                                <telerik:GridBoundColumn DataField="Nome" HeaderText="Nome" UniqueName="Nome" DataType="System.String" 
                                    ReadOnly="True" HeaderStyle-HorizontalAlign="Center" AllowFiltering="True"
                                    <HeaderStyle HorizontalAlign="Center"></HeaderStyle> 
                                    <ItemStyle HorizontalAlign="Center" /> 
                                </telerik:GridBoundColumn> 
                                <telerik:GridBoundColumn DataField="Cognome" HeaderText="Cognome" UniqueName="Cognome" 
                                    DataType="System.String" ReadOnly="True" HeaderStyle-HorizontalAlign="Center" 
                                    AllowFiltering="True"
                                    <HeaderStyle HorizontalAlign="Center"></HeaderStyle> 
                                    <ItemStyle HorizontalAlign="Center" /> 
                                </telerik:GridBoundColumn> 
                                <telerik:GridTemplateColumn UniqueName="Sesso" InitializeTemplatesFirst="false" HeaderStyle-HorizontalAlign="Center" 
                                    AllowFiltering="false"
                                    <HeaderTemplate> 
                                        Sesso 
                                    </HeaderTemplate> 
                                    <ItemTemplate> 
                                        <%# (((bool)Eval("Sesso")) ? "M" : "F") %> 
                                    </ItemTemplate> 
                                    <HeaderStyle HorizontalAlign="Center"></HeaderStyle> 
                                </telerik:GridTemplateColumn> 
                                <telerik:GridBoundColumn DataField="DataAssunzione" HeaderText="Data di Assunzione" 
                                    UniqueName="DataAssunzione" DataType="System.DateTime" ReadOnly="True" HeaderStyle-HorizontalAlign="Center" 
                                    AllowFiltering="True"
                                    <HeaderStyle HorizontalAlign="Center"></HeaderStyle> 
                                    <ItemStyle HorizontalAlign="Center" /> 
                                </telerik:GridBoundColumn> 
                                <telerik:GridBoundColumn DataField="DataLicenziamento" HeaderText="Data di Licenziamento" 
                                    UniqueName="DataLicenziamento" DataType="System.DateTime" ReadOnly="True" HeaderStyle-HorizontalAlign="Center" 
                                    AllowFiltering="True"
                                    <HeaderStyle HorizontalAlign="Center"></HeaderStyle> 
                                    <ItemStyle HorizontalAlign="Center" /> 
                                </telerik:GridBoundColumn> 
                                <telerik:GridBoundColumn DataField="Telefono" HeaderText="Telefono" UniqueName="Telefono" 
                                    DataType="System.String" ReadOnly="True" HeaderStyle-HorizontalAlign="Center" 
                                    AllowFiltering="False"
                                    <HeaderStyle HorizontalAlign="Center"></HeaderStyle> 
                                    <ItemStyle HorizontalAlign="Center" /> 
                                </telerik:GridBoundColumn> 
                            </Columns> 
                            <RowIndicatorColumn> 
                                <HeaderStyle Width="20px" /> 
                            </RowIndicatorColumn> 
                            <ExpandCollapseColumn> 
                                <HeaderStyle Width="20px" /> 
                            </ExpandCollapseColumn> 
                            <ParentTableRelation> 
                                <telerik:GridRelationFields DetailKeyField="SediID" MasterKeyField="SediID" /> 
                            </ParentTableRelation> 
                            <NestedViewSettings DataSourceID="SqlDipendentiExtendedSource"
                                <ParentTableRelation> 
                                    <telerik:GridRelationFields DetailKeyField="DipendentiID" MasterKeyField="DipendentiID" /> 
                                </ParentTableRelation> 
                            </NestedViewSettings> 
                            <NestedViewTemplate> 
                                <asp:Panel ID="NestedViewDipendentiPanel" runat="server"
                                    <div> 
                                        <fieldset style="padding: 10px;"
                                            <legend style="padding: 5px;">Dettagli su: <b> 
                                                <%# Eval("Nome") %> 
                                                <%# Eval("Cognome") %></b></legend> 
                                            <table width="50%"
                                                <tr> 
                                                    <td> 
                                                        Nome: 
                                                    </td> 
                                                    <td> 
                                                        <%# Eval("Nome") %> 
                                                    </td> 
                                                </tr> 
                                                <tr> 
                                                    <td> 
                                                        Cognome: 
                                                    </td> 
                                                    <td> 
                                                        <%# Eval("Cognome") %> 
                                                    </td> 
                                                </tr> 
                                                <tr> 
                                                    <td> 
                                                        Sesso: 
                                                    </td> 
                                                    <td> 
                                                        <%# (((bool)Eval("Sesso")) ? "Maschio" : "Femmina")%> 
                                                    </td> 
                                                </tr> 
                                                <tr> 
                                                    <td> 
                                                        Telefono: 
                                                    </td> 
                                                    <td> 
                                                        <%# Eval("Telefono")%> 
                                                    </td> 
                                                </tr> 
                                                <tr> 
                                                    <td> 
                                                        Domicilio: 
                                                    </td> 
                                                    <td> 
                                                        <%# Eval("Domicilio") %> 
                                                    </td> 
                                                </tr> 
                                                <tr> 
                                                    <td> 
                                                        Residenza: 
                                                    </td> 
                                                    <td> 
                                                        <%# Eval("Residenza") %> 
                                                    </td> 
                                                </tr> 
                                                <tr> 
                                                    <td> 
                                                        Residenza: 
                                                    </td> 
                                                    <td> 
                                                        <%# Eval("Nascita") %> 
                                                    </td> 
                                                </tr> 
                                                <tr> 
                                                    <td> 
                                                        Data di Assunzione: 
                                                    </td> 
                                                    <td> 
                                                        <%# Eval("DataAssunzione") %> 
                                                    </td> 
                                                </tr> 
                                                <tr> 
                                                    <td> 
                                                        Data di Licenziamento: 
                                                    </td> 
                                                    <td> 
                                                        <%# ((Eval("DataLicenziamento") is DBNull) ? "Nessuna" : Eval("DataLicenziamento")) %> 
                                                    </td> 
                                                </tr> 
                                            </table> 
                                        </fieldset> 
                                    </div> 
                                </asp:Panel> 
                            </NestedViewTemplate> 
                            <EditFormSettings EditFormType="Template"
                                <FormTemplate> 
                                </FormTemplate> 
                            </EditFormSettings> 
                        </telerik:GridTableView> 

I use 2 SqlDataSources:

    <asp:SqlDataSource ID="SqlDipendentiSource" runat="server" ConnectionString="<%$ ConnectionStrings:ReleaseConnection %>" 
        SelectCommand="SELECT ML.Dipendenti.id AS DipendentiID, ML.Dipendenti.Nome, ML.Dipendenti.Cognome, ML.Dipendenti.Sesso, ML.Dipendenti.DataAssunzione, ML.Dipendenti.DataLicenziamento, ML.Dipendenti.Telefono, LocalitaPaesi.Via + ' ' + LocalitaPaesi.Numero + ', ' + LocalitaPaesi.NomeComune + ' (' + LocalitaPaesi.ProvinciaSigla + ') ' + LocalitaPaesi.PaeseSigla AS Residenza FROM ML.Dipendenti INNER JOIN LocalitaPaesi ON ML.Dipendenti.LuogoResidenza = LocalitaPaesi.id WHERE (ML.Dipendenti.Sede = @SediID)"
        <SelectParameters> 
            <asp:Parameter Name="SediID" Type="Int32" /> 
        </SelectParameters> 
    </asp:SqlDataSource> 
 

and

    <asp:SqlDataSource ID="SqlDipendentiExtendedSource" runat="server" ConnectionString="<%$ ConnectionStrings:ReleaseConnection %>" 
        SelectCommand="SELECT ML.Dipendenti.id AS DipendentiID, ML.Dipendenti.Nome, ML.Dipendenti.Cognome, ML.Dipendenti.Sesso, ML.Dipendenti.DataAssunzione, ML.Dipendenti.DataLicenziamento, ML.Dipendenti.DataNascita, ML.Dipendenti.Telefono, LocalitaPaesiDomicilio.Via + ' ' + LocalitaPaesiDomicilio.Numero + ', ' + LocalitaPaesiDomicilio.NomeComune + ' (' + LocalitaPaesiDomicilio.ProvinciaSigla + ') ' + LocalitaPaesiDomicilio.PaeseSigla AS Domicilio, LocalitaPaesiLuogoResidenza.Via + ' ' + LocalitaPaesiLuogoResidenza.Numero + ', ' + LocalitaPaesiLuogoResidenza.NomeComune + ' (' + LocalitaPaesiLuogoResidenza.ProvinciaSigla + ') ' + LocalitaPaesiLuogoResidenza.PaeseSigla AS Residenza, LocalitaPaesiLuogoNascita.Via + ' ' + LocalitaPaesiLuogoNascita.Numero + ', ' + LocalitaPaesiLuogoNascita.NomeComune + ' (' + LocalitaPaesiLuogoNascita.ProvinciaSigla + ') ' + LocalitaPaesiLuogoNascita.PaeseSigla AS Nascita, ML.Medici.Nome AS NomeMedico, ML.Medici.Cognome AS CognomeMedico, ML.Medici.Telefono AS TelefonoMedico, LocalitaMedico.Via + ' ' + LocalitaMedico.Numero + ', ' + LocalitaMedico.NomeComune + ' (' + LocalitaMedico.ProvinciaSigla + ') ' + LocalitaMedico.PaeseSigla AS LocalitaMedico FROM ML.Dipendenti INNER JOIN LocalitaPaesi AS LocalitaPaesiDomicilio ON ML.Dipendenti.LuogoResidenza = LocalitaPaesiDomicilio.id INNER JOIN LocalitaPaesi AS LocalitaPaesiLuogoNascita ON ML.Dipendenti.LuogoNascita = LocalitaPaesiLuogoNascita.id INNER JOIN LocalitaPaesi AS LocalitaPaesiLuogoResidenza ON ML.Dipendenti.LuogoResidenza = LocalitaPaesiLuogoResidenza.id INNER JOIN ML.TitoliStudio ON ML.Dipendenti.TitoloStudio = ML.TitoliStudio.id INNER JOIN ML.Medici ON ML.Dipendenti.Medico = ML.Medici.id INNER JOIN LocalitaPaesi AS LocalitaMedico ON ML.Medici.Locazione = LocalitaMedico.id WHERE (ML.Dipendenti.id = @DipendentiID)"
        <SelectParameters> 
            <asp:Parameter Name="DipendentiID" Type="Int32" /> 
        </SelectParameters> 
    </asp:SqlDataSource> 
 

I know that those queries can be optimized/reduced and DataGrid layout/paging is actually like "out of the box", but I'm very short of time :(

It seems that DataBinder cannot find SqlDipendentiExtendedSource field but only SqlDipendentiSource ones... how can it be?

thanks in advance for you help!
Yavor
Telerik team
 answered on 16 Jun 2010
1 answer
100 views
Hi all,

I have one issue,i am using one grid which contain one dropdwn column.
in some cases i dont want to select dropdown columns and set EnableEmptyListItem

now i am able to show blank value in grid at that particular row but in edit mode i want to apply requirefield validator if blank value is selected ....how can i apply that....

reply asap



Shinu
Top achievements
Rank 2
 answered on 16 Jun 2010
1 answer
112 views
I have grid footers that are showing the sum of my currency columns for all pages.  So I'm using the DataBound function of my grid to query the data and then create a footer object and place my totals in the footer line.  This all works great! 

However, I have filter criteria above my grid and would like to have the totals reflect the selected criteria.  How would I go about doing this?

See attached screen shot of my form.


Princy
Top achievements
Rank 2
 answered on 16 Jun 2010
3 answers
144 views
I'm running ASP.NET AJAX Q3 2009 and have a grid with a detail table that I need to export.
The master table is populated through the NeedDataSource event and the detail table is populated through the DetailTableDataBind event.

When exporting, I am unable to include the records from the detail table. here is the code for the grid on the aspx page

<telerik:RadGrid  
            ID="rdgCorrespondence"  
            runat="server"  
            AllowFilteringByColumn="True" 
            AllowPaging="True"  
            AllowSorting="True"  
            AutoGenerateColumns="False"  
            GridLines="None" 
            OnNeedDataSource="rdgCorrespondence_NeedDataSource"  
            OnDetailTableDataBind="rdgCorrespondence_DetailTableDataBind" 
            OnItemDataBound="rdgCorrespondence_ItemDataBound"  
            OnInsertCommand="rdgCorrespondence_InsertCommand" 
            OnUpdateCommand="rdgCorrespondence_UpdateCommand"  
            onitemcommand="rdgCorrespondence_ItemCommand"
            <MasterTableView  
                CommandItemDisplay="Top"  
                DataKeyNames="CorrespondenceID"  
                Name="Correspondences" 
                Width="100%" 
                HierarchyLoadMode="ServerBind"
                <CommandItemSettings  
                    ShowExportToExcelButton="true" 
                /> 
                 
                <EditFormSettings> 
                    <EditColumn UniqueName="EditCommandColumn1"
                    </EditColumn> 
                </EditFormSettings> 
                <HeaderStyle HorizontalAlign="Center" /> 
                <ExpandCollapseColumn Visible="True"
                </ExpandCollapseColumn> 
                <Columns> 
                    <telerik:GridEditCommandColumn ButtonType="ImageButton"
                    </telerik:GridEditCommandColumn> 
                    <telerik:GridBoundColumn DataField="CorrespondenceID" HeaderText="ID" UniqueName="CorrespondenceID" 
                        ReadOnly="true" FilterControlWidth="20" ItemStyle-Width="25" ItemStyle-HorizontalAlign="Right" ForceExtractValue="Always"
                    </telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn UniqueName="TypeName" HeaderText="Type" DataField="TypeName"
                    </telerik:GridBoundColumn> 
                </Columns> 
                <DetailTables> 
                    <telerik:GridTableView  
                        DataKeyNames="CorrespondenceNoteID"  
                        CommandItemDisplay="Top" 
                        Name="CorrespondenceNotes"  
                        Width="100%"  
                        AllowFilteringByColumn="false"  
                        BorderColor="#fff" 
                        HierarchyLoadMode="Client"
                        <ParentTableRelation> 
                            <telerik:GridRelationFields DetailKeyField="CorrespondenceID" MasterKeyField="CorrespondenceID" /> 
                        </ParentTableRelation> 
                        <Columns> 
                            <telerik:GridEditCommandColumn ButtonType="ImageButton"
                            </telerik:GridEditCommandColumn> 
                            <telerik:GridBoundColumn DataField="CorrespondenceNoteID" HeaderText="Note ID" UniqueName="CorrespondenceNoteID" 
                                ReadOnly="true"
                            </telerik:GridBoundColumn> 
                            <telerik:GridDateTimeColumn DataField="DateOfNote" HeaderText="Date" UniqueName="DateOfNote"
                            </telerik:GridDateTimeColumn> 
                            <telerik:GridBoundColumn DataField="Note" HeaderText="Comment" UniqueName="Note"
                            </telerik:GridBoundColumn> 
                            <telerik:GridBoundColumn DataField="CorrespondenceID" HeaderText="Correspondence ID" 
                                UniqueName="CorrespondenceID" ReadOnly="true" Display="false"
                            </telerik:GridBoundColumn> 
                        </Columns> 
                        <SortExpressions> 
                            <telerik:GridSortExpression FieldName="DateOfNote" SortOrder="Descending" /> 
                        </SortExpressions> 
                    </telerik:GridTableView> 
                </DetailTables> 
            </MasterTableView> 
        </telerik:RadGrid> 

and here is my excel call:
 
        protected void rdgCorrespondence_ItemCommand(object source, GridCommandEventArgs e) 
        { 
            string fileName = "Correspondences"
 
            if (e.CommandName = RadGrid.ExportToExcelCommandName) 
            { 
                grid.ExportSettings.FileName = fileName; 
                grid.ExportSettings.HideStructureColumns = true
                grid.ExportSettings.IgnorePaging = true
                grid.ExportSettings.OpenInNewWindow = true
                grid.ExportSettings.ExportOnlyData = true
                grid.MasterTableView.ExportToExcel(); 
            } 
        } 

Is the current implementation of the radgrid not support this type of export?
Daniel
Telerik team
 answered on 16 Jun 2010
1 answer
50 views
hi all:
   my English is not good .
 when I use the ajax refresh the page ,the page will "all select ",I don't know why ,could you answer this question ,thinks very much.
this is the javascript code :
function CloseAndRebind(age) {  
    GetRadWindow().BrowserWindow.refreshGrid(age);  
    GetRadWindow().Close();  

best regards!
Yavor
Telerik team
 answered on 16 Jun 2010
1 answer
114 views
Can we make the background of top menu items transparent?
Kamen Bundev
Telerik team
 answered on 16 Jun 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?