hi friends
iam using three text box and two combobox to submit the values in grid.
on clicking the row in the grid the data will transfer to the respective controls, like name value transfer to the txtname and so on.
iam using client side code:-
var name = document.getElementById("rtxtname");
name.innerText = args.get_gridDataItem().get_cell("name").innerText
this is working for textbox controls.
but my problem is, i problem is to pass grid values to the combo box. this coding is not working for combo box.
any one can solve my problem.
what changes to do for combo box.
thanks in advance
S.Rajkumar
iam using three text box and two combobox to submit the values in grid.
on clicking the row in the grid the data will transfer to the respective controls, like name value transfer to the txtname and so on.
iam using client side code:-
var name = document.getElementById("rtxtname");
name.innerText = args.get_gridDataItem().get_cell("name").innerText
this is working for textbox controls.
but my problem is, i problem is to pass grid values to the combo box. this coding is not working for combo box.
any one can solve my problem.
what changes to do for combo box.
thanks in advance
S.Rajkumar
8 Answers, 1 is accepted
0
Shinu
Top achievements
Rank 2
answered on 09 Feb 2012, 07:49 AM
Hello Raj,
You can use findControl method to access the RadComboBox. Also check the following help documentation.
findControl.
-Shinu.
You can use findControl method to access the RadComboBox. Also check the following help documentation.
findControl.
-Shinu.
0
Hi Raj,
As Shinu has pointed out you need to work with the client-side component of the telerik controls and not with the html elements. You get hold of the client-side component for a given control by using the $find directive and the ClientID of the control. For example, if your combo box has an ID of RadComboBox1 then you can get its client-side component as follows: $find('<%=RadComboBox1.ClientID%>'). Once, you have that you will get access to a very rich API that will help you achieve most of your requirements. In the case of the combo box, after you extract the values required from the grid row, you can transfer those into the combo using the API as described in the following help article:
http://www.telerik.com/help/aspnet-ajax/combobox-client-side-radcomboboxitemcollection.html
Hope it helps.
All the best, Tsvetoslav
the Telerik team
As Shinu has pointed out you need to work with the client-side component of the telerik controls and not with the html elements. You get hold of the client-side component for a given control by using the $find directive and the ClientID of the control. For example, if your combo box has an ID of RadComboBox1 then you can get its client-side component as follows: $find('<%=RadComboBox1.ClientID%>'). Once, you have that you will get access to a very rich API that will help you achieve most of your requirements. In the case of the combo box, after you extract the values required from the grid row, you can transfer those into the combo using the API as described in the following help article:
http://www.telerik.com/help/aspnet-ajax/combobox-client-side-radcomboboxitemcollection.html
Hope it helps.
All the best, Tsvetoslav
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Raj
Top achievements
Rank 1
answered on 09 Feb 2012, 11:06 AM
its not working
0
Hello Raj,
Could you paste your aspx and code-behind - please, use the CODE FORMATTER tool of the ticket editor.
All the best, Tsvetoslav
the Telerik team
Could you paste your aspx and code-behind - please, use the CODE FORMATTER tool of the ticket editor.
All the best, Tsvetoslav
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Raj
Top achievements
Rank 1
answered on 09 Feb 2012, 01:19 PM
function
rginteresttypegroup_OnRowClick(sender, args) {
//method 1
var
currecnycode = args.get_item().findControl(
"rcmbcurrencycode"
);
currecnycodeset_value(args.get_dataItem()[
"currecnycode"
]);
//method 2
var
currecnycode = $find(
'<%=rcmbcurrencycode.ClientID%>'
)
val = currecnycode.options[currecnycode.selectedIndex].value;
//method 3
var
combo = $find(
"<%= rcmbcurrencycode.ClientID %>"
);
var
items = combo.get_items();
}
i tried above three method, but the values is not selected in the combo box
0
Hello Raj,
I need your complete code - the code snippets below are not helpful.
Regards, Tsvetoslav
the Telerik team
I need your complete code - the code snippets below are not helpful.
Regards, Tsvetoslav
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Raj
Top achievements
Rank 1
answered on 10 Feb 2012, 06:15 AM
<script type=
"text/javascript"
id=
"telerikClientEvents1"
>
//<![CDATA[
function
rginteresttypegroup_OnRowClick(sender, args) {
var
interesttype = document.getElementById(
"rtxtinteresttype"
);
interesttype.innerText = args.get_gridDataItem().get_cell(
"interesttype"
).innerText
var
combo = $find(
"<%= rcmbcurrencycode.ClientID %>"
);
var
items = combo.get_items();
var
interestperiod = document.getElementById(
"rtxtinterestperiod"
);
interestperiod.innerText = args.get_gridDataItem().get_cell(
"interestperiod"
).innerText
var
displayorder = document.getElementById(
"rtxtdisplayorder"
);
displayorder.innerText = args.get_gridDataItem().get_cell(
"displayorder"
).innerText
var
interesttype_remarks = document.getElementById(
"rtxainteresttypedescription"
);
interesttype_remarks.innerText = args.get_gridDataItem().get_cell(
"interesttype_remarks"
).innerText
}
//]]>
</script>
<script language=
"javascript"
>
function
validate() {
if
(document.getElementById(
"<%=rtxtinteresttype.ClientID%>"
).value ==
""
) {
alert(
"Interest Type can not be blank"
);
return
false
;
}
if
(document.getElementById(
"<%=rcmbcurrencycode.ClientID%>"
).value ==
"Select"
) {
alert(
"Currency Code can not be blank"
);
return
false
;
}
if
(document.getElementById(
"<%=rtxtinterestperiod.ClientID%>"
).value ==
""
) {
alert(
"Interest Period can not be blank"
);
if
(isNaN(document.frmTxn.rtxtinterestperiod.value))
return
false
;
}
if
(document.getElementById(
"<%=rtxtdisplayorder.ClientID%>"
).value ==
""
) {
alert(
"Display Order can not be blank"
);
return
false
;
}
if
(document.getElementById(
"<%=rcmbinteresttypestatus.ClientID%>"
).value ==
"Select"
) {
alert(
"Interest Type Status can not be blank"
);
return
false
;
}
}
</script>
<div
class
=
"Header"
>
<img
class
=
"Header_Image"
src=
"Images/sg.png"
style=
"height: 17px; width: 17px; vertical-align: middle"
/>
<font style="font-family:
'Segoe UI'
; font-size: medium; font-weight: bold; color: #FFFFFF;
vertical-align: middle">Interest Type Details</font>
</div>
<ul
class
=
"Main_Container"
>
<fieldset style=
"min-width: 800px"
>
<legend
class
=
"A_legend"
>Enter Interest Type </legend>
<li>
<ul id=
"ul19"
class
=
"Container"
>
<li>
<telerik:RadTextBox ID=
"rtxtinteresttype"
runat=
"server"
Label=
"Interest Type *"
LabelCssClass=
"TextBoxLabel"
Skin=
"Office2010Black"
/>
</li>
<li>
<telerik:RadComboBox ID=
"rcmbcurrencycode"
runat=
"server"
LabelCssClass=
"TextBoxLabel"
CssClass=
"A_Comobox"
Label=
"Currency Code *"
Skin=
"Office2010Black"
DropDownWidth=
"150px"
NoWrap=
"True"
>
<Items>
<telerik:RadComboBoxItem runat=
"server"
Text=
"Select"
Value=
"Select"
Selected=
"True"
/>
<telerik:RadComboBoxItem runat=
"server"
Text=
"JPY"
Value=
"JPY"
/>
<telerik:RadComboBoxItem runat=
"server"
Text=
"USA"
Value=
"USA"
/>
<telerik:RadComboBoxItem runat=
"server"
Text=
"UAE"
Value=
"UAE"
/>
<telerik:RadComboBoxItem runat=
"server"
Text=
"IND"
Value=
"IND"
/>
</Items>
</telerik:RadComboBox>
</li>
<li>
<telerik:RadTextBox ID=
"rtxtinterestperiod"
runat=
"server"
Label=
"Intersest Period *"
LabelCssClass=
"TextBoxLabel"
Skin=
"Office2010Black"
/>
</li>
<li>
<telerik:RadTextBox ID=
"rtxtdisplayorder"
runat=
"server"
Label=
"Display Order *"
LabelCssClass=
"TextBoxLabel"
Skin=
"Office2010Black"
/>
</li>
<li>
<telerik:RadComboBox ID=
"rcmbinteresttypestatus"
runat=
"server"
LabelCssClass=
"TextBoxLabel"
CssClass=
"A_Comobox"
Label=
"Status *"
Skin=
"Office2010Black"
DropDownWidth=
"150px"
NoWrap=
"True"
>
<Items>
<telerik:RadComboBoxItem runat=
"server"
Text=
"Select"
Value=
"Select"
Selected=
"True"
/>
<telerik:RadComboBoxItem runat=
"server"
Text=
"Active"
Value=
"Active"
/>
<telerik:RadComboBoxItem runat=
"server"
Text=
"Inactive"
Value=
"Inactive"
/>
</Items>
</telerik:RadComboBox>
<telerik:RadTextBox ID=
"rtxtinteresttypeid"
runat=
"server"
Label=
"Interest Type ID"
LabelCssClass=
"TextBoxLabel"
Skin=
"Office2010Black"
Visible=
"false"
ReadOnly=
"True"
/>
</li>
<li id=
"A_Textarea"
class
=
"A_Textarea"
>
<telerik:RadTextBox ID=
"rtxainteresttypedescription"
runat=
"server"
Label=
"Description"
Skin=
"Office2010Black"
LabelCssClass=
"TextBox_Label12"
TextMode=
"MultiLine"
CssClass=
"Texboxheight"
/>
</li>
</ul>
</li>
</fieldset>
<li>
<fieldset style=
"min-width: 800px"
>
<legend
class
=
"A_legend"
></legend>
<ul id=
"Ul3"
class
=
"Master_Button_Container"
>
<li>
<asp:Button ID=
"cmdsubmit"
CssClass=
"A_Button"
runat=
"server"
Text=
"Submit"
AccessKey=
"s"
OnClientClick=
" return validate()"
OnClick=
"cmdsubmit_click"
/>
<asp:Button ID=
"cmdclear"
CssClass=
"A_Button"
runat=
"server"
Text=
"Clear"
AccessKey=
"c"
/>
<asp:Label ID=
"lblinteresttypeid"
runat=
"server"
Visible=
"False"
></asp:Label>
</li>
</ul>
</fieldset>
</li>
<div style=
"width: 100%; min-width: 800px; overflow: auto;"
>
<fieldset style=
"min-width: 800px"
>
<legend
class
=
"A_legend"
>Interest Type Details</legend>
<li
class
=
"Grid_Master_li"
>
<li style=
"overflow: auto;"
>
<telerik:RadGrid runat=
"server"
ID=
"rginteresttypegroup"
AllowPaging=
"True"
AllowSorting=
"True"
AllowFilteringByColumn=
"True"
CellSpacing=
"2"
GridLines=
"None"
CssClass=
"Grid_Master"
OnSelectedIndexChanged=
"rginteresttypegroup_SelectedIndexChanged"
Skin=
"Office2010Black"
ClientSettings-EnablePostBackOnRowClick=
"True"
>
<MasterTableView>
<EditFormSettings>
<EditColumn FilterControlAltText=
"Filter EditCommandColumn column"
>
</EditColumn>
</EditFormSettings>
<PagerStyle Mode=
"NextPrevAndNumeric"
AlwaysVisible=
"True"
EnableSEOPaging=
"True"
/>
<CommandItemSettings ExportToPdfText=
"Export to PDF"
></CommandItemSettings>
<RowIndicatorColumn Visible=
"True"
FilterControlAltText=
"Filter RowIndicator column"
>
</RowIndicatorColumn>
<ExpandCollapseColumn Visible=
"True"
FilterControlAltText=
"Filter ExpandColumn column"
>
</ExpandCollapseColumn>
<Columns>
<telerik:GridBoundColumn UniqueName=
"interesttypeid"
DataField=
"interesttypeid"
HeaderText=
"Interest Type ID"
DataType=
"System.String"
Visible=
"false"
>
</telerik:GridBoundColumn>
<telerik:GridBoundColumn UniqueName=
"interesttype"
DataField=
"interesttype"
HeaderText=
"Interest Type"
DataType=
"System.String"
>
</telerik:GridBoundColumn>
<telerik:GridBoundColumn UniqueName=
"currecnycode"
DataField=
"currencycode"
HeaderText=
"Currency Code"
DataType=
"System.String"
>
</telerik:GridBoundColumn>
<telerik:GridBoundColumn UniqueName=
"interestperiod"
DataField=
"interestperiod"
HeaderText=
"Intersest Period"
DataType=
"System.Int32"
>
</telerik:GridBoundColumn>
<telerik:GridBoundColumn UniqueName=
"interesttype_status"
DataField=
"interesttype_status"
HeaderText=
"Interest Type Status"
DataType=
"System.String"
>
</telerik:GridBoundColumn>
<telerik:GridBoundColumn UniqueName=
"displayorder"
DataField=
"displayorder"
HeaderText=
"Display Order"
DataType=
"System.Int32"
>
</telerik:GridBoundColumn>
<telerik:GridBoundColumn UniqueName=
"interesttype_remarks"
DataField=
"interesttype_remarks"
HeaderText=
"Interest Type Description"
DataType=
"System.String"
>
</telerik:GridBoundColumn>
</Columns>
<PagerStyle Mode=
"NumericPages"
/>
</MasterTableView>
<ClientSettings EnableRowHoverStyle=
"True"
EnablePostBackOnRowClick=
"True"
AllowColumnsReorder=
"True"
ReorderColumnsOnClient=
"True"
>
<DataBinding SelectMethod=
"GetDataAndCount"
Location=
"GridWcfService.svc"
SortParameterType=
"Linq"
FilterParameterType=
"Linq"
>
</DataBinding>
<Selecting AllowRowSelect=
"True"
/>
<%-- <ClientEvents OnRowClick=
"rginteresttypegroup_OnRowClick"
/>--%>
<ClientEvents />
</ClientSettings>
<HeaderStyle HorizontalAlign=
"Center"
ForeColor=
"White"
/>
<FilterItemStyle HorizontalAlign=
"Center"
/>
<PagerStyle EnableSEOPaging=
"True"
AlwaysVisible=
"True"
Mode=
"NumericPages"
/>
<FilterMenu EnableImageSprites=
"False"
>
</FilterMenu>
</telerik:RadGrid>
</li>
</fieldset>
</div>
</li>
</ul>
0
Hi Raj,
Tsvetoslav
the Telerik team
Attached is a small sample that demonstrates the correct approach to your implementation requirement.
Hope it helps.
Tsvetoslav
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>