Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
48 views
How can i make a row select on checking the checkbox?
Princy
Top achievements
Rank 2
 answered on 29 Aug 2011
1 answer
59 views
I have a radgrid in which i have set allowfilteringbycolumn as true.How can i set focus in the filterbox after filtering
Shinu
Top achievements
Rank 2
 answered on 29 Aug 2011
2 answers
112 views
Hi Telerik,

I'm using RadGrid Q2 2011, now I want to add more PagerSize in RadGrid,
Default is {10, 20, 50}, I want add more like {10, 20, 50, 100, 150, ...}
Please show me the way to do this.
Thanks
VnDevil
Top achievements
Rank 2
 answered on 29 Aug 2011
4 answers
656 views

I have a child grid on a page.

In it's declaration I have added a call to the event handler "OnItemDataBound".
OnItemDataBound="rgContacts_ItemDataBound"

Back in the code behind I have this..

protected void rgContacts_ItemDataBound(object sender, GridItemEventArgs e)
{
    if (e.Item is GridDataItem && e.Item.OwnerTableView.DataSourceID == "dsContacts")
    {
        Literal ltPrimaryContact = e.Item.FindControl("ltPrimaryContact") as Literal;
 
 
    }
}

If there are 2 rows in the Contacts grid, then this method gets called twice as you would expect.

Furthermore, the IF condition is true in both cases.

However if I put a break point on the line within the IF condition, and in the watch window examine the value of...
e.Item.OwnerTableView.Items[e.Item.ItemIndex]

I get this error...

'e.Item.OwnerTableView.Items[e.Item.ItemIndex]' threw an exception of type 'System.ArgumentOutOfRangeException'    Telerik.Web.UI.GridDataItem {System.ArgumentOutOfRangeException}

Needless to say, if I try this...

e.Item.OwnerTableView.Items[e.Item.ItemIndex]["con_Phone"].Text

Where 'con_Phone' is one of the values from the grid, I get the same error.

I am unable to extract any of the values in the current row.

I am using the code on this Telerik page. Alas it does not work.

http://www.telerik.com/help/aspnet-ajax/grid-extract-primary-key-for-parent-item-in-hierarchy-on-update-insert.html

What am I missing here?

Thanks.

Brad












Brad
Top achievements
Rank 1
 answered on 29 Aug 2011
6 answers
633 views
Hello,

I read a couple of articles and forum threads about applying a dropdownlist (combobox) as a filter option in RadFilter.

The samples uses a DataSource in the page though, while I want to use the OnNeedDataSource for the grid and the FilterContainerID for the RadFilter to automatically show filter field.

Here is what I got to far, so I don't get any errors:

<telerik:RadGrid ID="rgTasks" runat="server" OnNeedDataSource="rgTasks_OnNeedDataSource"
    EnableViewState="false" AutoGenerateColumns="false" Skin="WebBlue" PageSize="10"
    EnableLinqExpressions="true" AllowPaging="true" AllowSorting="true" AllowFilteringByColumn="true"
    ShowStatusBar="true">
    <PagerStyle AlwaysVisible="true" Position="Top" Width="100%" />
    <MasterTableView DataKeyNames="OID" ClientDataKeyNames="OID" IsFilterItemExpanded="false">
        <SortExpressions>
            <telerik:GridSortExpression FieldName="Startdatum" SortOrder="Ascending" />
        </SortExpressions>
        <Columns>
            <telerik:GridBoundColumn DataField="OID" HeaderText="OID" Visible="false" AllowFiltering="false">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="Volgnummer" HeaderText="Volgnummer" Visible="false"
                UniqueName="Volgnummer" AllowFiltering="true">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="Taak" HeaderText="Dossier" DataType="System.String"
                UniqueName="Taak" AllowFiltering="false">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="Status" HeaderText="Status" DataType="System.String"
                UniqueName="Status">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="Startdatum" HeaderText="Startdatum" HeaderStyle-Width="110px"
                DataFormatString="<nobr>{0:dd/MM/yyyy}</nobr>" UniqueName="Startdatum" AllowFiltering="true">
            </telerik:GridBoundColumn>
        </Columns>
    </MasterTableView>
    <ClientSettings EnableRowHoverStyle="true">
        <ClientEvents OnRowClick="rowClick" />
        <Resizing AllowColumnResize="true" />
        <Selecting AllowRowSelect="true" />
        <DataBinding EnableCaching="true">
        </DataBinding>
    </ClientSettings>
</telerik:RadGrid>
<p>
    Filter toepassen:</p>
<br />
<telerik:RadFilter ID="radFilter" runat="server" ExpressionPreviewPosition="Bottom"
    OnFieldEditorCreating="RadFilter1_FieldEditorCreating" OnApplyExpressions="RadFilter1_ApplyExpressions"
    Localization-FilterFunctionBetween="Tussen" Localization-FilterFunctionContains="Bevat"
    Localization-FilterFunctionDoesNotContain="Bevat Niet" Localization-FilterFunctionEndsWith="Eindigt op"
    Localization-FilterFunctionEqualTo="Gelijk aan" Localization-FilterFunctionGreaterThan="Groter dan"
    Localization-FilterFunctionGreaterThanOrEqualTo="Groter dan of gelijk aan" Localization-FilterFunctionIsEmpty="Is Leeg"
    Localization-FilterFunctionIsNull="Ongedefinieerd" Localization-FilterFunctionLessThan="Kleiner dan"
    Localization-FilterFunctionLessThanOrEqualTo="Kleiner dan of gelijk aan" Localization-FilterFunctionNotBetween="Niet tussen"
    Localization-FilterFunctionNotEqualTo="Niet gelijk aan" Localization-FilterFunctionNotIsEmpty="Is niet leeg"
    Localization-FilterFunctionNotIsNull="Is niet ongedefinieerd" Localization-FilterFunctionStartsWith="Begint met"
    Localization-GroupOperationAnd="En" Localization-GroupOperationNotAnd="En niet"
    Localization-GroupOperationNotOr="Of niet" Localization-GroupOperationOr="Of"
    AddExpressionToolTip="Expressie toevoegen" AddGroupToolTip="Groepering toeveoegen"
    ApplyButtonText="Toepassen" BetweenDelimeterText="en" Culture="nl-NL" RemoveToolTip="Verwijderen"
    ShowLineImages="true" SettingsFormatter="BinaryFormatter">
    <FieldEditors>
        <custom:radfilterdropdowneditor datatextfield="Status" datavaluefield="Status" fieldname="Status"
            datatype="System.String" displayname="Status" />
    </FieldEditors>
</telerik:RadFilter>

Code behind:

protected void rgTasks_OnNeedDataSource(object sender, GridNeedDataSourceEventArgs e)
    {
        DataTable dt = new DataTable();
        dt.Columns.Add("OID", typeof(long));
        dt.Columns.Add("Taak", typeof(string));
        dt.Columns.Add("Startdatum", typeof(DateTime));
        dt.Columns.Add("Status", typeof(string));
        dt.Columns.Add("Volgnummer", typeof(int));
 
        StoredProcedure sp = new StoredProcedure("getAllAanvragen");
        sp.addParameter("@regOID", "7");
 
         
        DataSet ds = sp.executeDataSet();
        if (ds != null && ds.Tables.Count > 0)
        {
            foreach (DataRow row in ds.Tables[0].Rows)
            {
                DataRow newRow = dt.NewRow();
                newRow["OID"] = long.Parse(row["OID"].ToString());
                newRow["Taak"] = CommonFunctions.makeDossiernummer(row["Dossiernummer"].ToString(), row["Volgnummer"].ToString());
                newRow["Volgnummer"] = int.Parse(row["volgnummer"].ToString());
                newRow["Startdatum"] = DateTime.Parse(row["gestartOp"].ToString());
 
 
                newRow["Status"] = Hive.Util.HiveEnum.getDescription((CommonEnums.AanvraagStatus)row["status"]);
                 
 
                dt.Rows.Add(newRow);
 
            }
        }
 
        rgTasks.DataSource = dt;
         
    }
 
    protected void RadFilter1_ApplyExpressions(object sender, RadFilterApplyExpressionsEventArgs e)
    {
        RadFilterSqlQueryProvider provider = new RadFilterSqlQueryProvider();
        provider.ProcessGroup(e.ExpressionRoot);
         
    }
 
    protected void RadFilter1_FieldEditorCreating(object sender, RadFilterFieldEditorCreatingEventArgs e)
    {
        e.Editor = new RadFilterDropDownEditor();
    }


But like this of course the dropdown doesn't show any values and only the Status filter shows.

If I add FilterContainerID="rgTasks" to the filter of course I get all fields as I want. However when i select the Status field, I get an exception:

Failed to load viewstate.  The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during the previous request.  For example, when adding controls dynamically, the controls added during a post-back must match the type and position of the controls added during the initial request.

This is kind of expected. the filter already is on the page, I add new one. Viewstate gets broken. Dont know the exact detail, but seems logical to me.

My question is, is it possible to achieve what I want? So override the Status filter which is automatically generated from the FilterContainerID="rgTasks" with a custom filter (combobox containing the available values for the Status colum)

Thanks in advance 

/yeroon
Paul Taylor
Top achievements
Rank 1
 answered on 28 Aug 2011
1 answer
230 views
Hi,
 Iam trying to save the uploaded image into database and also into folder in my project.Problem is that not able to save image into folder
error:The process cannot access the file because it is being used by another process

protected void RadGrid_Insert(object sender, GridCommandEventArgs e)

{

 

GridEditFormInsertItem InsertItem = e.Item as GridEditFormInsertItem;

try 
{

 

string Name = (InsertItem.FindControl("txbName") as TextBox).Text;

string Address = (InsertItem.FindControl("txtAddress") as TextBox).Text;

string ContactPerson = (InsertItem.FindControl("txtContactPerson") as TextBox).Text;

int PhoneNumber = int.Parse((InsertItem.FindControl("txtPhoneNumber") as TextBox).Text);

 

string EmailID = (InsertItem.FindControl("txtEmail") as TextBox).Text;

RadAsyncUpload radAsyncUpload = InsertItem.FindControl("AsyncUpload1") as RadAsyncUpload;

UploadedFile file = radAsyncUpload.UploadedFiles[0];

string s = file.FileName;

string path = "images/"; 

 

byte[] fileData = new byte[file.InputStream.Length];

file.InputStream.Read(fileData, 0, (

int)file.InputStream.Length);

 

UploadedFile file1 = radAsyncUpload.UploadedFiles[0];

file1.SaveAs(Server.MapPath(path+s));

Jayesh Goyani
Top achievements
Rank 2
 answered on 28 Aug 2011
1 answer
117 views
Hi Telerik Team,

   I am Arvind i am working on the rad Ajax manager, I am using rad Read Pane, inside the radPane i have created a HTML table with ID "messageTable" and i have added this Control (messageTable) to AjaxSettings Updated Control , inside the Table i have added a Asp Place Holder, at runtime i am adding LinkButtons to this and also i have added Event handler for this link buttons, My event handler Appears as follows:

protected void lb_Command(object sender, CommandEventArgs e)
        {
            //CreateLinks();

            Response.ContentType = "application/octet-stream";
                Response.AppendHeader("Content-Disposition", "attachment;filename=" + fileName);
                //string aaa = Server.MapPath(spath + fileName);
                Response.TransmitFile(Server.MapPath("~/" + spath + "/" + fileName));
                Response.End();
        }


on clicking the link the event is being fired and it is connecting to data base and getting the required data, after getting data from database , the data that is being retrieved consists of a file (binary data)  when i try to down load the file i am getting the following error as shown in the figure : "Attachment Error.JPG".

Please help me as soon as possible.

Thanks & Regards
N A Chary.

Jayesh Goyani
Top achievements
Rank 2
 answered on 28 Aug 2011
0 answers
101 views
Hello!
A simple question: I used the image in the grid to export to excel, pdf and word.I want to show hidden column after the grid exported.
How can I put the code in the image click event?

 I know we can put display=true in in the clieck event if there is a button there.
I used GridExporting event and put the display=true code inside. It seem to me that it doesn't work.
 Is it a click event also ? What is the name of the event?

Thanks for any help!

Amy
I used the code. It is working. No help is needed.  Amy

  protected void rg_ItemCommand(object sender, GridCommandEventArgs e)
  {
      if (e.CommandName == RadGrid.ExportToExcelCommandName)
      {
          rg.MasterTableView.GetColumn("x").Visible = false;
          rg.MasterTableView.GetColumn("y").Visible = true;              }
}
Amy Liu
Top achievements
Rank 1
 asked on 28 Aug 2011
9 answers
208 views

I am evaluating the RAD Scheduler for possible purchase and I’m trying to implement a solution where an Exchange 2007 server would be the primary data source for the scheduler.  I have been able to pull in my own mailbox and add, update and delete items just fine but I also need to be able to do this for other users in the organization.  Back in April 2009 another user posted the following thread

“How do I get it to work with public folders or to load another user's calendar (to which the logged in user has access rights in Exchange)?  The provider only takes a username, password, and domain along with the server URL.  I don't see how to specify a particular folder or path.  Looking at Telerik's source code for the Exchange provider, I do see that the DistinguishedFolderIdNameType enumerated date type includes an option for publicfoldersroot, but it doesn't appear to be used anywhere.

Similarly, I'd also like User A, who has access rights to User B's calendar, to be able to do so, but, again, I don't see where I can specify the alternate calendar location.”

Teleriks response was as follows:

“The FindCalendarItems method currently queries only the authenticated users calendar:

DistinguishedFolderIdType[] folderIDArray = new DistinguishedFolderIdType[1];
folderIDArray[0] = new DistinguishedFolderIdType();
folderIDArray[0].Id = DistinguishedFolderIdNameType.calendar;
findItemRequest.ParentFolderIds = folderIDArray;

We can other calendars here as well:

// Identify which folders to search.
List<DistinguishedFolderIdType> folderIDs = new List<DistinguishedFolderIdType>();

DistinguishedFolderIdType ownCalendar = new DistinguishedFolderIdType();
ownCalendar.Id = DistinguishedFolderIdNameType.calendar;
folderIDs.Add(ownCalendar);

DistinguishedFolderIdType otherCalendar = new DistinguishedFolderIdType();
otherCalendar.Id = DistinguishedFolderIdNameType.calendar;

EmailAddressType otherMailbox = new EmailAddressType();
otherMailbox.EmailAddress = "other.user@contoso.com";


otherCalendar.Mailbox = otherMailbox;
folderIDs.Add(otherCalendar);

findItemRequest.ParentFolderIds = folderIDs.ToArray();”

I’ve tried implementing this code but still cannot see any other users on the scheduler.  Is there any other examples or documentation that could help me out here?

Veronica
Telerik team
 answered on 27 Aug 2011
1 answer
114 views
hi,

I used the radscheduler control , when i click on the week tab on top of right side its shows the all the seven days in the bellow scheduler
My problem like this,
 when i click the particular day in the scheduler it show the only particular day  appointments in the top it shows the selected date on top, crome it show the selected day , but in IE9  not compatibility mode and Fire Fox 5 it show the privies day (example  i select the 25 Aug 2011  it show the 24 Aug 2011) .

help me why we got browsers problem , not only this place i got so many  scenarios also , how can i update this type of the issues.

Srinivasarao    

  
Veronica
Telerik team
 answered on 27 Aug 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
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?