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

Data access use with textboxes

1 Answer 40 Views
Design Time (Visual Designer & Tools)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Ruby
Top achievements
Rank 1
Ruby asked on 01 May 2014, 09:21 PM
Hi, I am usingTelerik data access for the first time. Initially I used it with radgrid and it worked fine.
Now , I have a web form with 10 textboxes getting data from open access query, I am not sure how to bind that data. I need something like datareader to bind data from the query.Based on the value selected from customer dropdown, my textboxes value should change. please guide me on this, Thanks.


<
telerik:OpenAccessLinqDataSource ID="OALDCustData" Runat="server" ContextTypeName="AthenaModel.EntitiesModel" EnableInsert="True" EnableUpdate="True" EntityTypeName="" ResourceSetName="CUSTOMERs" Where="CUSTOMER_ID == @CUSTOMER_ID">
          <WhereParameters>
              <asp:ControlParameter ControlID="uxRcbCustomer" DefaultValue="0" Name="CUSTOMER_ID" PropertyName="SelectedValue" Type="Int64" />
          </WhereParameters>
      </telerik:OpenAccessLinqDataSource>
      
  <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
  </telerik:RadAjaxManager>
  <telerik:RadScriptManager ID="RadScriptManager1" runat="server" />
  <telerik:RadSkinManager ID="RadSkinManager1" Runat="server" Skin="Web20">
  </telerik:RadSkinManager>
  <div id="editform" >
      <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" >
          <asp:HiddenField ID="hiddenIsDirty" runat="server" />
              <table>
                    <tr>
                      <td class="labelcol" >
                          <asp:Label ID="lblEditCustomer" Font-Bold="true" ForeColor="navy" runat="server" Text="Go To Customer" ></asp:Label></td>
                      <td style="width: 362px">
                          
                           <telerik:RadComboBox ID="uxRcbCustomer" runat="server" Width="500px" AutoPostBack="True" DataValueField="Key" DataTextField="Value" MaxHeight="600px" EmptyMessage="Select a Customer" EnableLoadOnDemand="True" ShowMoreResultsBox="true"
                          EnableVirtualScrolling="true" OnItemsRequested="rcbCustomer_ItemsRequested">
                      </telerik:RadComboBox>
                      </td>
                  </tr>       
                  <tr>
                      <td class="labelcol" >
                          Customer Name:               
                      </td>
                      <td style="width: 362px" >
                          <telerik:RadTextBox ID="txtName" runat="server" MaxLength="50" Width="336px">
                          </telerik:RadTextBox>
                          <asp:RequiredFieldValidator ID="NameRequiredValidator" runat="server" ErrorMessage="Customer Name is required." Text="*" ControlToValidate="txtName"></asp:RequiredFieldValidator>
                      </td>
                  </tr>
                  <tr>
                      <td class="labelcol" >
                          Wellness Type:</td>
                      <td style="width: 362px">
                         
                          <telerik:RadComboBox ID="cboWellnessType" CausesValidation="true" runat="server" Width="336px" OnClientSelectedIndexChanged="onValueChanged" AutoPostBack="true"  >
                          </telerik:RadComboBox>
                          <asp:RequiredFieldValidator ID="WellnessTypeRequired" runat="server" ErrorMessage="Wellness Type is required." Text="*" ControlToValidate="cboWellnessType"></asp:RequiredFieldValidator>
                      </td>
                  </tr>
              </table>
              <asp:Panel ID="pnlParentCustomer" runat="server">
                  <table>
                      <tr>
                          <td class="labelcol" >
                              Reporting Roll-up Customer:
                              <img src="images/Help.png" alt=""  id="imgAtt1"/>
                              <telerik:RadToolTip ID="RadToolTip2" TargetControlID="imgAtt1" IsClientID="true" runat="server"
                                  HideEvent="LeaveTargetAndToolTip" AutoCloseDelay="6000" Text="TODO: Need help text here.">
                              </telerik:RadToolTip>
                          </td>
                          <td style="width: 362px">
                              <telerik:RadComboBox ID="cboParent" runat="server" Width="336px" OnClientSelectedIndexChanged="onValueChanged" >
                              </telerik:RadComboBox>
                          </td>
                      </tr>
                  </table>
              </asp:Panel>
          </telerik:RadAjaxPanel>
              <table>
                  <tr>
                      <td class="labelcol" >
                          Billing Customer:
                      </td>
                      <td style="width: 362px">
                          <telerik:RadComboBox ID="cboBillingCustomer" runat="server" Width="336px"  OnClientSelectedIndexChanged="onValueChanged">
                          </telerik:RadComboBox>
                      </td>
                  </tr>
                  <tr>
                      <td class="labelcol" >
                          Health Management Consultant:
                      </td>
                      <td style="width: 362px">
                          <telerik:RadTextBox ID="txtInternalContact" runat="server" Width="336px" MaxLength="100" >
                          </telerik:RadTextBox>
                      </td>
                  </tr>
                  <tr>
                      <td class="labelcol" >
                          Lawson Finance Cust. #:
                      </td>
                      <td style="width: 362px">
                          <telerik:RadNumericTextBox ID="txtFinanceCustomer" runat="server" MaxLength="7" Width="120px" Culture="English (United States)" >
                              <NumberFormat DecimalDigits="0" GroupSeparator="" />
                          </telerik:RadNumericTextBox>
                      </td>
                  </tr>
              </table>
       
      <br />
      <telerik:RadSplitter ID="RadSplitter1" runat="server" Orientation="vertical" BorderSize="0" Height="215px">
          <telerik:RadPane ID="RadPane1" runat="server" Width="350px">
              <strong>Billing Information</strong><br />
              <table >
                  <tr>
                      <td>
                          Address Line 1:
                      </td>
                      <td style="width: 237px">
                          <telerik:RadTextBox ID="txtAddress1" runat="server" Width="95%" MaxLength="50">
                          </telerik:RadTextBox>
                      </td>
                  </tr>
                  <tr>
                      <td>
                          Address Line 2:
                      </td>
                      <td >
                          <telerik:RadTextBox ID="txtAddress2" runat="server" Width="95%" MaxLength="50">
                          </telerik:RadTextBox>
                      </td>
                  </tr>
                  <tr>
                      <td>
                          City:
                      </td>
                      <td >
                          <telerik:RadTextBox ID="txtCity" runat="server" Width="95%" MaxLength="50">
                          </telerik:RadTextBox>
                      </td>
                  </tr>
                  <tr>
                      <td>
                          State:
                      </td>
                      <td >
                          <telerik:RadComboBox ID="cboState" runat="server" Width="95%">
                          </telerik:RadComboBox>
                      </td>
                  </tr>
                  <tr>
                      <td>
                          Zip:
                      </td>
                      <td >
                          <telerik:RadTextBox ID="txtZipCode" runat="server" MaxLength="20">
                          </telerik:RadTextBox></td>
                  </tr>
                  <tr>
                      <td>
                          Fax Number:
                      </td>
                      <td >
                          <telerik:RadMaskedTextBox ID="txtFaxNumber" runat="server" DisplayMask="###.###.####"
                              Mask="###.###.####" SelectionOnFocus="CaretToBeginning" Width="80px">
                          </telerik:RadMaskedTextBox>
                      </td>
                  </tr>
 
              </table>
          </telerik:RadPane>

1 Answer, 1 is accepted

Sort by
0
Accepted
Boyan
Telerik team
answered on 02 May 2014, 03:02 PM
Hello Ruby,

As I reviewed your code I noticed that you are filtering an OpenAccessLinqDataSource. This component actually returns a collections and it is appropriate to be used with list control such as the Telerik RadGrid.

On the other hand your referral to the datareaders suggests that you would like to query the data in the code-behind, apply any filters specified by the RadComboBox-es or perform additional logic on the retrieved data and data-bind to a number of text-boxes. 

If that is the case I would like to point you at this documentation article from the ASP.NET Development Section of our documentation. It describes the best practices when using Telerik Data Access context in an ASP.NET Application. Once you retrieve and process the data, it is a matter of the standard techniques of data binding in an .aspx page.

Additionally, I recommend you going through out samples kit. It contains a number of ASP.NET related examples that demonstrate those best practices in various scenarios.

If you have any more  questions or need any further assistance, please let us know.

Regards,
Boyan
Telerik
 
OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.
 
Tags
Design Time (Visual Designer & Tools)
Asked by
Ruby
Top achievements
Rank 1
Answers by
Boyan
Telerik team
Share this question
or