Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
1.1K+ views

I'm using RadGrid (it looks great!). The grid contains a few columns of data, including a non-visible column that contains each record's database ID. The last column contains a Button. It is going to be a custom Delete button --  it has to do some other things as well, so I can't just use the built-in delete button.

 My question is, how do I pass the row's ID value to my function for a button click? I'm not sure how to grab and pass that value.

Viktor Tachev
Telerik team
 answered on 02 Oct 2015
2 answers
187 views

Hello,

 I have a radgrid in Batch Edit mode that I want to perform some validation on before postback. This worked for me just fine when the grid was one level (no children), but if I want to add a second level to the hierarchy (one child) then the validation causes code errors.

 This seems to come from SaveAllHierarchyLevels="true". When this is true, it causes the args.set_cancel(true) in the validation step to create issues if the same line is edited and fixed after failing validation, then saved. I believe it has something to do with the differences between the BatchEdit command and the GlobalBatchEdit command.

 Is there something I need to do to implement client-side GlobalBatchEdit validation specifically, that is not part of BatchEdit validation?

function ValidateCommand(sender, args) {
            var failed = false;
            var indic = "";
            //alert(totals[0] + " " + totals[1] + " " + totals[2] + " " + totals[3] + " " + totals[4] + " " + totals[5] + " " + totals[6]);
            checksum();
            for (var i = 0; i < 7; i++) {
                if (totals[i] > 24.0) {
                    failed = true;
                    indic += "Too much time entered! Cannot have more than 24 hours per day. \n";
                    break;
                }
            }
  
            var radGrid = $find('<%= WeeklyTimeGrid.ClientID %>');
            var batchManager = radGrid.get_batchEditingManager();
            var masterTable = radGrid.get_masterTableView();
            var rows = masterTable.get_dataItems();
            var size = rows.length;
  
            for (i = 0; i < size; i++) {
                var s = masterTable.getCellByColumnUniqueName(rows[i], "Phase");
                //alert("(" + s.innerText.trim() + ")");
                if (s.innerText.trim() == "") {
                    indic += "Phase code is required!\n";
                    failed = true;
                    break;
                }
            }
  
            //alert(failed + " " + args.get_commandName() + " " + args.get_commandArgument());
            if (failed && args.get_commandName() == "BatchEdit") { //<--Becomes 'GlobalBatchEdit'
                args.set_cancel(true);
                alert(indic);
            }
        }

protected void WeeklyTimeGrid_BatchEditCommand(object sender, GridBatchEditingEventArgs e)
        {
            string a = _BatchID; //refresh batch info from db
 
            SavedChangesList.Visible = true;
 
            //If the batch is locked...
            if (readyToExport != 0 || hasBeenExported != 0)
            {
                //...don't do anything
                e.Canceled = true;
                NotifyUser("The batch was locked by another user, or has been exported");
                if (WeeklyTimeGrid.Enabled)
                {
                    ToggleBatchLock();
                }
 
                return;
            }
 
            foreach (GridBatchEditingCommand c in e.Commands)
            {//Here is where GlobalBatchEdit fails and BatchEdit is fine (after failing validation once, then correcting and saving)
                if (c.Item == null)
                {
                    c.Canceled = true;
                    NotifyUser("There was an error updating time, please try again. If the problem persists, please contact IT.");
                }
            }
 
            UpdateSelectedEmpTime(e.Commands);
        }

Maria Ilieva
Telerik team
 answered on 02 Oct 2015
5 answers
548 views

Hello all,

I am using ComboBox with multi check box and Filter option. I would like to know how can I get text which i gave in input area (for filtering) in code behind.

 

For example, if i have a combobox which shows all the countries -> typed "Ge" input area. Then menu/option in the dropdown with filter accordingly.

Now my requirment is How will i get the string "Ge" in code behind (in any event) and i prefer to do this code behind rather JS.

 

I hope this makes sense and looking forward for its solution...

 

Thankz

Ivan Danchev
Telerik team
 answered on 02 Oct 2015
15 answers
175 views
Hello,

How do I add the support for vertical scrolling of the dropdown menu to RadToolBarDropDown like you have in your RadMenu component?

Regards.
Marin Bratanov
Telerik team
 answered on 02 Oct 2015
1 answer
135 views

Hello Stamo and others,

Is it possible to bind the marker size to a value like a count within the data source?  Or will we have to programmatically create the ScatterSeriesItem and set the marker size within code?  Or can we databind the scatter series items then iterate over the items (after binding) and set the marker size for each item in code?

Thanks in advance,
Bob Baldwin
Trabon Solutions

Danail Vasilev
Telerik team
 answered on 02 Oct 2015
1 answer
536 views

Hi Telerik team,

 

I am trying to filter date column on my radgrid by the following RadDatePicker:

<label>Start Date:</label>
        </div>
                                        <telerik:RadDatePicker ID="RadDatePicker1" Runat="server" AutoPostBack="True" Culture="en-ZA" MinDate="2015-01-01" SelectedDate="2015-01-01" Skin="BlackMetroTouch">
<Calendar UseRowHeadersAsSelectors="False" UseColumnHeadersAsSelectors="False" EnableWeekends="True" FastNavigationNextText="&amp;lt;&amp;lt;" Skin="BlackMetroTouch"></Calendar>

<DateInput DisplayDateFormat="yyyy/MM/dd" DateFormat="yyyy/MM/dd" LabelWidth="40%" AutoPostBack="True" DisplayText="2015/01/01" SelectedDate="2015-01-01" value="2015/01/01">
<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>
</DateInput>
<DatePopupButton ImageUrl="" HoverImageUrl=""></DatePopupButton>
            </telerik:RadDatePicker>
        <div class="form-group">
        <label>End Date</label>
            </div>

                            <telerik:RadDatePicker ID="RadDatePicker2" Runat="server" AutoPostBack="True" Culture="en-ZA" MinDate="2015-01-01" SelectedDate="2015-01-01" Skin="BlackMetroTouch">
<Calendar UseRowHeadersAsSelectors="False" UseColumnHeadersAsSelectors="False" EnableWeekends="True" FastNavigationNextText="&amp;lt;&amp;lt;" Skin="BlackMetroTouch"></Calendar>

<DateInput DisplayDateFormat="yyyy/MM/dd" DateFormat="yyyy/MM/dd" LabelWidth="40%" AutoPostBack="True" DisplayText="2015/01/01" SelectedDate="2015-01-01" value="2015/01/01">
<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>
</DateInput>

 And the following is my RadGrid:

 

<telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="SqlSalesReport" Skin="BlackMetroTouch" AllowFilteringByColumn="True">
                <MasterTableView  EnableHierarchyExpandAll="true" AutoGenerateColumns="False" DataSourceID="SqlSalesReport" DataKeyNames="Vin">
                    <DetailTables>
                        <telerik:GridTableView  EnableHierarchyExpandAll="true" runat="server" DataSourceID="SqlParts" DataKeyNames="Vin" AutoGenerateColumns="False" AllowFilteringByColumn="False">
                            <ParentTableRelation>
                                <telerik:GridRelationFields DetailKeyField="Vin" MasterKeyField="Vin" />
                            </ParentTableRelation>
                                <Columns>
                                    <telerik:GridBoundColumn SortExpression="PartNumber" HeaderText="Part Number" HeaderButtonType="TextButton"
                                        DataField="PartNumber" UniqueName="PartNumber">
<ColumnValidationSettings>
<ModelErrorMessage Text=""></ModelErrorMessage>
</ColumnValidationSettings>
                           
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn SortExpression="CaptureDate" HeaderText="Capture Date" HeaderButtonType="TextButton"
                                        DataField="CaptureDate" UniqueName="CaptureDate"  DataFormatString="{0:D}">
                                    <ColumnValidationSettings>
                                    <ModelErrorMessage Text=""></ModelErrorMessage>
                                    </ColumnValidationSettings>
                                        <FilterTemplate>
                            From
                        <telerik:RadDatePicker ID="FromOrderDatePicker" runat="server" Width="140px" ClientEvents-OnDateSelected="FromDateSelected"
                            MinDate="07-04-1996" MaxDate="05-06-1998" FocusedDate="07-04-1996" DbSelectedDate='<%# startDate %>' />
                            to
                        <telerik:RadDatePicker ID="ToOrderDatePicker" runat="server" Width="140px" ClientEvents-OnDateSelected="ToDateSelected"
                            MinDate="07-04-1996" MaxDate="05-06-1998" FocusedDate="05-06-1998" DbSelectedDate='<%# endDate %>' />
                            <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
                                <script type="text/javascript">
                                    function FromDateSelected(sender, args) {
                                        var tableView = $find("<%# TryCast(Container,GridItem).OwnerTableView.ClientID %>");
                                        var ToPicker = $find('<%# TryCast(Container, GridItem).FindControl("ToOrderDatePicker").ClientID %>');

                                        var fromDate = FormatSelectedDate(sender);
                                        var toDate = FormatSelectedDate(ToPicker);

                                        tableView.filter("CaptureDate", fromDate + " " + toDate, "Between");

                                    }
                                    function ToDateSelected(sender, args) {
                                        var tableView = $find("<%# TryCast(Container,GridItem).OwnerTableView.ClientID %>");
                                        var FromPicker = $find('<%# TryCast(Container, GridItem).FindControl("FromOrderDatePicker").ClientID %>');

                                        var fromDate = FormatSelectedDate(FromPicker);
                                        var toDate = FormatSelectedDate(sender);

                                        tableView.filter("CaptureDate", fromDate + " " + toDate, "Between");
                                    }
                                    function FormatSelectedDate(picker) {
                                        var date = picker.get_selectedDate();
                                        var dateInput = picker.get_dateInput();
                                        var formattedDate = dateInput.get_dateFormatInfo().FormatDate(date, dateInput.get_displayDateFormat());

                                        return formattedDate;
                                    }
                                </script>
                            </telerik:RadScriptBlock>
                        </FilterTemplate>
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn SortExpression="Quantity" HeaderText="Quantity" HeaderButtonType="TextButton"
                                        DataField="Quantity" UniqueName="Quantity">
<ColumnValidationSettings>
<ModelErrorMessage Text=""></ModelErrorMessage>
</ColumnValidationSettings>
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn SortExpression="PartSoldPrice" HeaderText="Part Sold Price" HeaderButtonType="TextButton"
                                        DataField="PartSoldPrice" UniqueName="PartSoldPrice"  DataFormatString="{0:C}">
<ColumnValidationSettings>
<ModelErrorMessage Text=""></ModelErrorMessage>
</ColumnValidationSettings>
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn SortExpression="TotalPrice" HeaderText="Total Price" HeaderButtonType="TextButton"
                                        DataField="TotalPrice" UniqueName="TotalPrice"  DataFormatString="{0:C}">
                                            <ColumnValidationSettings>
                                            <ModelErrorMessage Text=""></ModelErrorMessage>
                                            </ColumnValidationSettings>
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn SortExpression="Commission" HeaderText="Commission" HeaderButtonType="TextButton"
                                        DataField="Commission" UniqueName="Commission"  DataFormatString="{0:C}">
<ColumnValidationSettings>
<ModelErrorMessage Text=""></ModelErrorMessage>
</ColumnValidationSettings>
                                    </telerik:GridBoundColumn>
                                </Columns>
                        </telerik:GridTableView>
                    </DetailTables>
                    <Columns>
                        <telerik:GridBoundColumn DataField="Vin" FilterControlAltText="Filter Vin column" HeaderText="Vin" SortExpression="Vin" UniqueName="Vin">
                            <ColumnValidationSettings>
                                <ModelErrorMessage Text="" />
                            </ColumnValidationSettings>
                        </telerik:GridBoundColumn>
                    </Columns>
                </MasterTableView>
            </telerik:RadGrid>​

 Note: i dont want to use the radgrid template i want to use the first two RadDatePickers to filter inside the radgrid.

 

thanks

 

 

 

Eyup
Telerik team
 answered on 02 Oct 2015
3 answers
147 views

If I use a SplitButton inside of a Menu when creating my xml to load in to the ASP.NET RibbonBar, it does not place the SplitButton buttons in any kind of dropdown.  It places them at the same level of Menu.  Here is the XML:

 <?xml version="1.0"?>
<RibbonBar>
<ApplicationMenu Text="Home">
<ApplicationMenuItem Text="Item1" />
</ApplicationMenu>
<Tab Text="Tab1" Size="Small" ImageUrl="/Images/Image1.png">
<Group Text="Group1">
<Button Text="Button1" Size="Large" ImageUrl="/Images/Image2.png" />
<Menu Text="A Menu" Size="Medium" ImageUrl="/Images/Image3.png">
<MenuItem Text="MenuItem1" Size="Large" ImageUrl="/Images/Image4.png"></MenuItem>
<SplitButton Text="SplitButton" Size="Large" ImageUrl="/Images/Image5.png" ImageUrlLarge="/Images/Image5.png">
<Button Text="SplitButton_Button1" Size="Medium" ImageUrl="/Images/Image6.png" />
</SplitButton>
</Menu>
</Group>
</Tab>
</RibbonBar>

 

Bozhidar
Telerik team
 answered on 02 Oct 2015
13 answers
198 views

In the attached screen shot, you will notice there is a gray area to the left of each of the child menu items.

How do I get rid of that gray area so it shows all white background for all the child menu items?

 

Ivan Danchev
Telerik team
 answered on 02 Oct 2015
1 answer
120 views

    With RadGrid I frequently use a SQL data source which returns data columns with "display=false" so that I can use a value for inclusion in a templated column. Typically this is for purposes of building a hyperlink with a client-friendly display value, but with a database code for the querystring.

 "<a href='whatever.aspx?id=category_code>category_name</a>

When using HTML Pie Chart, I know how to retrieve the values of "DataFieldY" and "Name_Field".

The "NameField" is my "category_name" but when clicked, I really want "category_code", i.e. a value known to the underlying data source but not displayed on the chart itself.

Any suggestions on a potential solution?

Note that I could do I reverse lookup back into the database, but there are cases where we trim long  "Name_Field" values to avoid messing up chart presentation.

Marin Bratanov
Telerik team
 answered on 02 Oct 2015
4 answers
185 views
Hello,
I need to get the count of details tables added in the radgrid..not the count of row
thanks..
Irving
Top achievements
Rank 2
 answered on 02 Oct 2015
Narrow your results
Selected tags
Tags
+? more
Top users last month
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?