This is a migrated thread and some comments may be shown as answers.

Set values dynamically

3 Answers 92 Views
Grid
This is a migrated thread and some comments may be shown as answers.
July
Top achievements
Rank 2
July asked on 27 Jul 2012, 06:19 PM
I need copy onkesspress event of txtName the value on txtHumanLabel when user update or insert.


I did this, but does not work

  var txtEditId = $telerik.$(masterTable.get_element()).find('input[id*="txtEId"]')[0];   --IS UPDATE??

                if (txtEditId == undefined) {
                    var txtHeader = $telerik.$(masterTable.get_element()).find('input[id*="txtHeader"]')[0];  -- IS INSERT
                    txtHeader.value = Name.value;
                   
                } else {

                    var txtHeader = $telerik.$(masterTable.get_element()).find('input[id*="txtHeader"]')[0];
                    var value = txtHeader.value;
                    if (value.length == 0) {
                        txtHeader.value = Name.value;
                    }
                }


regards

3 Answers, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 30 Jul 2012, 06:38 AM
Hello,

Please check below  link.

http://jayeshgoyani.blogspot.in/2012/07/access-another-control-which-was-in.html

Thanks,
Jayesh Goyani
0
July
Top achievements
Rank 2
answered on 31 Jul 2012, 12:46 PM
I change my asp:textbox my telerik textbox

    <telerik:RadTextBox ID="txtName" Width="120px" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Name") %>'
                             >
                              <ClientEvents OnValueChanged="OnChangeValue" />
                             </telerik:RadTextBox>

and
 function OnChangeValue(sender, args) {
               
                // Do not forget to add jquery in reference
                var SenderId = sender.get_element().id;
              
                //var SenderId =  sender.get_id();
                var RadTextBox1 = $("#" + SenderId).get(0);
                var RadTextBox2 = $("#" + SenderId.replace("txtName", "txtHeader")).get(0);
                alert(RadTextBox2.value);
               

            }

but does not work.
0
Jayesh Goyani
Top achievements
Rank 2
answered on 31 Jul 2012, 07:26 PM
hello,

function ValueChanged(sender, args) {
                //var SenderId = sender.get_element().id;
                var SenderId =  sender.get_id();
                var txtID = $("#" + SenderId).get(0);
                var txtName = $telerik.findTextBox(SenderId.replace("txtID", "txtName"));
                txtName.set_value(txtName.get_value() + "123")
            }

<MasterTableView DataKeyNames="ID,Name" ClientDataKeyNames="ID,Name" CommandItemDisplay="Top">
               <Columns>
                   <telerik:GridTemplateColumn HeaderText="ID">
                       <ItemTemplate>
                           <asp:Label ID="lblID" runat="server" Text='<%# Eval("ID") %>'></asp:Label>
                       </ItemTemplate>
                       <EditItemTemplate>
                           <telerik:RadTextBox ID="txtID" runat="server" Text='<%# Eval("ID") %>'>
                               <ClientEvents OnValueChanged="ValueChanged" />
                           </telerik:RadTextBox>
                       </EditItemTemplate>
                   </telerik:GridTemplateColumn>
                   <telerik:GridTemplateColumn HeaderText="Name">
                       <ItemTemplate>
                           <asp:Label ID="lblName" runat="server" Text='<%# Eval("Name") %>'></asp:Label>
                       </ItemTemplate>
                       <EditItemTemplate>
                           <telerik:RadTextBox ID="txtName" runat="server" Text='<%# Eval("Name") %>'>
                           </telerik:RadTextBox>
                       </EditItemTemplate>
                   </telerik:GridTemplateColumn>
                   <telerik:GridEditCommandColumn>
                   </telerik:GridEditCommandColumn>
               </Columns>
           </MasterTableView>


Thanks,
Jayesh Goyani
Tags
Grid
Asked by
July
Top achievements
Rank 2
Answers by
Jayesh Goyani
Top achievements
Rank 2
July
Top achievements
Rank 2
Share this question
or