Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
99 views

What is the proper procedure to ajaxify controls contained in layout templates of RadGrids or Formviews?

e.g. if RadFormView1 contains an itemtemplate which contains a RadGrid, how does one properly configure the RadAjaxManager to ajaxify the grid?

I tried something like this:

01.<telerik:RadAjaxManager runat="server" ID="RadAjaxManager_ManualRequest">
02.    <AjaxSettings>
03.      <telerik:AjaxSetting AjaxControlID="RadFormView_Customers">
04.        <UpdatedControls>
05.          <telerik:AjaxUpdatedControl ControlID="RadFormView_Customers" LoadingPanelID="RadAjaxLoadingPanel_ManualRequest" />
06.        </UpdatedControls>
07.      </telerik:AjaxSetting>
08.      <telerik:AjaxSetting AjaxControlID="RadGrid_Addresses">
09.        <UpdatedControls>
10.          <telerik:AjaxUpdatedControl ControlID="RadGrid_Addresses" LoadingPanelID="RadAjaxLoadingPanel_ManualRequest" />
11.        </UpdatedControls>
12.      </telerik:AjaxSetting>
13.    </AjaxSettings>
14.  </telerik:RadAjaxManager>

 

Using this definition (where Radgrid_Addresses is a control contained in the ItemTemplate of the Formview), the ajax request seems to work for the first request to the radgrid (for example, moving to the next page) but subsequent requests (moving back or forward a page again) seem to affect the entire formview rather than just the grid.

 

Thanks,

 

Vessy
Telerik team
 answered on 19 Jun 2020
8 answers
418 views

Hi,

We are using a stacked column series for our chart display. We have a single stacked bar in display (as attached). I am trying to add a border to each stack/column but I couldn't find an attribute I can use. I tried the approach defined here but that didn't seem to work.

https://feedback.telerik.com/aspnet-ajax/1373488-add-appearance-options-for-the-series-border-in-radhtmlchart

Another thing that I am having to struggle with is I have the chart title visible set to false but there is a white space in that area that I can't seem to get rid of. Is there somewhere in css i can do that?

Attached is the expected and what I see right now. I gave the chart a black background to show what I mean.

Can you help me figure this out?

 

 

 

Vessy
Telerik team
 answered on 19 Jun 2020
2 answers
315 views
Hi,

I am using RadDatePicker and I want to make whole week selectable. When user click on any date then whole week row will be selected and input field will be filled with Monday's date. Also I can set default week by date.

Any idea?



Had
Top achievements
Rank 1
Iron
 answered on 19 Jun 2020
0 answers
147 views

Hello,
in this example: 

https://demos.telerik.com/aspnet-ajax/autocompletebox/examples/default/defaultvb.aspx?show-source=true

is missing the DefaultVB.aspx.designer.vb

so when I try to reproduce, I get these errors:

 

How can I solve?

Thank you.

Luis

Luis
Top achievements
Rank 1
Veteran
 asked on 18 Jun 2020
1 answer
117 views

hello

I want to open radgrid header context filte exact coumn header position but it goes to Top ..Please Help Me!!

Vessy
Telerik team
 answered on 18 Jun 2020
3 answers
417 views

I have implement a custom provider for RadSpreadsheet as follows:

 

public class MySpreadsheetDocumentProvider : SpreadsheetProviderBase
{
public string FilePath { get; set; }
 
      public MySpreadsheetDocumentProvider(APD apd, out string errorMessage) : base()
{
   errorMessage = string.Empty;
   string folderPath = $"{ConfigurationManager.AppSettings["SpreadsheetFolder"]}";
 
 if (!Directory.Exists(folderPath))
 {
   Directory.CreateDirectory(folderPath);
 }
              
  FilePath = $"{folderPath}/{apd.APDId}.xlsx";
 
  if (!File.Exists(FilePath))
  {               
     Workbook workbook = new Workbook();
     Worksheet worksheet = workbook.AddSheet();                
 
     using (APD_BLL apd_bll = new APD_BLL())
     {
        var apd_data = apd_bll.Get(apd.APDId);
        FillWorksheet(worksheet, apd_data);
     }
 
     workbook.Save(FilePath);
  }           
   }
 
public override void SaveWorkbook(Workbook workbook)
   {
   SpreadsheetDocumentProvider provider = new SpreadsheetDocumentProvider(FilePath);
   provider.SaveWorkbook(workbook);
   }
 
public override List<Worksheet> GetSheets()
   {
    SpreadsheetDocumentProvider provider = new SpreadsheetDocumentProvider(FilePath);
    var sheets = provider.GetSheets();
 
    return sheets;
 }
 
 private static void FillWorksheet(Worksheet sheet, IEnumerable<APDYpallhlou> data)
 

  .....

 }

 

So the provider looks for an excel file in a predefined location. If the file exists then it is bound to the RadSpreadsheet, otherwise a new file is created. This part of the provider works well with small as well as with bigger files.

The problem is when I try to Save the RadSpreadsheet by clicking the Save button on the toolbar. Save works ok for a few hundred rows. But it fails for a larger number of rows, e.g. 15000 rows. When the Save button is clicked the page freezes and method SaveWorkbook(Workbook workbook) is never invoked.

Peter Milchev
Telerik team
 answered on 18 Jun 2020
1 answer
108 views

Hi,
I am using the textbox, RadNumericTextBox and RadAutoCompleteBox inside the grid to receive the values and store them in the DB. However, when a lot of data needs to be input, the speed of binding becomes slower, so virtualization and paging are performed. So, there is a problem of turning the loop to get the data of the grid and not getting the entire data.

RadGridItems.AllowPaging = false; RadGridItems.Rebind(); I need to get the data entered in needdatasource at the time, but I don't know how to get it. Please tell me how to get all the data entered on the paged grid. Please help me its urgent issue.please refer code below.

<telerik:RadGrid ID="RadGridItems" runat="server" AllowMultiRowSelection="true" ShowFooter="true" RenderMode="Lightweight" 
                OnItemDataBound="RadGridItems_ItemDataBound" OnRowDrop="RadGridItems_RowDrop" AutoGenerateColumns="false" AllowAutomaticDeletes="true" 
                 OnPageIndexChanged="RadGridItems_PageIndexChanged" 
                ShowStatusBar="false" EnableEmbeddedSkins="true" EnableEmbeddedBaseStylesheet="true" CssClass="brd_list2" PagerStyle-CssClass="brd_pager2" Width="1920">
<MasterTableView EnableHeaderContextMenu="false" NoMasterRecordsText="" HeaderStyle-Wrap="false" ItemStyle-Wrap="false" AlternatingItemStyle-Wrap="false">
                    <ColumnGroups>
                        <telerik:GridColumnGroup HeaderText="예상매입처" Name="Buy"></telerik:GridColumnGroup>
                        <telerik:GridColumnGroup HeaderText="예상운반비" Name="Trans"></telerik:GridColumnGroup>
    </ColumnGroups>
<Columns>
<telerik:GridClientSelectColumn UniqueName="chkline" HeaderStyle-Width="30" ItemStyle-CssClass="col_ct"></telerik:GridClientSelectColumn>
                        <telerik:GridBoundColumn DataField="Sequence" HeaderText="번호" Visible="false" HeaderStyle-Width="40px" ItemStyle-CssClass="col_ct"></telerik:GridBoundColumn>

                        <telerik:GridTemplateColumn HeaderText="품목코드" HeaderStyle-Width="100" ItemStyle-CssClass="col_ct" >
<ItemTemplate>
                                <telerik:RadTextBox ID="ItemCode" runat="server" Enabled="false" Text='<%# DataBinder.Eval(Container.DataItem, "ItemCode")%>' Skin="Windows7"></telerik:RadTextBox>
</ItemTemplate>
</telerik:GridTemplateColumn>
    <telerik:GridBoundColumn DataField="ItemName" UniqueName="ItemName" Display="false" HeaderText="품목명"></telerik:GridBoundColumn> 
                                                      
<telerik:GridTemplateColumn HeaderText="수종" HeaderStyle-Width="140">
<ItemTemplate>
<telerik:RadAutoCompleteBox ID="TreeCode" runat="server" OnClientTextChanged="TreeCode_TextChanged" DropDownPosition="Automatic" DropDownWidth="250" DataSourceID="TreeSpecies" 
                                    DataValueField="ItemCode" DataTextField="TreeName" InputType="Text" Skin="Windows7" OnDataSourceSelect="TreeCode_DataSourceSelect">
<DropDownItemTemplate>
<table>
<tr>                                                 
<th><%# DataBinder.Eval(Container.DataItem, "TreeName")%></th>                                                                                               
                                                <th>,&nbsp;</th>
                                                <th><%# DataBinder.Eval(Container.DataItem, "Description")%></th>
</tr>
</table>
</DropDownItemTemplate>
<TextSettings SelectionMode="Single" />                                  
</telerik:RadAutoCompleteBox>
</ItemTemplate>
</telerik:GridTemplateColumn>
                     
                        <telerik:GridTemplateColumn HeaderText="규격" HeaderStyle-Width="120" ItemStyle-CssClass="col_ct">
<ItemTemplate>
<telerik:RadTextBox ID="Description" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Description")%>' Width="130" Skin="Windows7"></telerik:RadTextBox>
</ItemTemplate>
</telerik:GridTemplateColumn>                                                         

<telerik:GridTemplateColumn UniqueName="Quantity" HeaderText="수량" HeaderStyle-Width="80" ItemStyle-CssClass="col_rg" FooterStyle-CssClass="col_rg">
<ItemTemplate>
<telerik:RadNumericTextBox ID="Quantity" EmptyMessage="0" runat="server" IncrementSettings-InterceptArrowKeys="false" IncrementSettings-InterceptMouseWheel="false" Culture="ko-KR" DbValueFactor="1" LabelWidth="64px" Enabled="true"
DbValue='<%# Bind("Quantity") %>' MaxValue="7.0368744177664E+15" MinValue="-7.0368744177664E+15" Width="115px" Height="19px" DisabledStyle-HorizontalAlign="Right" EmptyMessageStyle-HorizontalAlign="Right" EnabledStyle-HorizontalAlign="Right" FocusedStyle-HorizontalAlign="Right" HoveredStyle-HorizontalAlign="Right" InvalidStyle-HorizontalAlign="Right" NegativeStyle-HorizontalAlign="Right" ReadOnlyStyle-HorizontalAlign="Right">
<NegativeStyle Resize="None"></NegativeStyle>
<NumberFormat ZeroPattern="n" DecimalDigits="0"></NumberFormat>
<EmptyMessageStyle Resize="None"></EmptyMessageStyle>
<ReadOnlyStyle Resize="None"></ReadOnlyStyle>
<FocusedStyle Resize="None"></FocusedStyle>
<DisabledStyle Resize="None"></DisabledStyle>
<InvalidStyle Resize="None"></InvalidStyle>
<HoveredStyle Resize="None"></HoveredStyle>
<EnabledStyle Resize="None"></EnabledStyle>
                                    <ClientEvents OnValueChanged="CalculateSupplyAmount" />
</telerik:RadNumericTextBox>
</ItemTemplate>
                            <FooterTemplate>
<telerik:RadNumericTextBox ID="SumQuantity" runat="server" IncrementSettings-InterceptArrowKeys="false" IncrementSettings-InterceptMouseWheel="false" Culture="ko-KR" Width="100px" Height="19px" LabelWidth="64px"
DisabledStyle-HorizontalAlign="Right" EmptyMessageStyle-HorizontalAlign="Right" EnabledStyle-HorizontalAlign="Right" FocusedStyle-HorizontalAlign="Right" HoveredStyle-HorizontalAlign="Right" InvalidStyle-HorizontalAlign="Right" NegativeStyle-HorizontalAlign="Right" ReadOnlyStyle-HorizontalAlign="Right">
<NegativeStyle Resize="None"></NegativeStyle>
<NumberFormat ZeroPattern="n" DecimalDigits="0"></NumberFormat>
<EmptyMessageStyle Resize="None"></EmptyMessageStyle>
<ReadOnlyStyle Resize="None"></ReadOnlyStyle>
<FocusedStyle Resize="None"></FocusedStyle>
<DisabledStyle Resize="None"></DisabledStyle>
<InvalidStyle Resize="None"></InvalidStyle>
<HoveredStyle Resize="None"></HoveredStyle>
<EnabledStyle Resize="None"></EnabledStyle>
</telerik:RadNumericTextBox>
</FooterTemplate>
</telerik:GridTemplateColumn>                                                                     
                        <telerik:GridTemplateColumn UniqueName="UnitPrice" HeaderText="매출단가" HeaderStyle-Width="6%" ItemStyle-CssClass="col_rg align_txt_src" FooterStyle-CssClass="col_rg">
<ItemTemplate>
                               
                                <telerik:RadNumericTextBox ID="UnitPrice" EmptyMessage="0" runat="server" IncrementSettings-InterceptArrowKeys="false" IncrementSettings-InterceptMouseWheel="false" Culture="ko-KR" DbValueFactor="1" LabelWidth="24px" Enabled="true"
    DbValue='<%# Bind("UnitPrice") %>' MaxValue="7.0368744177664E+15" MinValue="-7.0368744177664E+15" Height="19px" DisabledStyle-HorizontalAlign="Right" EmptyMessageStyle-HorizontalAlign="Right" EnabledStyle-HorizontalAlign="Right" FocusedStyle-HorizontalAlign="Right" HoveredStyle-HorizontalAlign="Right" InvalidStyle-HorizontalAlign="Right" NegativeStyle-HorizontalAlign="Right" ReadOnlyStyle-HorizontalAlign="Right">
    <NegativeStyle Resize="None"></NegativeStyle>
    <NumberFormat ZeroPattern="n" DecimalDigits="0"></NumberFormat>
    <EmptyMessageStyle Resize="None"></EmptyMessageStyle>
    <ReadOnlyStyle Resize="None"></ReadOnlyStyle>
    <FocusedStyle Resize="None"></FocusedStyle>
    <DisabledStyle Resize="None"></DisabledStyle>
    <InvalidStyle Resize="None"></InvalidStyle>
    <HoveredStyle Resize="None"></HoveredStyle>
    <EnabledStyle Resize="None"></EnabledStyle>
                                    <ClientEvents OnValueChanged="CalculateSupplyAmount" />
    </telerik:RadNumericTextBox> 
                                <telerik:RadButton ID="btnUnitPrice" AutoPostBack="true" OnClick="btnUnitPrice_Click" runat="server" Text="Search" Skin="" CssClass="btn_src"></telerik:RadButton>
                                                                                                                                                  
    </ItemTemplate>
</telerik:GridTemplateColumn>

                        <telerik:GridTemplateColumn UniqueName="UnitPriceButton" Display="false" HeaderStyle-Width="50">
<ItemTemplate>
                                <span class="telerik_bx inp_btn">
                                    <telerik:RadButton ID="btnUnitPrice2" AutoPostBack="true" OnClick="btnUnitPrice_Click" runat="server" Text="Search" Skin="" CssClass="btn_src"></telerik:RadButton>
                                </span>
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>

<telerik:GridTemplateColumn UniqueName="SupplyAmount" HeaderText="매출액" HeaderStyle-Width="110" ItemStyle-CssClass="col_rg" FooterStyle-CssClass="col_rg">
<ItemTemplate>
<telerik:RadNumericTextBox ID="SupplyAmount" EmptyMessage="0" runat="server" IncrementSettings-InterceptArrowKeys="false" IncrementSettings-InterceptMouseWheel="false" Culture="ko-KR" DbValueFactor="1" LabelWidth="64px" 
DbValue='<%# Bind("SupplyAmount") %>' MaxValue="7.0368744177664E+15" MinValue="-7.0368744177664E+15" Width="115px" Height="19px" DisabledStyle-HorizontalAlign="Right" EmptyMessageStyle-HorizontalAlign="Right" EnabledStyle-HorizontalAlign="Right" FocusedStyle-HorizontalAlign="Right" HoveredStyle-HorizontalAlign="Right" InvalidStyle-HorizontalAlign="Right" NegativeStyle-HorizontalAlign="Right" ReadOnlyStyle-HorizontalAlign="Right">
<NegativeStyle Resize="None"></NegativeStyle>
<NumberFormat ZeroPattern="n" DecimalDigits="0"></NumberFormat>
<EmptyMessageStyle Resize="None"></EmptyMessageStyle>
<ReadOnlyStyle Resize="None"></ReadOnlyStyle>
<FocusedStyle Resize="None"></FocusedStyle>
<DisabledStyle Resize="None"></DisabledStyle>
<InvalidStyle Resize="None"></InvalidStyle>
<HoveredStyle Resize="None"></HoveredStyle>
<EnabledStyle Resize="None"></EnabledStyle>
</telerik:RadNumericTextBox>
</ItemTemplate>
<FooterTemplate>
<telerik:RadNumericTextBox ID="SumSupplyAmount" runat="server" IncrementSettings-InterceptArrowKeys="false" IncrementSettings-InterceptMouseWheel="false" Culture="ko-KR" Width="120" Height="19px" LabelWidth="64px"
DisabledStyle-HorizontalAlign="Right" EmptyMessageStyle-HorizontalAlign="Right" EnabledStyle-HorizontalAlign="Right" FocusedStyle-HorizontalAlign="Right" HoveredStyle-HorizontalAlign="Right" InvalidStyle-HorizontalAlign="Right" NegativeStyle-HorizontalAlign="Right" ReadOnlyStyle-HorizontalAlign="Right">
<NegativeStyle Resize="None"></NegativeStyle>
<NumberFormat ZeroPattern="n" DecimalDigits="0"></NumberFormat>
<EmptyMessageStyle Resize="None"></EmptyMessageStyle>
<ReadOnlyStyle Resize="None"></ReadOnlyStyle>
<FocusedStyle Resize="None"></FocusedStyle>
<DisabledStyle Resize="None"></DisabledStyle>
<InvalidStyle Resize="None"></InvalidStyle>
<HoveredStyle Resize="None"></HoveredStyle>
<EnabledStyle Resize="None"></EnabledStyle>
</telerik:RadNumericTextBox>
</FooterTemplate>
</telerik:GridTemplateColumn>
                       
                        <telerik:GridTemplateColumn HeaderText="코드" ColumnGroupName="Buy" HeaderStyle-Width="60px" ItemStyle-CssClass="col_ct" >
<ItemTemplate>
                                <telerik:RadTextBox ID="VendorCode" runat="server" ClientEvents-OnValueChanged="VendorCode_TextChanged" Text='<%# DataBinder.Eval(Container.DataItem, "VendorCode")%>' Skin="Windows7"></telerik:RadTextBox>
</ItemTemplate>
</telerik:GridTemplateColumn>
                        
<telerik:GridTemplateColumn HeaderText="명칭" ColumnGroupName="Buy"  HeaderStyle-Width="190px" ItemStyle-CssClass="col_lf" >
<ItemTemplate>
<telerik:RadAutoCompleteBox ID="VendorName" runat="server" OnClientTextChanged="VendorName_TextChanged" DataSourceID="Vendor" DataTextField="VendorName" DataValueField="VendorCode" InputType="Text" Skin="Windows7" OnDataSourceSelect="VendorName_DataSourceSelect">
<DropDownItemTemplate>
<table>
<tr>
<th><%# DataBinder.Eval(Container.DataItem, "VendorCode")%></th>
<th><%# DataBinder.Eval(Container.DataItem, "VendorName")%></th>
</tr>
</table>
</DropDownItemTemplate>
<TextSettings SelectionMode="Single" />
</telerik:RadAutoCompleteBox>
</ItemTemplate>
</telerik:GridTemplateColumn>                   
                        <telerik:GridBoundColumn DataField="VendorCode" UniqueName="DisVendorCode" Display="false"></telerik:GridBoundColumn>
                        
                        <telerik:GridTemplateColumn HeaderText="매입단가" HeaderStyle-Width="6%" ItemStyle-CssClass="col_rg align_txt_src" FooterStyle-CssClass="col_rg">
<ItemTemplate>       
                                                   
    <telerik:RadNumericTextBox ID="UnitCost2" EmptyMessage="0" runat="server" IncrementSettings-InterceptArrowKeys="false" IncrementSettings-InterceptMouseWheel="false" Culture="ko-KR" DbValueFactor="1" LabelWidth="64px" Enabled="true"
    DbValue='<%# Bind("UnitCost") %>' MaxValue="7.0368744177664E+15" MinValue="-7.0368744177664E+15" Height="19px" DisabledStyle-HorizontalAlign="Right" EmptyMessageStyle-HorizontalAlign="Right" EnabledStyle-HorizontalAlign="Right" FocusedStyle-HorizontalAlign="Right" HoveredStyle-HorizontalAlign="Right" InvalidStyle-HorizontalAlign="Right" NegativeStyle-HorizontalAlign="Right" ReadOnlyStyle-HorizontalAlign="Right">
    <NegativeStyle Resize="None"></NegativeStyle>
    <NumberFormat ZeroPattern="n" DecimalDigits="0"></NumberFormat>
    <EmptyMessageStyle Resize="None"></EmptyMessageStyle>
    <ReadOnlyStyle Resize="None"></ReadOnlyStyle>
    <FocusedStyle Resize="None"></FocusedStyle>
    <DisabledStyle Resize="None"></DisabledStyle>
    <InvalidStyle Resize="None"></InvalidStyle>
    <HoveredStyle Resize="None"></HoveredStyle>
    <EnabledStyle Resize="None"></EnabledStyle>
                                    <ClientEvents OnValueChanged="CalculateCost" />
    </telerik:RadNumericTextBox>
                                
                                <telerik:RadButton ID="btnUnitCost" AutoPostBack="true" OnClick="btnUnitCost_Click" runat="server" Text="Search" Skin="" CssClass="btn_src"></telerik:RadButton>
                                                        
    </ItemTemplate>
</telerik:GridTemplateColumn>
                     
<telerik:GridTemplateColumn HeaderText="매입액" HeaderStyle-Width="110" ItemStyle-CssClass="col_rg" FooterStyle-CssClass="col_rg">
<ItemTemplate>
<telerik:RadNumericTextBox ID="CostAmount" EmptyMessage="0" runat="server" IncrementSettings-InterceptArrowKeys="false" IncrementSettings-InterceptMouseWheel="false" Culture="ko-KR" DbValueFactor="1" LabelWidth="64px" Enabled="true"
DbValue='<%# Bind("Cost") %>' MaxValue="7.0368744177664E+15" MinValue="-7.0368744177664E+15" Width="115px" Height="19px" DisabledStyle-HorizontalAlign="Right" EmptyMessageStyle-HorizontalAlign="Right" EnabledStyle-HorizontalAlign="Right" FocusedStyle-HorizontalAlign="Right" HoveredStyle-HorizontalAlign="Right" InvalidStyle-HorizontalAlign="Right" NegativeStyle-HorizontalAlign="Right" ReadOnlyStyle-HorizontalAlign="Right">
<NegativeStyle Resize="None"></NegativeStyle>
<NumberFormat ZeroPattern="n" DecimalDigits="0"></NumberFormat>
<EmptyMessageStyle Resize="None"></EmptyMessageStyle>
<ReadOnlyStyle Resize="None"></ReadOnlyStyle>
<FocusedStyle Resize="None"></FocusedStyle>
<DisabledStyle Resize="None"></DisabledStyle>
<InvalidStyle Resize="None"></InvalidStyle>
<HoveredStyle Resize="None"></HoveredStyle>
<EnabledStyle Resize="None"></EnabledStyle>
</telerik:RadNumericTextBox>
</ItemTemplate>
<FooterTemplate>
<telerik:RadNumericTextBox ID="SumCost" runat="server" IncrementSettings-InterceptArrowKeys="false" IncrementSettings-InterceptMouseWheel="false" Culture="ko-KR" Width="120" Height="19px" LabelWidth="64px" Enabled="true"
DisabledStyle-HorizontalAlign="Right" EmptyMessageStyle-HorizontalAlign="Right" EnabledStyle-HorizontalAlign="Right" FocusedStyle-HorizontalAlign="Right" HoveredStyle-HorizontalAlign="Right" InvalidStyle-HorizontalAlign="Right" NegativeStyle-HorizontalAlign="Right" ReadOnlyStyle-HorizontalAlign="Right">
<NegativeStyle Resize="None"></NegativeStyle>
<NumberFormat ZeroPattern="n" DecimalDigits="0"></NumberFormat>
<EmptyMessageStyle Resize="None"></EmptyMessageStyle>
<ReadOnlyStyle Resize="None"></ReadOnlyStyle>
<FocusedStyle Resize="None"></FocusedStyle>
<DisabledStyle Resize="None"></DisabledStyle>
<InvalidStyle Resize="None"></InvalidStyle>
<HoveredStyle Resize="None"></HoveredStyle>
<EnabledStyle Resize="None"></EnabledStyle>
</telerik:RadNumericTextBox>
</FooterTemplate>
</telerik:GridTemplateColumn>

                        <telerik:GridBoundColumn DataField="FromLocationCode" UniqueName="DisFromLocationCode" Display="false"></telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="ToLocationCode" UniqueName="DisToLocationCode" Display="false"></telerik:GridBoundColumn>
                        <telerik:GridTemplateColumn HeaderText="출도착" ColumnGroupName="Trans" HeaderStyle-Width="270" ItemStyle-CssClass="col_ct align_txt_src">
<ItemTemplate>
                                <telerik:RadAutoCompleteBox ID="FromLocation" runat="server" DataSourceID="FromLocationCode" DataTextField="FromLocationName" DataValueField="FromLocationCode" InputType="Text" Skin="Windows7" OnDataSourceSelect="FromLocation_DataSourceSelect">
<DropDownItemTemplate>
<table>
<tr>
<th><%# DataBinder.Eval(Container.DataItem, "FromLocationCode")%></th>
<th><%# DataBinder.Eval(Container.DataItem, "FromLocationName")%></th>
</tr>
</table>
</DropDownItemTemplate>
<TextSettings SelectionMode="Single" />
</telerik:RadAutoCompleteBox>
                                <telerik:RadAutoCompleteBox ID="ToLocation" runat="server" DataSourceID="ToLocationCode" DataTextField="ToLocationName" DataValueField="ToLocationCode" InputType="Text" Skin="Windows7" OnDataSourceSelect="ToLocation_DataSourceSelect">
<DropDownItemTemplate>
<table>
<tr>
<th><%# DataBinder.Eval(Container.DataItem, "ToLocationCode")%></th>
<th><%# DataBinder.Eval(Container.DataItem, "ToLocationName")%></th>
</tr>
</table>
</DropDownItemTemplate>
<TextSettings SelectionMode="Single" />
</telerik:RadAutoCompleteBox>
                                
                                <telerik:RadButton ID="btnTransPort" AutoPostBack="true" OnClick="btnTransPort_Click" runat="server" Text="Search" Skin="" CssClass="btn_src"></telerik:RadButton>
                                                 
</ItemTemplate>       
</telerik:GridTemplateColumn>
                       
                        <telerik:GridTemplateColumn HeaderText="금액" ColumnGroupName="Trans" HeaderStyle-Width="90" ItemStyle-CssClass="col_rg" FooterStyle-CssClass="col_rg">
<ItemTemplate>
<telerik:RadNumericTextBox ID="DeliveryCost" Runat="server" IncrementSettings-InterceptArrowKeys="false" IncrementSettings-InterceptMouseWheel="false" Culture="ko-KR" DbValueFactor="1" LabelWidth="64px" 
DbValue='<%# Bind("DeliveryCost") %>' MaxValue="7.0368744177664E+15" MinValue="-7.0368744177664E+15" Width="120px" Height="19px" DisabledStyle-HorizontalAlign="Right" EmptyMessageStyle-HorizontalAlign="NotSet" FocusedStyle-HorizontalAlign="Right" EnabledStyle-HorizontalAlign="Right" HoveredStyle-HorizontalAlign="Right" InvalidStyle-HorizontalAlign="Right" NegativeStyle-HorizontalAlign="Right" ReadOnlyStyle-HorizontalAlign="Right">
<NegativeStyle Resize="None"></NegativeStyle>
<NumberFormat ZeroPattern="n" DecimalDigits="0"></NumberFormat>
<EmptyMessageStyle Resize="None"></EmptyMessageStyle>
<ReadOnlyStyle Resize="None"></ReadOnlyStyle>
<FocusedStyle Resize="None"></FocusedStyle>
<DisabledStyle Resize="None"></DisabledStyle>
<InvalidStyle Resize="None"></InvalidStyle>
<HoveredStyle Resize="None"></HoveredStyle>
<EnabledStyle Resize="None"></EnabledStyle>
                                    <ClientEvents OnValueChanged="CalculateSumDeliveryCost" />
</telerik:RadNumericTextBox>
</ItemTemplate>
<FooterTemplate>
<telerik:RadNumericTextBox ID="SumDeliveryCost" runat="server" IncrementSettings-InterceptArrowKeys="false" IncrementSettings-InterceptMouseWheel="false" Culture="ko-KR" Width="80" Height="19px" LabelWidth="64px"
DisabledStyle-HorizontalAlign="Right" EmptyMessageStyle-HorizontalAlign="Right" EnabledStyle-HorizontalAlign="Right" FocusedStyle-HorizontalAlign="Right" HoveredStyle-HorizontalAlign="Right" InvalidStyle-HorizontalAlign="Right" NegativeStyle-HorizontalAlign="Right" ReadOnlyStyle-HorizontalAlign="Right">
<NegativeStyle Resize="None"></NegativeStyle>
<NumberFormat ZeroPattern="n" DecimalDigits="0"></NumberFormat>
<EmptyMessageStyle Resize="None"></EmptyMessageStyle>
<ReadOnlyStyle Resize="None"></ReadOnlyStyle>
<FocusedStyle Resize="None"></FocusedStyle>
<DisabledStyle Resize="None"></DisabledStyle>
<InvalidStyle Resize="None"></InvalidStyle>
<HoveredStyle Resize="None"></HoveredStyle>
<EnabledStyle Resize="None"></EnabledStyle>
</telerik:RadNumericTextBox>
</FooterTemplate>
</telerik:GridTemplateColumn>
                        <telerik:GridTemplateColumn HeaderText="인도조건" ColumnGroupName="Trans" Visible="false" HeaderStyle-Width="80" ItemStyle-CssClass="col_ct">
<ItemTemplate>
<telerik:RadComboBox ID="TermsCode" runat="server" Skin="" Width="100%" DataSourceID="TermsOfDelivery"  
                                     SelectedValue='<%# DataBinder.Eval(Container.DataItem, "TermsCode") %>' DataTextField="TermsName" DataValueField="TermsCode"></telerik:RadComboBox>
</ItemTemplate>       
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn HeaderText="비고" HeaderStyle-Width="130" ItemStyle-CssClass="col_ct">
<ItemTemplate>
<telerik:RadTextBox ID="Memo1" AutoCompleteType="BusinessCity" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Memo1")%>' Width="150" Skin="Windows7"></telerik:RadTextBox>
</ItemTemplate>
</telerik:GridTemplateColumn>                            
</Columns>
</MasterTableView>
<ClientSettings AllowRowsDragDrop="true" EnablePostBackOnRowClick="false">
                    <Scrolling AllowScroll="true" UseStaticHeaders="true" SaveScrollPosition="false" ScrollHeight="350px" />
<Selecting AllowRowSelect="True" EnableDragToSelectRows="false"/>
                    <Virtualization EnableVirtualization="true" RetrievedItemsPerRequest="20" InitiallyCachedItemsCount="20" ItemsPerView="20"
                    LoadingPanelID="RadAjaxLoadingPanel1"  EnableCurrentPageScrollOnly="false"/>
</ClientSettings>
</telerik:RadGrid>

RadGridItems.AllowPaging = false;
        RadGridItems.Rebind();
    
        foreach (GridDataItem dataItem in RadGridItems.Items)
        {
            DataRow workRow = dtable.NewRow();

            if (!string.IsNullOrEmpty((dataItem.FindControl("TreeCode") as RadAutoCompleteBox).Text)) 
            {
                workRow["Sequence"] = dataItem.ItemIndex;

                string treeName = (dataItem.FindControl("TreeCode") as RadAutoCompleteBox).Entries[0].Text.Trim();
                string itemCode = (dataItem.FindControl("ItemCode") as RadTextBox).Text.Trim();

                if (!string.IsNullOrEmpty(itemCode))
                {
                    workRow["ItemCode"] = itemCode;
                    workRow["TreeCode"] = utility.getTreeCodeByItemCode(itemCode);
                }
                else
                {
                    workRow["ItemCode"] = string.Empty;
                    workRow["TreeCode"] = string.Empty;
                }

                workRow["TreeName"] = treeName;
                workRow["ItemName"] = treeName;
                               
                workRow["Description"] = (dataItem.FindControl("Description") as RadTextBox).Text;
                workRow["Quantity"] = entry.ConvertStringToDecimal((dataItem.FindControl("Quantity") as RadNumericTextBox).Text.ToString());
                workRow["UnitPrice"] = entry.ConvertStringToDecimal((dataItem.FindControl("UnitPrice") as RadNumericTextBox).Text.ToString());
                workRow["SupplyAmount"] = entry.ConvertStringToDecimal((dataItem.FindControl("SupplyAmount") as RadNumericTextBox).Text.ToString());

                if (!string.IsNullOrEmpty((dataItem.FindControl("VendorName") as RadAutoCompleteBox).Text))
                {
                    workRow["VendorCode"] = (dataItem.FindControl("VendorName") as RadAutoCompleteBox).Entries[0].Value;
                    workRow["VendorName"] = (dataItem.FindControl("VendorName") as RadAutoCompleteBox).Entries[0].Text;
                }
                else
                {
                    workRow["VendorCode"] = string.Empty;
                    workRow["VendorName"] = string.Empty;
                }

                workRow["UnitCost"] = entry.ConvertStringToDecimal((dataItem.FindControl("UnitCost2") as RadNumericTextBox).Text.ToString());
                workRow["Cost"] = entry.ConvertStringToDecimal((dataItem.FindControl("CostAmount") as RadNumericTextBox).Text.ToString());

                if (!string.IsNullOrEmpty((dataItem.FindControl("FromLocation") as RadAutoCompleteBox).Text))
                {
                    workRow["FromLocationCode"] = (dataItem.FindControl("FromLocation") as RadAutoCompleteBox).Entries[0].Value;
                    workRow["FromLocationName"] = (dataItem.FindControl("FromLocation") as RadAutoCompleteBox).Entries[0].Text;
                }
                else
                {
                    workRow["FromLocationCode"] = string.Empty;
                    workRow["FromLocationName"] = string.Empty;    
                }
                if (!string.IsNullOrEmpty((dataItem.FindControl("ToLocation") as RadAutoCompleteBox).Text))
                {
                    workRow["ToLocationCode"] = (dataItem.FindControl("ToLocation") as RadAutoCompleteBox).Entries[0].Value;
                    workRow["ToLocationName"] = (dataItem.FindControl("ToLocation") as RadAutoCompleteBox).Entries[0].Text;
                }
                else
                {
                    workRow["ToLocationCode"] = string.Empty;
                    workRow["ToLocationName"] = string.Empty;    
                }

                workRow["DeliveryCost"] = entry.ConvertStringToDecimal((dataItem.FindControl("DeliveryCost") as RadNumericTextBox).Text.ToString());
                workRow["TermsCode"] = (dataItem.FindControl("TermsCode") as RadComboBox).SelectedValue;
                workRow["Memo1"] = (dataItem.FindControl("Memo1") as RadTextBox).Text;

                dtable.Rows.Add(workRow);
                dtable.AcceptChanges();
            }
        }

protected void RadGridItems_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
    {
        //RadGridItems.DataSource = (DataTable)Session["Proposal_DT"];
        //RadGridItems.CurrentPageIndex = RadGridItems.MasterTableView.CurrentPageIndex;
    }


Attila Antal
Telerik team
 answered on 18 Jun 2020
2 answers
141 views

Hi, i've a matter with some RadDropDownList,

i need to setting them programmatically based on some querystring parameters.

However the event SelectedIndexChanged is not raised when I launch the command

rddlCalcolo.SelectedValue = Request["idc"];
 
// or for test
 
rddlCalcolo.SelectedIndex = 0;
Attila Antal
Telerik team
 answered on 18 Jun 2020
18 answers
995 views
Hi
I'm using radrgid in my application inside the radpanelbar as one of the radpanelitem.
I need to get the data from database on regular interval of 2 minutes and need to show in grid without need of refreshing the page.
For the I'm using Timer and updating the panelbar using asp:updatepanel with conditional updatemode and calling needdatasource event from pageload for every 2 minutes.
So to have the chages on interval basis I'm rebing the grid.
But paging is not working. If I dnt rebind the grid I'm not able to see the new chages.
 here is my code of needdatasource event
DataTable dtConsole = new DataTable();
       DataAccess accessData = new DataAccess();
       try
       {
           dtConsole = accessData.GetData("select consolename from CONSOLE");
           consloeGrid.DataSource = dtConsole;
           //if I dont rebind new data not showing else paging is not working
           consloeGrid.Rebind();
           if (dtConsole.Rows.Count > 10)
           {
               consloeGrid.AllowPaging = true;
           }
       }
Please help me as early as possible.
Eyup
Telerik team
 answered on 18 Jun 2020
0 answers
99 views

Hi,

 

I would like to drop items from a listbox into automatically generated textboxes.
when I use "tbxTester" it works very well but not with dynamic textboxes.

Thank you for your help

 

Droped ():
System.MissingMemberException: The public member 'text' of type 'Object' was not found. to Microsoft.VisualBasic.CompilerServices.Symbols.Container.GetMembers (String & MemberName, Boolean ReportErrors) to Microsoft.VisualBasic.CompilerServices.NewLateBinding.LateSet (Object Instance, Type Type, String MemberName, Object [] Arguments, String [] ArgumentNames, Type [] TypeArguments, Boolean OptimisticSet, Boolean RValueBase, CallType CallType) to Microsoft.VisualBasic.CompilerServices.NewLateBinding.LateSet (Object Instance, Type Type, String MemberName, Object [] Arguments, String [] ArgumentNames, Type [] TypeArguments) to Page_Telerik .lbxItems_Dropped (Object sender, RadListBoxDroppedEventArgs e) in \TelerikDemoStandAlone.aspx.vb: line 88

 

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="TelerikDemoStandAlone.aspx.vb" Inherits="Page_TelerikDemoStandAlone" %>
 
<!DOCTYPE html>
 
<html xmlns="http://www.w3.org/1999/xhtml" lang="fr-fr">
<head runat="server" lang="fr-fr">
    <meta name="robots" content="noindex,nofollow" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"  lang="fr" />
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
    <link href="/css/coreCss.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <form id="FormMain" runat="server" lang="fr-fr">
        <telerik:RadScriptManager ID="rsm" runat="server" />
        <main>
            <section>
                <article class="container full home">
                    <div class="row">
                        <asp:Panel ID="pnlMain" CssClass="col-xs-12 col-h" runat="server">
 
                            <telerik:RadAjaxPanel ID="ajaxPanel1" runat="server">
                                <div class="col-xs-12 col-md-12 col-h">
                                    <telerik:RadComboBox ID="cbxSizeBox" AutoPostBack="true" Width="100%" Filter="Contains" Skin="MetroTouch" RenderMode="Lightweight" runat="server" />
                                </div>
                            </telerik:RadAjaxPanel>
 
                            <telerik:RadAjaxPanel ID="ajaxPanel2" runat="server">
                                <div class="col-xs-12 col-md-2 col-h">
                                    <div class="col-lng">
                                        <h2>Items</h2>
                                        <asp:Panel ID="pnlItems" CssClass="col-xs-12 col-h" runat="server">
                                            <telerik:RadListBox ID="lbxItems" Width="100%" Height="500px"
                                                SelectionMode="Multiple" AllowTransfer="true" AutoPostBackOnTransfer="true" AutoPostBack="true"
                                                AllowReorder="true" AutoPostBackOnReorder="true" EnableDragAndDrop="true"
                                                ButtonSettings-ShowDelete="false" ButtonSettings-ShowReorder="false" ButtonSettings-ShowTransfer="false" ButtonSettings-ShowTransferAl="false" ButtonSettings-ShowTransferAll="false"
                                                OnDropped="lbxItems_Dropped"
                                                Skin="MetroTouch" RenderMode="Lightweight"
                                                runat="server" />
                                        </asp:Panel>
                                    </div>
                                </div>
                            </telerik:RadAjaxPanel>
 
                            <telerik:RadAjaxPanel ID="ajaxPanel3" runat="server">
                                <div class="col-xs-12 col-md-10 col-h">
                                    <div class="col-lng">
                                        <h2>Boxes</h2>
                                        <telerik:RadTextBox ID="tbxTester" Text="TextBox tester ..." runat="server" />
 
                                        <asp:Panel ID="pnlMaper" CssClass="col-xs-12 col-h" runat="server" />
                                   </div>
                                </div>
                            </telerik:RadAjaxPanel>
 
                            <telerik:RadAjaxPanel ID="ajaxPanel0" runat="server">
                                <div class="col-xs-12 col-h" style="max-height: 400px; overflow-y: scroll;">
                                    <asp:Label ID="litDebug" ForeColor="red" runat="server" />
                                </div>
                            </telerik:RadAjaxPanel>
 
                            <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server">
                                <div class="col-xs-12 col-h" style="max-height: 400px; overflow-y: scroll;">
                                    <asp:Literal ID="litRslt" runat="server" />
                                </div>
                            </telerik:RadAjaxPanel>
 
                            <div class="col-xs-12 col-h text-center">
                                <telerik:RadButton ID="btnSubmit" AutoPostBack="true" Text="save" Skin="BlackMetroTouch" Icon-PrimaryIconCssClass="rbSave" RenderMode="Lightweight" runat="server" />
                            </div>
                        </asp:Panel>
                    </div>
                </article>
            </section>
        </main>
 
        <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Width="256px" Height="64px">
            <asp:Label ID="AjaxLoadingPanelLabel" runat="server" ForeColor="Orange" Text="Loading..." /><br />
            <asp:Image ID="AjaxLoadingPanelImage" runat="server" Width="224px" Height="48px" ImageUrl="~/img/Loading.gif" />
        </telerik:RadAjaxLoadingPanel>
 
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
            <AjaxSettings>
 
                <telerik:AjaxSetting AjaxControlID="lbxItems">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="lbxItems" LoadingPanelID="RadAjaxLoadingPanel1" />
                         <telerik:AjaxUpdatedControl ControlID="tbxTester" LoadingPanelID="RadAjaxLoadingPanel1" />
                        <telerik:AjaxUpdatedControl ControlID="litDebug" LoadingPanelID="RadAjaxLoadingPanel1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
 
                <telerik:AjaxSetting AjaxControlID="cbxSizeBox">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="pnlMaper" LoadingPanelID="RadAjaxLoadingPanel1" />
                        <telerik:AjaxUpdatedControl ControlID="litRslt" LoadingPanelID="RadAjaxLoadingPanel1" />
                        <telerik:AjaxUpdatedControl ControlID="litDebug" LoadingPanelID="RadAjaxLoadingPanel1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
 
                <telerik:AjaxSetting AjaxControlID="btnSubmit">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="litRslt" LoadingPanelID="RadAjaxLoadingPanel1" />
                        <telerik:AjaxUpdatedControl ControlID="litDebug" LoadingPanelID="RadAjaxLoadingPanel1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
 
            </AjaxSettings>
        </telerik:RadAjaxManager>
    </form>
</body>
</html>

 

Imports Telerik.Web.UI
Imports System.Web.UI.WebControls
Imports System.Drawing
Imports System.Linq
Imports Newtonsoft.Json
 
Partial Class Page_TelerikDemoStandAlone
    Inherits System.Web.UI.Page
 
 
    Protected Sub Page_PreInit(sender As Object, e As EventArgs) Handles Me.PreInit
    End Sub
 
    Private Sub Page_Init(sender As Object, e As EventArgs) Handles Me.Init
        If Not IsPostBack Then
            ViewState("datasBag") = ""
        End If
    End Sub
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
        If Not IsPostBack Then
            lbxItems_GatDatas()
            cbxSizeBox_GatDatas()
        End If
    End Sub
 
    ' lbxItems ///////////////////////////////////////////////////////////
    Private Sub lbxItems_GatDatas()
        lbxItems.Items.Clear()
        lbxItems.ClearSelection()
 
        Dim isa As New itemStandAlone
        Try
            If isa.getItems() Then
                Dim itemValue As String = "", itemText As String = "", itemTooltip As String = "", itemEnabled As Boolean = False
 
                For i As Integer = 0 To isa.DT.Rows.Count - 1
                    Dim idI As Integer = CInt(isa.DT.Rows(i)("id"))
                    Dim titleI As String = Trim(isa.DT.Rows(i)("label").ToString() & "")
                    Dim valueI As String = Trim(isa.DT.Rows(i)("value").ToString() & "")
 
                    itemValue = valueI
                    itemText = titleI
                    itemEnabled = True
                    itemTooltip = idI & ";" & titleI & ";" & valueI & ";"
 
                    Dim rlbi As New RadListBoxItem
                    rlbi.Value = itemValue
                    rlbi.Text = itemText
                    rlbi.ToolTip = itemTooltip
                    rlbi.Enabled = itemEnabled
                    lbxItems.Items.Add(rlbi)
                    rlbi = Nothing
 
                Next
                lbxItems.Enabled = True
            Else
                lbxItems.Enabled = False
                litDebug.Text &= "itemStandAlone.getItems() : no items"
            End If
        Catch ex As Exception
            lbxItems.Enabled = False
            litDebug.Text &= ex.ToString()
        End Try
        'isa.Dispose()
        isa = Nothing
    End Sub
 
    Protected Sub lbxItems_Dropped(ByVal sender As Object, ByVal e As RadListBoxDroppedEventArgs)
        Dim debug As String = ""
        Dim datasTxt As String = "", emptyTxt As String = "", errorTxt As String = "error"
        Dim selectedCtrl As New Object
 
        Try
            For Each item As RadListBoxItem In e.SourceDragItems
                If item.Value.ToString <> "" Then
                    datasTxt = item.Value.ToString
                End If
            Next
 
            If (TypeOf pnlMaper.FindControl(e.HtmlElementID) Is Telerik.Web.UI.RadTextBox) Then
                selectedCtrl = DirectCast(pnlMaper.FindControl(e.HtmlElementID), Telerik.Web.UI.RadTextBox)
            ElseIf tbxTester.ClientID = e.HtmlElementID Then
                selectedCtrl = DirectCast(tbxTester, Telerik.Web.UI.RadTextBox)
            End If
 
            If (datasTxt <> "") Then
                If selectedCtrl IsNot Nothing Then
                    selectedCtrl.Text = datasTxt
                Else
                    debug &= "selectedCtrl Is Nothing !!! <br/>"
                    debug &= "pnlMaper.FindControl(e.HtmlElementID).ClientID : " & pnlMaper.FindControl(e.HtmlElementID).ClientID.ToString & "<br/>"
                End If
            Else
                debug &= "datasTxt Is empty !!! <br/>"
            End If
        Catch ex As Exception
            debug &= "Droped() : <br/>" & ex.ToString & "<br/>"
        End Try
 
        litDebug.Text &= debug
    End Sub
 
    ' cbxSizeBox ///////////////////////////////////////////////////////////
    Private Sub cbxSizeBox_GatDatas()
        cbxSizeBox.EmptyMessage = "Select your size ..."
        cbxSizeBox.Items.Insert(0, New RadComboBoxItem("4", 4))
        cbxSizeBox.Items.Insert(1, New RadComboBoxItem("8", 8))
        cbxSizeBox.Items.Insert(2, New RadComboBoxItem("12", 12))
    End Sub
 
    ' GenerateMaper ///////////////////////////////////////////////////////////
    Private Sub GenerateMaper(x As Integer, y As Integer)
        Dim gTxt As Telerik.Web.UI.RadTextBox
 
        Try
            pnlMaper.Controls.Add(New LiteralControl("<table id='gridBoxes' cellspacing='0' cellpadding='0'>"))
            For i = 1 To x
                pnlMaper.Controls.Add(New LiteralControl("<tr>"))
                For j = 1 To y
                    pnlMaper.Controls.Add(New LiteralControl("<td>"))
                    gTxt = New Telerik.Web.UI.RadTextBox
                    gTxt.ID = "boxCase_" & i.ToString & "x" & j.ToString
                    gTxt.Attributes.Add("datas-positions-x", i)
                    gTxt.Attributes.Add("datas-positions-y", j)
                    gTxt.Attributes.Add("datas-value", 0)
 
                    pnlMaper.Controls.Add(gTxt)
                    controlBag.Add(gTxt.ID.ToString, gTxt)
                    pnlMaper.Controls.Add(New LiteralControl("</td>"))
                Next
                pnlMaper.Controls.Add(New LiteralControl("</tr>"))
            Next
            pnlMaper.Controls.Add(New LiteralControl("</table>"))
 
            SetDatasBag_ViewState()
        Catch ex As Exception
            litDebug.Text = ex.ToString()
        End Try
    End Sub
 
    ' datasbag ///////////////////////////////////////////////////////////
    Protected controlBag As New Dictionary(Of String, Control)
    Private Function GetDatasBag() As String
        Dim output As String = ""
 
        Try
            If ViewState("datasBag") IsNot Nothing Then
                output = ViewState("datasBag")
            End If
        Catch ex As Exception
            output &= ex.ToString & "<br/>"
        End Try
 
        Return output
    End Function
 
    Private Function SetDatasBag_ViewState(Optional debug As Boolean = False) As Boolean
        Dim output As Boolean = False, outputDatas As String = "", _dbg As String = ""
 
        Try
            Dim dt As New DataTable
            dt.Columns.Add("id", GetType(Integer))
            dt.Columns.Add("x", GetType(String))
            dt.Columns.Add("y", GetType(String))
            dt.Columns.Add("val", GetType(String))
 
            Dim i As Integer = 0
            For Each ctrl In controlBag
                i += 1
                If TypeOf ctrl.Value Is Telerik.Web.UI.RadTextBox Then
                    Dim gTxt As Telerik.Web.UI.RadTextBox = DirectCast(ctrl.Value, Telerik.Web.UI.RadTextBox)
                    Dim x As String = gTxt.Attributes("datas-positions-x").ToString(), y As String = gTxt.Attributes("datas-positions-y").ToString(), val As String = gTxt.Attributes("datas-value").ToString()
                    dt.Rows.Add(i, x, y, val)
 
                    If (debug) Then
                        _dbg &= "id:" & i & ";"
                        _dbg &= "x:" & x & ";"
                        _dbg &= "y:" & y & ";"
                        _dbg &= "val:" & val & ";"
                        _dbg &= "<br/>"
                    End If
                End If
            Next
 
            outputDatas = JsonConvert.SerializeObject(dt)
            output = (outputDatas <> "")
            If (output) Then
                ViewState("datasBag") = outputDatas
            End If
 
        Catch ex As Exception
            _dbg &= ex.ToString & "<br/>"
        End Try
 
        If (_dbg <> "") Then
            litDebug.Text = "SetDatasBag_ViewState : " & _dbg
        End If
 
        Return output
    End Function
 
 
    ' controllers ///////////////////////////////////////////////////////////
    Protected Sub btnSubmit_Click(sender As Object, e As EventArgs) Handles btnSubmit.Click
        litRslt.Text = GetDatasBag()
    End Sub
 
    Private Sub cbxSizeBox_SelectedIndexChanged(sender As Object, e As RadComboBoxSelectedIndexChangedEventArgs) Handles cbxSizeBox.SelectedIndexChanged
        If (IsNumeric(e.Value)) Then
            GenerateMaper(e.Value, e.Value)
        End If
    End Sub
 
End Class
 
' itemStandAlone //////////////////////////////////////////////////////
Public Class itemStandAlone
    Implements IDisposable
 
    Public Sub Dispose() Implements IDisposable.Dispose
        DT.Clear()
        DT = Nothing
        GC.SuppressFinalize(Me)
    End Sub
 
    Public DT As New DataTable
    Public Function getItems() As Boolean
        Dim output As Boolean = False
 
        DT.Columns.Add("id", GetType(Integer))
        DT.Columns.Add("label", GetType(String))
        DT.Columns.Add("value", GetType(String))
 
        For i = 1 To 24
            DT.Rows.Add(i, "LABEL (" & i.ToString & ")", "V" & i.ToString)
        Next
 
        If DT.Rows.Count > 0 Then
            output = True
        End If
 
        Return output
    End Function
End Class

 

 

Nuwea
Top achievements
Rank 1
 asked on 18 Jun 2020
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?