Hi,
I have a radgrid and it has 2 column. last coumn is template column which has radrating control. I can use and rate when i open first time to the grid. Then I change to page and on second page I can't rate my rate control. And I is not showing selecting animation.
I attached my source codes and screen shots. Please let me know how can I fix it. This project publised and this bug waiting for fix :(
ps: I check javascript errors on google chorme, Problem is not javascript. I saw no error in javascript.
Thanks..
I have a radgrid and it has 2 column. last coumn is template column which has radrating control. I can use and rate when i open first time to the grid. Then I change to page and on second page I can't rate my rate control. And I is not showing selecting animation.
I attached my source codes and screen shots. Please let me know how can I fix it. This project publised and this bug waiting for fix :(
ps: I check javascript errors on google chorme, Problem is not javascript. I saw no error in javascript.
Thanks..
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="InsertKeywordAndWeight.ascx.cs" Inherits="Sections_TaskManagement_InsertKeywordAndWeight" %>
<
telerik:RadAjaxManager
ID
=
"RadAjaxManager2"
runat
=
"server"
>
<
AjaxSettings
>
<
telerik:AjaxSetting
AjaxControlID
=
"btnAdd"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"RadGridKeyword"
/>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
<
telerik:AjaxSetting
AjaxControlID
=
"RadGridKeyword"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"RadGridKeyword"
LoadingPanelID
=
"RadAjaxLoadingPanel1"
/>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
</
AjaxSettings
>
</
telerik:RadAjaxManager
>
<
telerik:RadAjaxLoadingPanel
runat
=
"server"
ID
=
"RadAjaxLoadingPanel1"
Skin
=
"Hay"
/>
<
div
style
=
"width:500px; padding:5px;"
>
<
div
style
=
"width:490px; margin-top:25px; padding:2px; float:left; display:block;"
>
<
asp:Label
ID
=
"lblKeywordDesc"
Text
=
"Eklemek İstediğiniz Anahtar Kelimeyi Giriniz:"
runat
=
"server"
></
asp:Label
>
</
div
>
<
div
style
=
"width:490px; margin-bottom:5px; padding:2px; float:left; display:block;"
>
<
asp:TextBox
runat
=
"server"
ID
=
"txtNewKeyWord"
Width
=
"90%"
style
=
"float:left;"
></
asp:TextBox
><
br
/>
<
telerik:RadRating
ID
=
"RadRating1"
runat
=
"server"
Value
=
'4'
Precision
=
"Exact"
style
=
"float:left;"
/><
asp:ImageButton
style
=
"float:left; margin:5px; padding:0 5px 0 0;"
runat
=
"server"
ID
=
"btnAdd"
OnClick
=
"btnAdd_Click"
ImageUrl
=
"~/images/add2.png"
/>
</
div
>
<
div
style
=
"width:490px; padding:2px; margin-top:5px; float:left; display:block;"
>
<
telerik:RadGrid
ID
=
"RadGridKeyword"
runat
=
"server"
OnNeedDataSource
=
"RadGrid1_NeedDataSource"
ViewStateMode
=
"Enabled"
PageSize
=
"5"
AllowPaging
=
"true"
AllowAutomaticDeletes
=
"True"
AllowAutomaticInserts
=
"True"
AllowAutomaticUpdates
=
"True"
AllowSorting
=
"true"
AutoGenerateColumns
=
"false"
AllowFilteringByColumn
=
"true"
OnItemCommand
=
"RadGridKeyword_ItemCommand"
>
<
MasterTableView
TableLayout
=
"Auto"
>
<
Columns
>
<
telerik:GridBoundColumn
DataField
=
"IntCode"
UniqueName
=
"IntCode"
Visible
=
"false"
/>
<
telerik:GridBoundColumn
HeaderText
=
"Anahtar Kelime"
DataField
=
"Keyword"
UniqueName
=
"AddKeyword"
AllowSorting
=
"true"
SortExpression
=
"AddKeyword"
HeaderStyle-Width
=
"40%"
FilterControlWidth
=
"100%"
ItemStyle-Width
=
"40%"
AutoPostBackOnFilter
=
"true"
CurrentFilterFunction
=
"Contains"
ShowFilterIcon
=
"false"
/>
<
telerik:GridBoundColumn
HeaderText
=
"İçerik Adı"
AllowFiltering
=
"false"
ShowFilterIcon
=
"false"
AutoPostBackOnFilter
=
"true"
AllowSorting
=
"true"
DataField
=
"AddressOfKeyWordFieldName"
UniqueName
=
"AddressOfKeyWordFieldName"
SortExpression
=
"AddressOfKeyWordFieldName"
HeaderStyle-Width
=
"10%"
FilterControlWidth
=
"10%"
ItemStyle-Width
=
"10%"
/>
<
telerik:GridTemplateColumn
HeaderText
=
"Derece"
ShowFilterIcon
=
"false"
AllowFiltering
=
"false"
HeaderStyle-Width
=
"20%"
FilterControlWidth
=
"20%"
ItemStyle-Width
=
"20%"
>
<
ItemTemplate
>
<
telerik:RadRating
ID
=
"RadRating1"
runat
=
"server"
AutoPostBack
=
"true"
OnRate
=
"RadRating1_Rate"
Value='<%# (Getron.Core.Tools.DataTableFieldOperation.ToDecimal(Eval("KeyWordWeight").ToString(),0)/20) %>' Precision="Exact" />
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridTemplateColumn
UniqueName
=
"DeleteButton"
HeaderText
=
"Sil"
ShowFilterIcon
=
"false"
Groupable
=
"False"
AllowFiltering
=
"false"
Resizable
=
"False"
HeaderStyle-Width
=
"5%"
FilterControlWidth
=
"5%"
ItemStyle-Width
=
"5%"
>
<
ItemTemplate
>
<
asp:HiddenField
runat
=
"server"
ID
=
"hdnIntCode"
Value='<%# Eval("Intcode").ToString() %>' />
<
asp:ImageButton
style
=
"float:left; margin:5px; padding:2px 5px 6px 0;"
runat
=
"server"
ID
=
"btnDeleteKeyword"
CommandName
=
"Delete"
CommandArgument='<%# Eval("IntCode").ToString() %>' ImageUrl="~/images/delete2.png" />
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
</
Columns
>
</
MasterTableView
>
</
telerik:RadGrid
>
</
div
>
</
div
>
public
partial
class
Sections_TaskManagement_InsertKeywordAndWeight : EntityProtectedUserControl
{
protected
void
Page_Load(
object
sender, EventArgs e)
{
}
protected
void
RadGrid1_NeedDataSource(
object
sender, GridNeedDataSourceEventArgs e)
{
KeywordRelation kRel =
new
KeywordRelation();
QueryEntity qEntity =
new
QueryEntity();
qEntity.Query =
string
.Format(
"ReferancedTable = {0} AND ReferancedKey = {1}"
,
"30002"
, Request.QueryString[
"ActiveRecordIntCode"
].ToString());
KeywordDT = kRel.GetTableActive(qEntity);
RadGridKeyword.DataSource = KeywordDT;
}
protected
void
btnAdd_Click(
object
sender, EventArgs e)
{
Keyword keyword =
new
Keyword();
KeywordRelation rel =
new
KeywordRelation();
keyword.DbSession.BeginTransaction();
rel.DbSession.BeginTransaction();
try
{
long
keyWordIntCode = 0;
QueryEntity qentity =
new
QueryEntity();
qentity.Query =
string
.Format(
"Keyword = '{0}'"
, txtNewKeyWord.Text);
DataTable dtKeyword = keyword.GetTableActive(
new
List<
string
>() {
"IntCode"
,
"Keyword"
}, qentity);
if
(dtKeyword.Rows.Count > 0)
keyWordIntCode = Getron.Core.Tools.DataTableFieldOperation.ToInt64(dtKeyword.Rows[0][
"Intcode"
].ToString(), 0);
else
{
keyword.Keywords = txtNewKeyWord.Text;
keyword.WithMakerChecker =
false
;
keyword.Save(
this
.Page.SystemUser.UserIntCode);
keyWordIntCode = keyword.ProcessingRowIntCode;
}
rel.KeyWordIntCode = keyWordIntCode;
rel.KeyWordWeight = Getron.Core.Tools.DataTableFieldOperation.ToInt32(((RadRating1.Value * 10) * 2), 60);
rel.AddressOfKeyWordNumCode = 46;
rel.ReferancedFieldNumCode = 1;
rel.ReferancedKey = Getron.Core.Tools.DataTableFieldOperation.ToInt64(Request.QueryString[
"ActiveRecordIntCode"
].ToString(), 0);
rel.WithMakerChecker =
false
;
rel.Save(
this
.Page.SystemUser.UserIntCode);
keyword.DbSession.Commit();
rel.DbSession.Commit();
RadAjaxManager2.Alert(
"Anahtar Başarıyla Eklendi."
);
}
catch
(Exception ex)
{
try
{
keyword.DbSession.Rollback();
rel.DbSession.Rollback();
}
catch
{
}
RadAjaxManager2.Alert(
"Anahtar Eklenirken Hata Oluştu."
);
}
}
protected
void
RadGridKeyword_ItemCommand(
object
sender, GridCommandEventArgs e)
{
try
{
if
(e.Item.ItemType == GridItemType.Item || e.Item.ItemType == GridItemType.AlternatingItem)
{
if
(e.CommandName ==
"Delete"
)
{
ImageButton img = (ImageButton)e.Item.FindControl(
"btnDeleteKeyword"
);
if
(img !=
null
)
{
HiddenField hdnIntCode = (HiddenField)e.Item.FindControl(
"hdnIntCode"
);
if
(hdnIntCode !=
null
)
{
KeywordRelation kr =
new
KeywordRelation(Getron.Core.Tools.DataTableFieldOperation.ToInt64(hdnIntCode.Value, 0));
kr.WithMakerChecker =
false
;
kr.Delete(
this
.Page.SystemUser.UserIntCode);
RadGridKeyword.Rebind();
RadAjaxManager2.Alert(
"Silindi."
);
}
}
}
else
{
RadRating rate = (RadRating)e.Item.FindControl(
"RadRating1"
);
}
}
}
catch
(Exception ex)
{
RadAjaxManager2.Alert(
"Silinirken Hata Alındı."
);
}
}
protected
void
RadRating1_Rate(
object
sender, EventArgs e)
{
RadRating oRating = (RadRating)sender;
GridDataItem dataItem = (GridDataItem)oRating.Parent.Parent;
try
{
object
currentAverageRating = KeywordDT.Rows[dataItem.ItemIndex + RadGridKeyword.CurrentPageIndex * RadGridKeyword.PageSize][
"IntCode"
];
decimal
currentRating = Convert.ToDecimal(currentAverageRating, NumberFormatInfo.InvariantInfo);
KeywordRelation kr =
new
KeywordRelation(Getron.Core.Tools.DataTableFieldOperation.ToInt64(currentAverageRating, 0));
kr.KeyWordWeight = Getron.Core.Tools.DataTableFieldOperation.ToInt32(Decimal.Round((oRating.Value * 10) * 2, 0), kr.KeyWordWeight);
kr.WithMakerChecker =
false
;
kr.Save(
this
.Page.SystemUser.UserIntCode);
RadGridKeyword.Rebind();
}
catch
(Exception ex)
{
RadGridKeyword.Controls.Add(
new
LiteralControl(
"Unable to update Ratings. Reason: "
+ ex.Message));
}
}
[SessionStatePropertyAttribute]
public
DataTable KeywordDT {
get
;
set
; }
}