Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
68 views
Hello. I have broken down my problem into a very simple page and I'm sure the solution is simple as well. I do need to rebind the grid (not in this example but in my real scenario I do) and my question is why the Rate event is triggered a second time when rebinding the grid? I have already handled the Rate event, saved my rating to the database, and as a final step I want to rebind the grid so that some other data is updated, for example some average rating or something like that. (My grid template column is much more advanced in the real scenario with lots of controls that needs to be updated when a new rating has been saved).

I've played around alot with simple binding, advanced binding and all sorts of things but right now my example looks like below. Please tell me how to solve this.

Here is the Code Behind    
public void Page_Load(object sender, System.EventArgs e)
{
    if (!IsPostBack)
    {
        FillGrid();
    }
}
 
public void FillGrid()
{
    RadGridItemRateSimple.DataSource = new ItemRateDTOService().GetItemsBySearchCriterion(new ItemSearchCriterion());
}
 
protected void RadGridItemRate_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
    FillGrid();
}
 
protected void RadGridItemRate_ItemDataBound(object sender, GridItemEventArgs e)
{
    if (e.Item.ItemType == GridItemType.Item || e.Item.ItemType == GridItemType.AlternatingItem)
    {
        ItemRateDTO itemRateDTO = (ItemRateDTO)e.Item.DataItem;
        RadRating radRating = (RadRating)e.Item.FindControl("RadRatingItem");
        if (radRating != null)
        {
            radRating.DbValue = CommonFunctions.SetDecimal(itemRateDTO.GetAvgRating());
        }
    }
}
 
protected void RadRatingItem_Rate(object sender, EventArgs e)
{
    RadRating radRating = (RadRating)sender;
    GridDataItem dataItem = (GridDataItem)radRating.Parent.Parent;
 
    long itemID = CommonFunctions.SetLong(RadGridItemRateSimple.MasterTableView.DataKeyValues[dataItem.ItemIndex]["Item.ID"]);
    Rating rating = new RatingService().GetSpecificRatingForUser(itemID, ActiveUserID);
 
    if (rating == null)
        rating = new Rating();
 
    rating.ItemID = itemID;
    rating.Rate = Convert.ToInt32(radRating.Value * 10);
    rating.CreatedBy = ActiveUserID;
 
    new RatingService().Save(rating);
     
    RadGridItemRateSimple.Rebind();
}

and the aspx
<telerik:RadGrid ID="RadGridItemRateSimple" OnItemDataBound="RadGridItemRate_ItemDataBound"  OnNeedDataSource="RadGridItemRate_NeedDataSource"
    runat="server" Width="850px" AllowSorting="True" AllowPaging="true" PagerStyle-Position="TopAndBottom" PageSize="30"
    AutoGenerateColumns="False" BorderWidth="0">
    <MasterTableView DataKeyNames="Item.ID">
        <Columns>
            <telerik:GridTemplateColumn ItemStyle-VerticalAlign="Top" HeaderText="" SortExpression="ItemName">
                <ItemTemplate>
                    <telerik:RadRating ID="RadRatingItem" runat="server" ItemCount="10" SelectionMode="Continuous"
                                    Precision="Half" Orientation="Horizontal" AutoPostBack="true" OnRate="RadRatingItem_Rate" />
                </ItemTemplate>
            </telerik:GridTemplateColumn>
        </Columns>
    </MasterTableView>
</telerik:RadGrid>

Thanks!
Tsvetie
Telerik team
 answered on 13 Jan 2011
3 answers
106 views
Hi,

I set the skin ptoperty to Vista, or other skins exists in telerik package but it does not apply the skina at all.  what am I missed here?

Reards
Mazdak
Yana
Telerik team
 answered on 13 Jan 2011
7 answers
150 views
Hi,
    I am working on Scheduler/Resource Availability having problem with groupby property of Scheduler it's not working .

I am using following code on server side :
Code Snippet :

protected void Page_Load(object sender, EventArgs e)
{
DataTable tblTest = new DataTable();
tblTest.Columns.Add("ID");
tblTest.Columns.Add("RoomID");
tblTest.Columns.Add("startdate");
tblTest.Columns.Add("enddate");
tblTest.Columns.Add("Subject");
tblTest.Columns.Add("RoomName");
DataRow drTest;
drTest = tblTest.NewRow();
drTest["ID"] = 2;
drTest["RoomID"] = 2;
drTest["startdate"] = "2011-01-11 10:00:00.000";
drTest["enddate"] = "2011-01-11 12:00:00.000";
drTest["Subject"] = "Scheduled Lesson1";
drTest["RoomName"] = "Room1";
tblTest.Rows.Add(drTest);

drTest = tblTest.NewRow();
drTest["ID"] = 2;
drTest["RoomID"] = 2;
drTest["startdate"] = "2011-01-11 14:00:00.000";
drTest["enddate"] = "2011-01-11 16:00:00.000";
drTest["Subject"] = "Scheduled Lesson2";
drTest["RoomName"] = "Room1";
tblTest.Rows.Add(drTest);

drTest = tblTest.NewRow();
drTest["ID"] = 3;
drTest["RoomID"] = 3;
drTest["startdate"] = "2011-01-11 12:00:00.000";
drTest["enddate"] = "2011-01-11 14:00:00.000";
drTest["Subject"] = "Scheduled Lesson3";
drTest["RoomName"] = "Room2";
tblTest.Rows.Add(drTest);

drTest = tblTest.NewRow();
drTest["ID"] = 4;
drTest["RoomID"] = 4;
drTest["startdate"] = "2011-01-11 12:00:00.000";
drTest["enddate"] = "2011-01-11 14:00:00.000";
drTest["Subject"] = "Scheduled Lesson4";
drTest["RoomName"] = "Room3";
tblTest.Rows.Add(drTest);

RadScheduler2.ResourceTypes[0].DataSource = tblTest;
RadScheduler2.DataSource = tblTest;
RadScheduler2.DataBind();

}

and following is design part(.aspx)

<telerik:RadScheduler ID="RadScheduler2" Skin="Vista" runat="server" DataKeyField="ID"
        DataSubjectField="Subject" GroupBy="Room" GroupingDirection="Horizontal" DataStartField="startdate"     DataEndField="enddate"  Height="552px">
        <AdvancedForm Modal="true" />
        <TimelineView UserSelectable="false" />
        <WeekView UserSelectable="false" />
        <MonthView UserSelectable="false" />
        <DayView UserSelectable="false" />
        <ResourceTypes>
            <telerik:ResourceType KeyField="ID" Name="Room" TextField="RoomName" ForeignKeyField="RoomID" />
        </ResourceTypes>
        <AppointmentTemplate>
            <div class="rsAptSubject">
                <%# Eval("Subject") %>
            </div>
            <%# Eval("Description")%>
        </AppointmentTemplate>
        <TimeSlotContextMenuSettings EnableDefault="true" />
        <AppointmentContextMenuSettings EnableDefault="true" />
</telerik:RadScheduler>

You can check its output in attachment.

Is anything wrong with the code?
Can you help?


Thanks & Regards,
Ruchir

Ruchir
Top achievements
Rank 1
 answered on 13 Jan 2011
2 answers
140 views

Hi

I am trying to hide the GridEditCommandColumn of a GridTableView when the user clicks on the “add new record” commandItem of the GridTableView.

GridEditCommandColumn editColumnMaster = (GridEditCommandColumn)radGridProjects.MasterTableView.GetColumn("masterEditColum");

editColumnMaster.Visible = false;

 

The above code in the item command event of the grid works perfectly to hide the editcolumn of the mastertableview but not the detail table. It seems to me the GridTableView’s editcolumn only hides after the user clicks on save or cancel. The hierarchy load mode of the grid is set to ServerBind and I am using form templates.

 

Thank you

Fred

Fred Mare
Top achievements
Rank 1
 answered on 13 Jan 2011
3 answers
66 views
Hi!

I've been looking at the telerik editor specifications and I have a question. Does it have support to edit existing .doc files?
Example, I have a .doc file and on the page load of the webform where i have the editor i want to load the .doc file to the edit it.
Is this possible?

Thanks in advance,
Rumen
Telerik team
 answered on 13 Jan 2011
2 answers
202 views
I am using radgrid in my project, i have a strange issue about confirmation dialog,
below is a sample code from one of my aspx page...

<telerik:GridButtonColumn CommandName="Delete" HeaderStyle-Width="30px" Text="Delete" UniqueName="columnButtonDelete"   ConfirmDialogType="RadWindow" ConfirmText="Are you sure to delete the record?" ConfirmTitle="Confirm Delete">
</telerik:GridButtonColumn>

the confirmation dialog window opens and works as expected, no problem...

However, some records should be disabled for deleting, when I disable those records from code-behind (inside ItemDataBound event of the gridview) like:

CType(DataItem("columnButtonDelete").Controls(0), LinkButton).Enabled = False

The button is disabled, no problem... But a user still can click on that button and the confirmation dialog pop-ups!?
If the user clicks on 'Yes' to try deleting the record, the confirmation window closes, but the record is not being deleted...

Is it a bug? How can i prevent a disabled button to be clicked?
Mehmet Emrah
Top achievements
Rank 1
 answered on 13 Jan 2011
1 answer
886 views
Hi,
I want to apply Filter in GridTemplateColumn, Please help....
I have paste the code below.


<telerik:RadGrid ID="RadGridCategory" runat="server" GridLines="None" AllowPaging="True"
                                                PageSize="5" AllowSorting="True" AutoGenerateColumns="False" ShowStatusBar="true"
                                                HorizontalAlign="NotSet" AllowMultiRowEdit="false" OnNeedDataSource="RadGridCategory_NeedDataSource"
                                                OnItemCommand="RadGridCategory_ItemCommand" Width="100%" OnUpdateCommand="RadGridCategory_UpdateCommand"
                                                AllowMultiRowSelection="False">
                                                <PagerStyle Mode="NextPrevAndNumeric"></PagerStyle>
                                                <GroupingSettings CaseSensitive="false" />
                                                <MasterTableView CommandItemDisplay="Bottom" DataKeyNames="CategoryID" EditMode="InPlace">
                                                    <CommandItemSettings ShowAddNewRecordButton="false" />
                                                    <Columns>
                                                        <telerik:GridBoundColumn UniqueName="CategoryID" HeaderText="CategoryID" DataField="CategoryID"
                                                            Visible="false">
                                                        </telerik:GridBoundColumn>                                                      
                                                        <telerik:GridTemplateColumn UniqueName="EditColumn" ItemStyle-VerticalAlign="Middle" ItemStyle-HorizontalAlign="Left"
                                                            HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Left" HeaderText="Category Name">
                                                            <ItemTemplate>
                                                                <asp:Label ID="lblName" runat="server" Text="<%# Bind('CategoryName') %>"></asp:Label>
                                                            </ItemTemplate>
                                                            <EditItemTemplate>
                                                                <asp:TextBox ID="txtName" runat="server" Text="<%# Bind('CategoryName') %>"></asp:TextBox>
                                                                <asp:RequiredFieldValidator ID="rqfName" runat="server" ControlToValidate="txtName"
                                                                    ErrorMessage="Category Name is Required."></asp:RequiredFieldValidator>
                                                            </EditItemTemplate>
                                                        </telerik:GridTemplateColumn>
                                                        <telerik:GridBoundColumn UniqueName="DisplayText" HeaderText="Display Text" DataField="DisplayText"
                                                            HeaderStyle-Font-Bold="true">
                                                        </telerik:GridBoundColumn>
                                                        <telerik:GridEditCommandColumn EditText="">
                                                        </telerik:GridEditCommandColumn>
                                                        <telerik:GridButtonColumn CommandName="EditIt" Text="Edit">
                                                        </telerik:GridButtonColumn>
                                                        <telerik:GridTemplateColumn UniqueName="DeleteColumn" ItemStyle-VerticalAlign="Middle"
                                                            ItemStyle-HorizontalAlign="Center">
                                                            <ItemTemplate>
                                                                <asp:LinkButton runat="server" CausesValidation="false" OnClientClick="if (confirm('Are You Sure You Wish To Delete This record?'))return true; else return false;"
                                                                    CommandName="Delete" Text="Delete" ID="btnDelete"></asp:LinkButton>
                                                            </ItemTemplate>
                                                        </telerik:GridTemplateColumn>
                                                    </Columns>
                                                </MasterTableView>
                                                <ClientSettings>
                                                    <ClientEvents OnRowDblClick="RowDblClick" />
                                                </ClientSettings>
                                            </telerik:RadGrid>
Shinu
Top achievements
Rank 2
 answered on 13 Jan 2011
1 answer
46 views
I'm wondering what the simplest way is to implement ajax (so my screen never flashes when i do a postback from a control, etc.).  I've tried the proxy controls, on the content page with Ajax manager on Master page, but still refreshes the entire screen.  It's probably something simple I'm missing, but, is there a good example to follow?

Thanks.
Pavlina
Telerik team
 answered on 13 Jan 2011
0 answers
78 views
Hello All,

Tab setting is not working on my page, I have used RadAsyncUpload control and I have also set tab order on each control.
Below is my html structure:

<tr>
<td>
     <telerik:RadAsyncUpload runat="server" ID="rupUploadBanner" TabIndex="9" ReadOnlyFileInputs="true"
           Style="display: inline;" Width="98%" MaxFileInputsCount="1" OverwriteExistingFiles="true" AllowedFileExtensions="jpg,jpeg,png,gif">
     </telerik:RadAsyncUpload>
</td>
</tr>

<tr>
<td>
 <telerik:RadAsyncUpload runat="server" ID="rauUploadCompanyLogo" TabIndex="8" ReadOnlyFileInputs="true"
      Style="display: inline;" Width="98%" MaxFileInputsCount="1" OverwriteExistingFiles="true"  AllowedFileExtensions="jpg,jpeg,png,gif">
 </telerik:RadAsyncUpload>
</td>
</tr>

Please have a look on the attachment and suggest me some solution.


Thanks
Mukesh



Thanks
Mukesh
Mukesh
Top achievements
Rank 1
 asked on 13 Jan 2011
2 answers
322 views
I have a RadGrid that is bound at runtime to a Stored Procedure that returns a dynamic set of columns, the SP is a pivot of money and dates.  So the SP always returns Column 1 and Column 2 that are always the same name but then the other columns are dynamic depending on what dates and costs have been entered by the users i.e. the SP could return Column 1 and Column 2 plus 1 additional Column (which will be named the month and Year selected e.g. Jul 2011 or it could return 10 additional columns Spanning Jul 2011 to April 2012 and so on.  These addtitional columns return a decimal value, my question is how can i format these additional columns (that will change each time data is added) as DataFormatString="{0:£###,##}" if i dont have a grid bound column.

My Grid is simply
<telerik:RadGrid ID="GridMonies" runat="server">
</telerik:RadGrid>

Which is bound at runtime using
GridMonies.DataSource = WSA.PaymentDrawdownView(WSARecord)
GridMonies.DataBind()

Thanks in advance

Tony
Anthony
Top achievements
Rank 1
 answered on 13 Jan 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?