Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
329 views

     Hi,I have a problem with RadDataForm and HiddenField. I have a scenario like this:

 

 <telerik:RadDataForm runat="server" ID="radDataForm" DataSourceID="myDataSource">

   <InsertItemTemplate>

        <asp:HiddenField ID="hiddenField" runat="server" Value='<%# Bind("MyProperty") %>' />

         <telerik:RadComboBox ID="myCombo" runat="server" SelectedValue='<%# Bind("MyProperty2") %>' />

   </InsertItemTemplate>

</telerik:RadDataForm>

I Just semplify my code. The problem is that radComboBox (as other telerik controls) works fine and i bind my object passed in data source, while the property bounded throught asp:HiddenField doesn't work, even the value is not null.

Any suggestions?

 

Thanks

 

 

Vessy
Telerik team
 answered on 01 Apr 2019
2 answers
35 views

I can get the oldValues, newValues, but i can not get JUST the changed values on server-side ItemUpdating event. Why is that? The data tier is waiting for an object with fields and values that need to be updated on a given primary key. I want to send 2 items in the hashtable, not 100 items of useless data to be updated, when i only have 1 item that needs to be updated in the database. Please tell me that you have this functionality? I tried to use the UpdateValues, but its always empty, but it seems different than SavedOldValues and ExtractValues. Why use "UpdateValues" if it doesnt do the same, confusing to say the least.

The help in the demos is not what we are doing. This is one record placed in edit-mode when the dataform loads. Again there should only be a few lines to send the hashtable to the data tier. 

 

            Dim editedItem As RadDataFormEditableItem = TryCast(e.DataFormItem, RadDataFormEditableItem)
            Dim oldValuesHT As Hashtable = editedItem.SavedOldValues()
            Dim newValuesHT As New Hashtable()
            Dim updatedValuesHT As New Hashtable()
            editedItem.ExtractValues(newValuesHT)
            editedItem.UpdateValues(updatedValuesHT)

 

Any help Telerik?

SDI
Top achievements
Rank 1
 answered on 08 Mar 2019
1 answer
70 views

hi

i want to create a webform for entering orders in raddataform as master table and order details in radgrid as detail table

please help me

Marin Bratanov
Telerik team
 answered on 25 Jan 2019
25 answers
535 views
How do you make a RadDataForm begin in edit mode on the initial get?
Kiran
Top achievements
Rank 1
 answered on 24 Jan 2019
0 answers
124 views
Does RadDataForm support validation? I want to add RequiredFieldValidator and do a server side validation.
I am using DataForm with SelectMethod/UpdateMethod (Model Binding) and ValidationSummary.
I start the form in Edit Mode.

When I click Update and the field is empty, update method does not get called. There are no errors displayed on the page though. I can see that NameCustomValidator_ServerValidate method is called and it sets IsValid to false.

If the field is not empty then update method is called and works as expected.

I am using version 2017.2.711.45

I was able to successfully use validation with RadGrid.

My code...

<asp:ValidationSummary ID="ValidationErrors" runat="server" />
 
<telerik:RadDataForm ID="DataForm" runat="server" SelectMethod="GetDetails" UpdateMethod="UpdateDetails"
            ItemType="MyData" DataKeyNames="ID"
            OnPreRender="DataForm_PreRender" ItemPlaceholderID="itemPlaceholder1">
    <LayoutTemplate>
        <div id="itemPlaceholder1" runat="server"></div>
    </LayoutTemplate>
    <ItemTemplate>Empty Read Only Page</ItemTemplate>
    <EditItemTemplate>
        <div>
            <telerik:RadButton ID="InsertButton1" runat="server" ButtonType="StandardButton" CommandName="Update" Text="Update" />
            <telerik:RadButton ID="CancelButton1" runat="server" ButtonType="StandardButton" CausesValidation="False" CommandName="Cancel" Text="Cancel Changes" />
        </div>
        <table>
            <tr>
                <td><telerik:RadLabel ID="NameLabel" runat="server" AssociatedControlID="NameTBox">Name:</telerik:RadLabel></td>
                <td>
                    <telerik:TextBox ID="NameTBox" runat="server" Text="<%# BindItem.Name %>"></telerik:TextBox>
                    <asp:RequiredFieldValidator ID="NameValidator" runat="server" ControlToValidate="NameTBox" ErrorMessage="Name is required" Text="!" Display="Static" />
                    <asp:CustomValidator ID="NameCustomValidator" runat="server" ControlToValidate="NameTBox" OnServerValidate="NameCustomValidator_ServerValidate" ErrorMessage="Name is required" Text="!" Display="Static" />
                </td>
            </tr>
        </table>
     </EditItemTemplate>
</telerik:RadDataForm>

 

Start DataForm in edit mode

protected void DataForm_PreRender(object sender, EventArgs e)
{
    // Display Edit mode when first loaded
    // Stay in Edit mode after update
    RadDataForm editForm = (RadDataForm) sender;
    if (editForm.Items.Count() > 0)
    {
        RadDataFormItem item = editForm.Items[0];
        item.FireCommandEvent("Edit", "");
    }
}

This does get called.

protected void NameCustomValidator_ServerValidate(object source, ServerValidateEventArgs args)
{
    args.IsValid = !string.IsNullOrEmpty(args.Value);
}

 

Thanks

Marius
Top achievements
Rank 1
 asked on 27 Sep 2017
5 answers
163 views

I would like to have a Checkboxlist inside the editItemTemplate of a dataform.   I want the checkboxlist to be populated from the sql database programmatically.

I am using VB. 

Here is my aspx code

<%@ Page Title="" Language="VB" MasterPageFile="~/Header.master" AutoEventWireup="false" CodeFile="EditProposal.aspx.vb" Inherits="StepI_EditProposal" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="Main" Runat="Server">
     
     <telerik:RadScriptManager runat="server" ID="rsm"></telerik:RadScriptManager>
   
  
    <telerik:RadDataForm ID="RadDataForm1" runat="server" CssClass="rdfLeftAligned rdfNoFieldHint"  OnItemEditing="loadcounty" DataKeyNames="authrepid,applicationid" DataSourceID="SqlDataSource1" >
        <LayoutTemplate>
            <div class="RadDataForm RadDataForm_<%# Container.Skin %> rdfLeftAligned rdfNoFieldHint">
                <div id="itemPlaceholder" runat="server">
                </div>
          
                   
                </div>
          
        </LayoutTemplate>
        <ItemTemplate>

                <div class="rdfRow">
                    <asp:Label ID="fiscalorgnameLabel2" runat="server" CssClass="rdfLabel" Text="Fiscal Organization:"></asp:Label>
                    <asp:Label ID="fiscalorgnameLabel1" runat="server" CssClass="rdfFieldValue" Text='<%# Eval("fiscalorgname") %>' />
                </div>
                <div class="rdfRow">
                    <asp:Label ID="behalfofLabel2" runat="server" CssClass="rdfLabel" Text="On Behalf of:"></asp:Label>
                    <asp:Label ID="behalfofLabel1" runat="server" CssClass="rdfFieldValue" Text='<%# Eval("behalfof") %>' />
                </div>
         
                <div class="rdfRow">
                    <asp:Label ID="authrepLabel2" runat="server" CssClass="rdfLabel" Text="Authorized Representative:"></asp:Label>
                    <asp:Label ID="authrepLabel1" runat="server" CssClass="rdfFieldValue" Text='<%# Eval("authrep") %>' />
                </div>
                <div class="rdfRow">
                    <asp:Label ID="addressLabel2" runat="server" CssClass="rdfLabel" Text="Address"></asp:Label>
                    <asp:Label ID="addressLabel1" runat="server" CssClass="rdfFieldValue" Text='<%# Eval("address") %>' />
              
                    <asp:Label ID="cityLabel1" runat="server" CssClass="rdfFieldValue" Text='<%# Eval("city") %>' />
               
                    <asp:Label ID="stateLabel1" runat="server" CssClass="rdfFieldValue" Text='<%# Eval("state") %>' />
             
                    <asp:Label ID="ZipCodeLabel1" runat="server" CssClass="rdfFieldValue" Text='<%# Eval("ZipCode") %>' />
                </div>
                <div class="rdfRow">
                    <asp:Label ID="telephoneLabel2" runat="server" CssClass="rdfLabel" Text="Telephone:"></asp:Label>
                    <asp:Label ID="telephoneLabel1" runat="server" CssClass="rdfFieldValue" Text='<%# Eval("telephone") %>' />
                </div>
                <div class="rdfRow">
                    <asp:Label ID="emailLabel2" runat="server" CssClass="rdfLabel" Text="Email:"></asp:Label>
                    <asp:Label ID="emailLabel1" runat="server" CssClass="rdfFieldValue" Text='<%# Eval("email") %>' />
                </div>
                <div class="rdfRow">
                    <asp:Label ID="ciFirstname" runat="server" Text="First Name:"></asp:Label>
                    <asp:Label ID="ciFirstName1" runat="server" text='<%# Eval("firstname1") %>'></asp:Label>
                </div>
                 <div class="rdfRow">
                    <asp:Label ID="ciAddress" runat="server" Text="Address:"></asp:Label>
                    <asp:Label ID="Label2" runat="server" text='<%# Eval("address1") %>'></asp:Label>
                       <asp:Label ID="Label1" runat="server" CssClass="rdfFieldValue" Text='<%# Eval("city1") %>' />
               
                    <asp:Label ID="Label3" runat="server" CssClass="rdfFieldValue" Text='<%# Eval("state1") %>' />
             
                    <asp:Label ID="Label4" runat="server" CssClass="rdfFieldValue" Text='<%# Eval("ZipCode1") %>' />
                </div>
                <div class="rdfRow">
                    <asp:Label ID="Label5" runat="server" CssClass="rdfLabel" Text="Telephone:"></asp:Label>
                    <asp:Label ID="Label6" runat="server" CssClass="rdfFieldValue" Text='<%# Eval("telephone1") %>' />
                </div>
                <div class="rdfRow">
                   
                 <asp:Label ID="lblRegion" runat="server" Text="Region:" CssClass="rdflabel"></asp:Label>
                      <asp:Label ID="txtRegion" runat="server" Text='<%# Eval("region") %>' CssClass="rdfFieldValue"></asp:Label>
                </div>
                 <div class="rdfRow">
                   
                 <asp:Label ID="lblCounty" runat="server" Text="County/Counties:" CssClass="rdflabel"></asp:Label>
                      <asp:datalist ID="dlCounty" runat="server" datasourceid="sqlCounty"  CssClass="rdfFieldValue">
                          <ItemTemplate>
                              <asp:label id="county" runat="server" text='<%# Eval("county") %>'></asp:label>
                          </ItemTemplate>
                      </asp:datalist>
                </div>
            <div class="rdfRow">
                <asp:Label ID="lblProposalSummary" runat="server" Text="Proposal Summary" CssClass="rdfLabel"></asp:Label>
                <asp:label ID="txtPropSummary" runat="server"   Text='<%# Eval("proposalsummary") %>'  BorderStyle="Solid" BorderWidth="1px" Width="80%"></asp:label>
            </div>
             <div class="rdfRow">
                <asp:Label ID="lblMatchFunds" runat="server" Text="Matching Funds Overview" CssClass="rdfLabel"></asp:Label>
                <asp:label ID="txtMatchFunds" runat="server"  Text='<%# Eval("matchingFundssummary") %>'  BorderStyle="Solid" BorderWidth="1px" Width="80%"></asp:label>
            </div>
                <div class="rdfCommandButtons">
                    <hr class="rdfHr" />
                 
                    <telerik:RadButton ID="EditButton" runat="server" ButtonType="SkinnedButton" CausesValidation="False" CommandName="Edit" RenderMode="Lightweight" Text="Edit" ToolTip="Edit" />
            </div>
        </ItemTemplate>
        <EditItemTemplate>
           
                <div class="rdfRow">
                    <asp:Label ID="fiscalorgnameLabel2" runat="server" AssociatedControlID="fiscalorgnameTextBox" CssClass="rdfLabel" Text="Fiscal Organization:"></asp:Label>
                    <telerik:RadTextBox ID="fiscalorgnameTextBox" runat="server" RenderMode="Lightweight" Text='<%# Bind("fiscalorgname") %>' WrapperCssClass="rdfInput" />
                </div>
                <div class="rdfRow">
                    <asp:Label ID="behalfofLabel2" runat="server" AssociatedControlID="behalfofTextBox" CssClass="rdfLabel" Text="On Behalf of:"></asp:Label>
                    <telerik:RadTextBox ID="behalfofTextBox" runat="server" RenderMode="Lightweight" Text='<%# Bind("behalfof") %>' WrapperCssClass="rdfInput" />
                </div>
            <div>
                Authorized Representative:
            </div>
                <div class="rdfRow">

                    <asp:Label ID="firstnameLabel2" runat="server" AssociatedControlID="firstnameTextBox" CssClass="rdfLabel" Text="First Name"></asp:Label>
                    <telerik:RadTextBox ID="firstnameTextBox" runat="server" RenderMode="Lightweight" Text='<%# Bind("firstname") %>' WrapperCssClass="rdfInput" />
                </div>
                <div class="rdfRow">
                    <asp:Label ID="lastnameLabel2" runat="server" AssociatedControlID="lastnameTextBox" CssClass="rdfLabel" Text="Last Name"></asp:Label>
                    <telerik:RadTextBox ID="lastnameTextBox" runat="server" RenderMode="Lightweight" Text='<%# Bind("lastname") %>' WrapperCssClass="rdfInput" />
                </div>
                
                   
                <div class="rdfRow">
                    <asp:Label ID="addressLabel2" runat="server" AssociatedControlID="addressTextBox" CssClass="rdfLabel" Text="Address:"></asp:Label>
                    <telerik:RadTextBox ID="addressTextBox" runat="server" RenderMode="Lightweight" Text='<%# Bind("address") %>' WrapperCssClass="rdfInput" />
                </div>
                <div class="rdfRow">
                    <asp:Label ID="cityLabel2" runat="server" AssociatedControlID="cityTextBox" CssClass="rdfLabel" Text="City:"></asp:Label>
                    <telerik:RadTextBox ID="cityTextBox" runat="server" RenderMode="Lightweight" Text='<%# Bind("city") %>' WrapperCssClass="rdfInput" />
                </div>
                <div class="rdfRow">
                    <asp:Label ID="stateLabel2" runat="server" AssociatedControlID="stateTextBox" CssClass="rdfLabel" Text="State:"></asp:Label>
                    <telerik:RadTextBox ID="stateTextBox" runat="server" RenderMode="Lightweight" Text='<%# Bind("state") %>' WrapperCssClass="rdfInput" />
                </div>
                <div class="rdfRow">
                    <asp:Label ID="ZipCodeLabel2" runat="server" AssociatedControlID="ZipCodeTextBox" CssClass="rdfLabel" Text="Zip Code"></asp:Label>
                    <telerik:RadTextBox ID="ZipCodeTextBox" runat="server" RenderMode="Lightweight" Text='<%# Bind("ZipCode") %>' WrapperCssClass="rdfInput" />
                </div>
                <div class="rdfRow">
                    <asp:Label ID="telephoneLabel2" runat="server" AssociatedControlID="telephoneTextBox" CssClass="rdfLabel" Text="Telephone"></asp:Label>
                    <telerik:RadTextBox ID="telephoneTextBox" runat="server" RenderMode="Lightweight" Text='<%# Bind("telephone") %>' WrapperCssClass="rdfInput" />
                </div>
                <div class="rdfRow">
                    <asp:Label ID="emailLabel2" runat="server" AssociatedControlID="emailTextBox" CssClass="rdfLabel" Text="Email Address"></asp:Label>
                    <telerik:RadTextBox ID="emailTextBox" runat="server" RenderMode="Lightweight" Text='<%# Bind("email") %>' WrapperCssClass="rdfInput" />
                </div>
                <div>Application Contact</div>
            <div>
                <asp:Label runat="server" ID="lblAppFirstName" Text="First Name" AssociatedControlID="contactFirstName"></asp:Label>
                <telerik:RadTextBox runat="server" ID="contactFirstName" Text='<%# Bind("firstname1") %>' WrapperCssClass="rdfInput"></telerik:RadTextBox>
            </div>
                      <div class="rdfRow">
                    <asp:Label ID="Label7" runat="server" AssociatedControlID="lastnameTextBox" CssClass="rdfLabel" Text="Last Name"></asp:Label>
                    <telerik:RadTextBox ID="RadTextBox1" runat="server" RenderMode="Lightweight" Text='<%# Bind("lastname1") %>' WrapperCssClass="rdfInput" />
                </div>
                
                   
                <div class="rdfRow">
                    <asp:Label ID="Label8" runat="server" AssociatedControlID="addressTextBox" CssClass="rdfLabel" Text="Address:"></asp:Label>
                    <telerik:RadTextBox ID="address1" runat="server" RenderMode="Lightweight" Text='<%# Bind("address1") %>' WrapperCssClass="rdfInput" />
                </div>
                <div class="rdfRow">
                    <asp:Label ID="Label9" runat="server" AssociatedControlID="cityTextBox" CssClass="rdfLabel" Text="City:"></asp:Label>
                    <telerik:RadTextBox ID="RadTextBox3" runat="server" RenderMode="Lightweight" Text='<%# Bind("city1") %>' WrapperCssClass="rdfInput" />
                </div>
                <div class="rdfRow">
                    <asp:Label ID="Label10" runat="server" AssociatedControlID="stateTextBox" CssClass="rdfLabel" Text="State:"></asp:Label>
                    <telerik:RadTextBox ID="RadTextBox4" runat="server" RenderMode="Lightweight" Text='<%# Bind("state1") %>' WrapperCssClass="rdfInput" />
                </div>
                <div class="rdfRow">
                    <asp:Label ID="Label11" runat="server" AssociatedControlID="ZipCodeTextBox" CssClass="rdfLabel" Text="Zip Code"></asp:Label>
                    <telerik:RadTextBox ID="RadTextBox5" runat="server" RenderMode="Lightweight" Text='<%# Bind("ZipCode1") %>' WrapperCssClass="rdfInput" />
                </div>
                <div class="rdfRow">
                    <asp:Label ID="Label12" runat="server" AssociatedControlID="telephoneTextBox" CssClass="rdfLabel" Text="Telephone"></asp:Label>
                    <telerik:RadTextBox ID="RadTextBox6" runat="server" RenderMode="Lightweight" Text='<%# Bind("telephone") %>' WrapperCssClass="rdfInput" />
                </div>
                <div class="rdfRow">
                    <asp:Label ID="Label13" runat="server" AssociatedControlID="emailTextBox" CssClass="rdfLabel" Text="Email Address"></asp:Label>
                    <telerik:RadTextBox ID="RadTextBox7" runat="server" RenderMode="Lightweight" Text='<%# Bind("email1") %>' WrapperCssClass="rdfInput" />
                </div>
                <div class="rdfRow">
                    <asp:Label ID="County" runat="server" Text="County:"></asp:Label>
                  
                    <telerik:RadCheckBoxList runat="server" ID="ckCounty" ></telerik:RadCheckBoxList>
                      
                    <asp:SqlDataSource runat="server" ID="sqlSelectCounty" ConnectionString='<%$ ConnectionStrings:COSI_GRANTS_TEST %>' SelectCommand="SELECT [County], [CountyID] FROM [County]"></asp:SqlDataSource>
                </div>
              
             
                <div class="rdfRow">
                    <asp:Label ID="PropLabel" runat="server" Text="Propsal Summary" ></asp:Label>
                    </div>
            <div class="rdfRow">
                <asp:TextBox ID="txtProposal" runat="server" Text='<%# Bind("proposalsummary") %>'></asp:TextBox>
                </div>
              <div class="rdfRow">
                    <asp:Label ID="Label14" runat="server" Text="Matching Funds Overview"></asp:Label>
                    </div>
              <div class="rdfRow">
                <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("matchingfundssummary") %>'></asp:TextBox>
                </div>
               <div class="rdfCommandButtons">
                    <hr class="rdfHr" />
                    <telerik:RadButton ID="UpdateButton" runat="server" ButtonType="SkinnedButton" CommandName="Update" RenderMode="Lightweight" Text="Update" ToolTip="Update" />
                    <telerik:RadButton ID="CancelButton" runat="server" ButtonType="SkinnedButton" CausesValidation="False" CommandName="Cancel" RenderMode="Lightweight" Text="Cancel" ToolTip="Cancel" />
                </div>
        </EditItemTemplate>
     
        <EmptyDataTemplate>
            <div class="RadDataForm RadDataForm_<%# Container.Skin %>">
                <div class="rdfEmpty">
                    There are no items to be displayed.</div>
            </div>
        </EmptyDataTemplate>
    </telerik:RadDataForm>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:COSI_GRANTS_TEST %>" SelectCommand="getApplicationsByAppId" SelectCommandType="StoredProcedure" UpdateCommand="update application set fiscalorgname = @fiscalorgname where applicationid=@appid; update [Authorized_Rep] set firstname=@firstname, lastname=@lastname, address=@address, city=@city, state=@state, zipcode=@zipcode, telephone=@telephone, email=@email where authrepid=@authrepid">
        <SelectParameters>
            <asp:QueryStringParameter Name="appid" QueryStringField="appid" Type="Int32" />
        </SelectParameters>
        <UpdateParameters>
            <asp:Parameter Name="fiscalorgname" DefaultValue="fiscalOrgname"></asp:Parameter>
            <asp:QueryStringParameter Name="appid" querystringfield="appid" ></asp:QueryStringParameter>
            <asp:Parameter Name="firstname" />
            <asp:parameter name="lastname"/>
            <asp:Parameter Name="city" />
            <asp:Parameter Name="state" />
            <asp:Parameter Name="zipcode" />
            <asp:Parameter Name="telephone" />
            <asp:Parameter Name="email" />
            <asp:Parameter Name="city1" />
            <asp:parameter name="authrepid"></asp:parameter>
          
        </UpdateParameters>
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="sqlCounty" runat="server" ConnectionString='<%$ ConnectionStrings:COSI_GRANTS_TEST %>' SelectCommand="SELECT ac.ApplicationId, ac.CountyId, c.County FROM Application_County AS ac INNER JOIN County AS c ON c.CountyID = ac.CountyId WHERE (ac.ApplicationId = @appid)">
        <SelectParameters>
            <asp:QueryStringParameter QueryStringField="appid" Name="appid"></asp:QueryStringParameter>


        </SelectParameters>
    </asp:SqlDataSource>
</asp:Content>
 


<asp:Content ID="Content3" ContentPlaceHolderID="Footer" Runat="Server">
    </asp:Content>
------------------------------

ANd here is my vb code

 

Imports System.Data
Imports System.Collections.Generic
Imports System.Data.SqlClient
Imports System.Data.DataTable
Imports System.Data.DataRelation
Imports System.IO
Imports System.IO.Stream
Imports System.IO.MemoryStream

Imports System.Configuration.ConfigurationManager

Imports Telerik.Web.UI
Imports System.Web.UI.WebControls.CheckBoxList
Imports Telerik.Web.Data
Partial Class StepI_EditProposal
    Inherits System.Web.UI.Page
    Dim conn As New SqlConnection(ConnectionStrings("COSIGrantsDB").ConnectionString)

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
        If Not IsPostBack Then
            LoadCounty()
        End If
    End Sub

    Protected Sub LoadCounty()
        conn.Open()
        Dim ck As New RadCheckBoxList()
        Me.Controls.Add(ck)



        Dim dt As DataTable = New DataTable()
        Dim ad As SqlDataAdapter = New SqlDataAdapter("Select countyid, county from county order by county", conn)
        ad.Fill(dt)

        Dim ck As New CheckBoxList()
        ck = TryCast(RadDataForm1.FindControl("ckCounty"), CheckBoxList)
        ck.DataSource = dt
        ck.DataTextField = "county"
        ck.DataValueField = "countyid"
        ck.DataBind()
        Dim cmd As New SqlCommand("Select * from application _county where applicationid = " & Request.QueryString("appid"), conn)
        Dim rdr = cmd.ExecuteReader()
        Dim ckvalue As String
        While rdr.Read()
            For i = 0 To ck.Items.Count - 1
                ckvalue = ck.Items(i).Value
                If ckvalue = rdr.GetValue(0) Then
                    ck.Items(i).Selected = True
                End If
            Next

        End While
        rdr.Close()

        dt.Clear()
        conn.Close()
    End Sub
    Protected Sub raddataform1_itemdatabound(ByVal sender As Object, ByVal e As RadDataFormItemEventArgs) Handles RadDataForm1.ItemDataBound
        Dim editableItem As RadDataFormEditableItem = TryCast(e.Item, RadDataFormEditableItem)
        LoadCounty()
    End Sub

    Protected Sub ckCounty_DataBinding1(sender As Object, e As EventArgs)

    End Sub
End Class

 

Thank you

Vessy
Telerik team
 answered on 10 Aug 2017
1 answer
148 views

Hi,

I have a javascript function (see below) that fires perform insert command for a data form. I am trying to pass the command argument of the button clicked to the ItemCommand event handler but somehow e.CommandArgument.ToString() tunrs out to be an empty string. Can anyone please guide me as to what i am doing wrong?

aspx:

function callSaveAll(sender,args) {                 
                        var object2 = $find("<%= OrderItemDataForm.ClientID%>");                       
                            if (object2._isItemInserted)
                                object2.fireCommand("PerformInsert", args._commandArgument);                                                                     
                }

 

.cs code:

protected void OrderItemDataForm_ItemCommand(object sender, RadDataFormCommandEventArgs e)
    {

        if (e.CommandName == "Cancel")
            ClientScript.RegisterStartupScript(Page.GetType(), "mykey", "CancelEdit();", true);


        if (e.CommandName == "PerformInsert")
        {
            if (Page.IsValid)
            {
                if (e.CommandArgument.ToString() == "SaveNew")
                {
                    saveAndNewButtonClicked = true;
                }
                else if (e.CommandArgument.ToString() == "Save")
                {
                    saveAndNewButtonClicked = false;
                }
            }
        }
    }
Marin Bratanov
Telerik team
 answered on 04 Jul 2017
1 answer
109 views

I'm trying to fire a command from raddataform like:

        var masterTable = $find("<%= RadDataForm1.ClientID %>");
         masterTable.fireCommand("MyUploadCommand", "");

that fires very well and I can catch coomand in RadDataForm1_ItemCommand like:

If e.CommandName = "MyUploadCommand" Then......

but I cannot find controls inside <EditItemTemplate> no matter what. also very strange but inside Itemcommand routine e.DataFormItem.IsInEditMode is always false but its in edit mode.

I can access controls from RadDataForm1_Deletecommand, RadDataForm1_InsertCommand perfectly but not from RadDataForm1_ItemCommand.

How can I trigger  a command with javascript and catch it and access controls ?

If I cannot find the answer I have to give up using raddataform because there are no documents left to read...

 

best.

 

 

 

Aykut
Top achievements
Rank 1
 answered on 13 Apr 2017
1 answer
75 views

Hi,
I have a scenario where in I have to insert data into multiple tables using a single RadDataForm with EntityDataSource

Following are the three tables and Columns
ComType:  Id, ConType

ContactDetail:  Id, ContactName, City

ContactCom: Id, ContactDetailsId, ComTypeId, ComValue

The point is I am able to insert into single table but not able to insert into multiple tables.

<asp:Label ID="ComValueLabel3" runat="server" AssociatedControlID="ComValueTextBox" CssClass="rdfLabel rdfBlock" Text="ComValue"></asp:Label>
  <telerik:RadTextBox ID="ComValueTextBox" runat="server" RenderMode="Lightweight" Text='<%# Bind("ComValue") %>' WrapperCssClass="rdfInput" />

 

Following is the syntax of calling other tables columns while insertion
<asp:Label ID="ContactNameLabel2" runat="server" AssociatedControlID="ContactNameTextBox" CssClass="rdfLabel rdfBlock" Text="ContactName"></asp:Label>
 <telerik:RadTextBox ID="ContactNameTextBox" runat="server" RenderMode="Lightweight" Text='<%# Bind("ContactDetail.ContactName") %>' WrapperCssClass="rdfInput" />

EntityDataSource Code:
<asp:EntityDataSource ID="EntityDataSource1" runat="server" ConnectionString="name=sampleEntities" DefaultContainerName="sampleEntities" EnableDelete="True" EnableFlattening="False" EnableInsert="True" EnableUpdate="True"
EntitySetName="ContactComs" EntityTypeFilter="ContactCom" Include="ContactDetail,ComType"></asp:EntityDataSource>

I am unable to call the columns of other tables which are in include method

Here I am attaching the sample DB and full code of my scenario

How can I accomplish this

Thanks In Advance

 

DANA REDDY
Top achievements
Rank 1
 answered on 30 Mar 2017
3 answers
163 views

Hi All,

here is what I am trying to achieve;

While my Telerik data form is in InsertNewItem mode, I need to use user's data entries in any of the RadTextBox as they enter it, before they click on the "Insert" button. I need to be able to extract that data entry once they move focus away from that TextBox so that I can use it to run data query and fill other textboxes in the same InsertItem form template. Later the user will have the ability to click on Insert to add that new record to the SqlDataSource already linked to the Telerik DataForm.

your help is highly appreciated!

Eyup
Telerik team
 answered on 15 Feb 2017
Narrow your results
Selected tags
Tags
+? more
Top users last month
Patrick
Top achievements
Rank 1
Iron
Iron
Iron
MIS
Top achievements
Rank 1
Ross
Top achievements
Rank 1
Marcin
Top achievements
Rank 1
Iron
Iron
Sean
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Patrick
Top achievements
Rank 1
Iron
Iron
Iron
MIS
Top achievements
Rank 1
Ross
Top achievements
Rank 1
Marcin
Top achievements
Rank 1
Iron
Iron
Sean
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?