Hi All,
I am working on this task for past 2 days and could not solve this problem. I have a radgrid with a column of linkbutons inside it. when a user clicks on any link button, I pop up a javascript message based on some conditions.
inside the function confirm_select, I have to make one row bold, the row that user clicked on and make the previous bolded row as normal/unbolded.
To achieve this, I am looping though the radgrid and unbolding all the rows and bolding the currenlty selected row if the user presses ok, but if the user pressed cancel, I would leave the previous row as bolded. below is my code
I am getting an error right here
I would not have done the get get_masterTableView(), but I could not loop thorugh the gridview rows to make them bolded or unbolded. Below is the code for my gridview.
I also tried
but above line of code didn't work either.
I don't have anything else defined. this gridview is inside the radPanelbar so the whole gridview is enclosed in this
i am not sure what am I doing wrong, but I spend lot of hours on it and this is not working.
Any help will be highly appreciated.
I am working on this task for past 2 days and could not solve this problem. I have a radgrid with a column of linkbutons inside it. when a user clicks on any link button, I pop up a javascript message based on some conditions.
ScriptManager.RegisterStartupScript(Page, this.GetType(), "message", string.Format("confirm_select('{0}','{1}');", RadGrid_IDPicker.ClientID,row.RowIndex + 1), true);
inside the function confirm_select, I have to make one row bold, the row that user clicked on and make the previous bolded row as normal/unbolded.
To achieve this, I am looping though the radgrid and unbolding all the rows and bolding the currenlty selected row if the user presses ok, but if the user pressed cancel, I would leave the previous row as bolded. below is my code
<
script
type
=
"text/javascript"
>
var selectedRowIndex = -1;
function confirm_select(gridViewID, rowIndex) {
debugger;
var gridview = document.getElementById(gridViewID);
var master = gridViewID.get_masterTableView();
if (confirm("You are leaving the parent level of the currently selected ID, are you sure?") == true) {
for (var i = 1; i <
gridview.rows.length
; i++) {
//not the selected row
if (i != rowIndex)
gridview.rows[i]
.style.fontWeight
=
'normal'
;
//selected row
else {
gridview.rows[i]
.style.fontWeight
=
'bold'
;
selectedRowIndex
=
rowIndex
;
}
}
}
else {
if (selectedRowIndex != -1)
gridview.rows[selectedRowIndex]
.style.fontWeight
=
'bold'
;
}
}
</script>
I am getting an error right here
var master = gridViewID.get_masterTableView();
I would not have done the get get_masterTableView(), but I could not loop thorugh the gridview rows to make them bolded or unbolded. Below is the code for my gridview.
I also tried
var master = gridview.get_masterTableView();
<
telerik:RadGrid
ID
=
"RadGrid_IDPicker"
AllowSorting
=
"True"
PageSize
=
"100"
AllowPaging
=
"True"
runat
=
"server"
GridLines
=
"None"
OnPageIndexChanged
=
"RadGrid_IDPicker_PageIndexChanged"
OnPageSizeChanged
=
"RadGrid_IDPicker_PageSizeChanged"
Width
=
"1500px"
Visible
=
"false"
OnItemDataBound
=
"RadGrid_IDPicker_DataBound"
>
<
MasterTableView
RetrieveAllDataFields
=
"true"
AutoGenerateColumns
=
"false"
DataKeyNames
=
"ID"
>
<
Columns
>
<
telerik:GridTemplateColumn
UniqueName
=
"TemplateLinkColumn"
AllowFiltering
=
"false"
HeaderText
=
"ID"
>
<
ItemTemplate
>
<
asp:LinkButton
ID
=
"ID_Link"
runat
=
"server"
OnClick
=
"MCLID_Link_Click"
Text='<%#Bind("ID") %>' CommandName="Bold"></
asp:LinkButton
>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridTemplateColumn
HeaderText
=
"TAG"
>
<
ItemTemplate
>
<
asp:Label
ID
=
"lbltag"
runat
=
"server"
Text='<%#Bind("TAG") %>'></
asp:Label
>
</
ItemTemplate
>
</
Columns
>
</
MasterTableView
>
<
PagerStyle
Mode
=
"NextPrevAndNumeric"
/>
</
telerik:RadGrid
>
I don't have anything else defined. this gridview is inside the radPanelbar so the whole gridview is enclosed in this
<
telerik:RadPanelBar
ID
=
"RadPanelBar1"
runat
=
"server"
Width
=
"1500px"
BackColor
=
"#E6E6E6"
ExpandMode
=
"MultipleExpandedItems"
>
<
Items
>
<
telerik:RadPanelItem
runat
=
"server"
Text
=
"ID Picker"
Expanded
=
"true"
>
<
Items
>
<
telerik:RadPanelItem
Text
=
""
Expanded
=
"true"
>
<
ItemTemplate
>
//radgrid is right here
i am not sure what am I doing wrong, but I spend lot of hours on it and this is not working.
Any help will be highly appreciated.