Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
184 views
My grid has a template column that contains a radtextbox.  On postback, I want to obtain the value within each radtextbox but it is always returning blank values.  I have the radtextbox in the ItemTemplate, not the EditItemTemplate.  Do I need to do this from an EditItemTemplate and place every row in EditMode?  

Note that the function of the grid is a questionnaire so we want every textbox to be available when the page loads.  We don't want any edit/update links.  

<telerik:RadGrid ID="gvwTextQuestions" runat="server" Width="950px" AutoGenerateColumns="False" DataSourceID="sqlQuestions">
               <MasterTableView EditMode="InPlace" DataKeyNames="QuestionID" CommandItemDisplay="Top" DataSourceID="sqlQuestions">
                   <CommandItemTemplate>
                       <div style="padding-top: 10px; padding-bottom: 10px; padding-left: 10px;">
                           <asp:Label ID="lblHeader" runat="server" Text=""></asp:Label>
                       </div>
                   </CommandItemTemplate>
                   <CommandItemSettings ShowAddNewRecordButton="False" ShowRefreshButton="False"></CommandItemSettings>
                   <Columns>
                       <telerik:GridBoundColumn DataField="QuestionID" Visible="False" UniqueName="QuestionID" FilterControlAltText="Filter QuestionID column"></telerik:GridBoundColumn>
                       <telerik:GridBoundColumn FilterControlAltText="Filter QuestionNumber column" UniqueName="QuestionNumber" DataField="QuestionNumber">
                           <ItemStyle HorizontalAlign="Center" />
                       </telerik:GridBoundColumn>
                       <telerik:GridBoundColumn DataField="Question" UniqueName="Question" FilterControlAltText="Filter Question column"></telerik:GridBoundColumn>
                       <telerik:GridBoundColumn DataField="Required" FilterControlAltText="Filter Required column" UniqueName="Required" Visible="False">
                       </telerik:GridBoundColumn>
                       <telerik:GridTemplateColumn FilterControlAltText="Filter ResponseText column" UniqueName="ResponseText">
                           <ItemTemplate>
                               <telerik:RadTextBox ID="txtResponseText" Runat="server" Columns="90" Rows="6" TextMode="MultiLine" Width="700px">
                               </telerik:RadTextBox>
                           </ItemTemplate>
                           <ItemStyle HorizontalAlign="Left" />
                       </telerik:GridTemplateColumn>
                   </Columns>
               </MasterTableView>
           </telerik:RadGrid>
Eyup
Telerik team
 answered on 10 Feb 2015
27 answers
2.2K+ views
I'm working on creating an asp.net user control that contains a RadGrid.  Within the user control I want to define the columns in the RadGrid at runtime.  When the grid loads, if the page is not a postback, I generate and add the required columns to the grid.  So far this works as expected.  When the page displays the appropriate columns are visible.  However, when a postback occurs (paging, sorting, etc...) some of the column structure is lost.  For example, when I click on one of the column headers to sort the column, a postback occurs and when the page refreshes on the screen the column header text for every column is blank and the data is not sorted.  Another issue is that when I click the next page button, the postback occurs, the page changes but again the header text for every column is missing and the data in each cell shows "System.Data.DataRowView".  In some of my debugging I've found that when the page posts back on a page index change, each of the GridBoundColumn objects in the grid have lost their DataField property value and the HeaderText property value.  They do however keep their UniqueName property value.

Am I missing somthing to insure that these columns maintain their state upon postback?
Eyup
Telerik team
 answered on 10 Feb 2015
1 answer
171 views
Hello Team,

We are using Rad grid with Form template  edit form, we need to place Radio button list with 2 options "Male" and "Female" for gender inside FormTemplate.

Please find Error below:
 
Uncaught Sys.WebForms.PageRequestManagerServerErrorException: Sys.WebForms.PageRequestManagerServerErrorException: 'rbtGender' has a SelectedValue which is invalid because it does not exist in the list of items.<br>Parameter name: value


Code below:
<telerik:RadGrid ID="rgDemoRestrictedTests" runat="server" CssClass="RadGrid" GridLines="None" AllowPaging="True" PageSize="20" AllowSorting="True"
                                                      AutoGenerateColumns="false" ShowStatusBar="true" AllowAutomaticDeletes="True" AllowAutomaticInserts="True" AllowAutomaticUpdates="True"
                                                      DataSourceID="DemoRestrictedTestsSource" OnItemDeleted="rgDemoRestrictedTests_ItemDeleted" OnItemInserted="rgDemoRestrictedTests_ItemInserted"
                                                      OnItemUpdated="rgDemoRestrictedTests_ItemUpdated" OnItemCommand="rgDemoRestrictedTests_ItemCommand">
                                                      <MasterTableView CommandItemDisplay="Bottom" DataSourceID="DemoRestrictedTestsSource" DataKeyNames="TestID">
                                                          <Columns>
                                                              <telerik:GridBoundColumn UniqueName="TestID" HeaderText="TestID" DataField="TestID">
                                                              </telerik:GridBoundColumn>
                                                              <telerik:GridBoundColumn UniqueName="Gender" HeaderText="Gender" DataField="Gender">
                                                              </telerik:GridBoundColumn>                                                          
                                                              <telerik:GridEditCommandColumn HeaderText="Edit">
                                                              </telerik:GridEditCommandColumn>
                                                              <telerik:GridButtonColumn CommandName="Delete" Text="Delete" HeaderText="Delete">
                                                              </telerik:GridButtonColumn>
                                                          </Columns>
                                                          <EditFormSettings EditFormType="Template">
                                                              <FormTemplate>
                                                                  <table id="Table2" cellspacing="2" cellpadding="1" width="100%" border="0" rules="none"
                                                                      style="border-collapse: collapse;">
                                                                      <tr>
                                                                          <td>
                                                                              <table id="Table3" width="450px" border="0" class="module">
                                                                                  <tr>
                                                                                      <td style="text-align: center;">TestID :
                                                                                      </td>
                                                                                      <td>
                                                                                          <asp:DropDownList ID="rddlTestID" runat="server" SelectedValue='<%#  Bind("TestID")  %>'
                                                                                              DataSourceID="rddlTestIDSource" DataTextField="TestID" DataValueField="TestID" AppendDataBoundItems="True">
                                                                                              <asp:ListItem Selected="True" Text="Select" Value="">
                                                                                              </asp:ListItem>
                                                                                          </asp:DropDownList>
 
                                                                                      </td>
                                                                                  </tr>
                                                                                  <tr>
                                                                                      <td style="text-align: center;">Gender :
                                                                                      </td>
                                                                                      <td>
                                                                                          <asp:RadioButtonList runat="server" ID="rbtGender" RepeatDirection="Horizontal" DataValueField="Gender" SelectedValue='<%#  Bind("Gender") %>'>
                                                                                              <asp:ListItem Text="Male" Value="Male" Selected="True"></asp:ListItem>
                                                                                              <asp:ListItem Text="Female" Value="Female"></asp:ListItem>
                                                                                          </asp:RadioButtonList>
                                                                                      </td>
                                                                                  </tr>                                                                                 
 
                                                                              </table>
                                                                          </td>
                                                                      </tr>
                                                                      <tr>
                                                                          <td colspan="2"></td>
                                                                      </tr>
                                                                      <tr>
                                                                          <td></td>
                                                                          <td></td>
                                                                      </tr>
                                                                      <tr>
                                                                          <td align="rifht" colspan="2">
                                                                              <asp:Button ID="btnUpdate" Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>'
                                                                                  runat="server" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>'></asp:Button
                                                                       <asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False" CommandName="Cancel"></asp:Button>
                                                                          </td>
                                                                      </tr>
                                                                  </table>
                                                              </FormTemplate>
                                                          </EditFormSettings>
                                                      </MasterTableView>                                                     
                                                  </telerik:RadGrid>
                                              </telerik:RadPageView>
<asp:SqlDataSource runat="server" ID="DemoRestrictedTestsSource" ConnectionString="x" ProviderName="System.Data.SqlClient"
                                          SelectCommand="Select [TestID], (case when [Gender] = 0 then 'Male' else 'Female' end) as [Gender] From [TestUtil_DemoRestrictedTests]"
                                          InsertCommand="Insert Into [TestUtil_DemoRestrictedTests] Values ('@TestID', (case when @Gender = 'Male' then 1 else 0 end))"
                                          UpdateCommand="Update [TestUtil_DemoRestrictedTests] Set [Gender] = (case when @Gender = 'Male' then 0 else 1 end) Where [TestID] = @TestID"
                                          DeleteCommand="DELETE FROM [TestUtil_DemoRestrictedTests] WHERE [TestID] = @TestID">
                                          <InsertParameters>
                                              <asp:Parameter Name="TestID" Type="String" />
                                              <asp:Parameter Name="Gender" Type="String" />                                             
                                          </InsertParameters>
                                          <UpdateParameters>
                                              <asp:Parameter Name="Gender" Type="string" />                                           
                                              <asp:Parameter Name="TestID" Type="String" />
                                          </UpdateParameters>
                                          <DeleteParameters>
                                              <asp:Parameter Name="TestID" Type="String" />
                                          </DeleteParameters>
                                      </asp:SqlDataSource>


Can anyone help me out with this error?

Thanks in advance.

Regards,
Ruchi Patel
Eyup
Telerik team
 answered on 10 Feb 2015
1 answer
1.1K+ views
Hi

How to use custom filter in telerik radgrid  using C# Code no need svc and Datasource 

Eyup
Telerik team
 answered on 10 Feb 2015
1 answer
129 views
The following problem happens when using IE11. I haven't been able to recreate the issue with Firefox and Chrome. 

1. Use the Editor demo page and the HTML below. 
2. Switch to design mode and right click either table...select table properties.

The version on your demo page currently places the edited table inside the table below it. I'm currently using version 2014.2.724.45...for me it deletes the table when the Table Properties dialog is closed. 

This doesn't happen with all tables...and for the most part editing tables works as expected in IE11. The HTML below is an example of what can cause the problem.

<table style="width: 746px; height: 274px;">
    <tbody>
        <tr>
            <td style="text-align: center; vertical-align: top;">

                <a href="#0" tabindex="-1">
                    <img alt="" style="border-width: 3px; border-style: solid; margin-right: 0px; vertical-align: top;" src="0.jpg" />
                </a>
                <br />
                Number 0<br />
                Title
            </td>

            <td style="text-align: center; vertical-align: top;"><a href="#1" tabindex="-1">
                <img alt="" style="border-width: 3px; border-style: solid; margin-right: 0px; vertical-align: top;" src="1.jpg" /></a><br />
                Number 1<br />
                Title </td>
            <td style="text-align: center; vertical-align: top;"><a href="#2" tabindex="-1">
                <img alt="" style="border-width: 3px; border-style: solid; margin-right: 0px; vertical-align: top;" src="2.jpg" /></a><br />
                Number 2<br />
               Title</td>
            <td style="text-align: center; vertical-align: top;"><a href="#3" tabindex="-1">
                <img alt="" style="border-width: 3px; border-style: solid; margin-right: 0px; vertical-align: top;" src="3.jpg" /></a><br />
                Number 3<br />
                Title</td>
            <td style="text-align: center; vertical-align: top;"><a href="#4" tabindex="-1">
                <img alt="" style="border-width: 3px; border-style: solid; margin-right: 0px; vertical-align: top;" src="4.jpg" /></a><br />
                Number 4<br />
                Title</td>
            <td style="text-align: center; vertical-align: top;"><a href="#5" tabindex="-1" target="_self">
                <img alt="" style="border-width: 3px; border-style: solid; width: 125px; height: 175px; margin-left: 0px; vertical-align: top;" src="5.jpg" /></a><br />
                Number 5<br />
        </tr>
    </tbody>
</table>
<hr />
<table style="width: 695px; height: 726px;">
    <tbody>
        <tr>
            <td style="text-align: center; vertical-align: top;"><a href="#10" tabindex="-1">
                <img alt="" style="border-width: 3px; border-style: solid; vertical-align: top;" src="10.jpg" /></a>10<br />
                Number 10<br />
                Title 2</td>
            <td style="text-align: center; vertical-align: top;"><a href="#11" tabindex="-1">
                <img alt="" style="border-width: 3px; border-style: solid; vertical-align: top;" src="11.jpg" /></a>11<br />
                Number 11<br />
                Title 2</td>
            <td style="text-align: center; vertical-align: top;"><a href="#12" tabindex="-1">
                <img alt="" style="border-width: 3px; border-style: solid; vertical-align: top;" src="12.jpg" /></a>12<br />
                Number 12
                <br />
                Title 2</td>
            <td style="text-align: center; vertical-align: top;"><a href="#13" tabindex="-1" target="_self">
                <img alt="" style="border-width: 3px; border-style: solid; vertical-align: top;" src="13.jpg" /></a>13<br />
                 Number 13 <br />
               Title2 </td>
            <td style="text-align: center; vertical-align: top;"><a href="#14" tabindex="-1">
                <img alt="" style="border-width: 3px; border-style: solid; vertical-align: top;" src="14.jpg" /></a><br />
                Number 14<br />
                Title 2
                <br />
                Title</td>
            <td style="text-align: center; vertical-align: top;">
                <img alt="" style="border-width: 3px; border-style: solid; width: 125px; height: 176px; vertical-align: top;" src="15.JPG" /><br />
                Number 15<br />
                Title</td>
        </tr>

    </tbody>
</table>

Ianko
Telerik team
 answered on 10 Feb 2015
1 answer
57 views
Hello Folks,

we are having trouble with a specific constellation of the Grid Batch Edit Mode and Read Only Textfields (Gridbound Textcolumns).
Im blocking the Batcheditmode in the OnBatchEditOpening event and with modern browsers everything works as expected.

Though with IE 9 and IE 8 in Compatiblity Mode, we are having issues.

CSS wise, the fields are blocked and readonly, but unfortunatly the user is still able to enter text. Is there any known workaround?
The code is used in a SharePoint Webpart, hence changing the Documentmode is not a viable solution.

We are using the latest 2014 Release: 2014.3.1209.35
Maria Ilieva
Telerik team
 answered on 10 Feb 2015
1 answer
84 views
Hi,

I'm new to  kendo and i was trying to display a treeView using the ASP MVC approach so i followed the exemple you provided :

var employees = from e in db.Employees
                            where (id.HasValue ? e.ReportsTo == id : e.ReportsTo == null)
                            select new
                            {
                                id = e.id,
                                Name = e.FirstName + " " + e.LastName,
                                hasChildren = e.Employees1.Any()
                            };

My question is:  where the Employees1 comes from ? (I guess from the model) but what is the code inside this function ? where's the recursive function to loop on each child ? Can you provide the model and see what is inside ? 

Thanks
Daniel
Telerik team
 answered on 10 Feb 2015
1 answer
107 views
Hi Team,

I want to create a grid where second column is split to 3 rows. could you please give me the layout aspx how to create.

grid view is attached here. The grid is linked to a db

thanks
Sabitri Mohanty


Pavlina
Telerik team
 answered on 10 Feb 2015
1 answer
64 views
I have an OpenAccessLinqDataSource that pulls from some FK linked tables. The FK value is nullable (UInt32?) and while sorting works, I'm having some difficulties filtering.

Here's my LinqDataSource
<telerik:OpenAccessLinqDataSource ID="OA_Promos" Runat="server" ContextTypeName="Flow.ST2_Data" EntityTypeName="" OrderBy="ID desc" ResourceSetName="Promos" Select="new (ID, identifier, descriptor, lastUpdated, notes, startDate, endDate, startTime, endTime, priority, Promo_art.Art, Promo_art.width, Promo_art.height, Promo_art.fileName, Promo_topic.SpotID)" Where="Deleted == @Deleted" >
    <WhereParameters>
        <asp:Parameter DefaultValue="0" Name="Deleted" Type="Int16" />
    </WhereParameters>
</telerik:OpenAccessLinqDataSource>

The Promo_topic.SpotID is the column I'm trying to filter on using the following:
<telerik:GridBoundColumn DataField="Promo_topic.SpotID" AllowFiltering="true" SortExpression="SpotID" CurrentFilterFunction="EqualTo" FilterControlAltText="Filter SpotID Column" AutoPostBackOnFilter="true" ShowFilterIcon="False" UniqueName="SpotID" HeaderText="Spot ID" DataType="System.UInt32"></telerik:GridBoundColumn>

but I get 0 results returned when I filter on a valid Promo_topic.SpotID


I tried custom filtering:
<telerik:GridBoundColumn DataField="Promo_topic.SpotID" AllowFiltering="true" SortExpression="SpotID" CurrentFilterFunction="Custom" FilterControlAltText="Filter SpotID Column" AutoPostBackOnFilter="true" ShowFilterIcon="False" UniqueName="SpotID" HeaderText="Spot ID" DataType="System.UInt32"></telerik:GridBoundColumn>

with the following ItemCommand event:
protected void ItemCommandFired(object sender, GridCommandEventArgs e)
{
    if (e.CommandName == RadGrid.FilterCommandName)
    {
        Pair filterPair = (Pair)e.CommandArgument;
        if (filterPair.First.ToString() == "Custom")
        {
            string colName = filterPair.Second.ToString();
            TextBox tbPattern = (e.Item as GridFilteringItem)[colName].Controls[0] as TextBox;
            e.Canceled = true;
            grid_promos.MasterTableView.FilterExpression = string.Format("(Promo_topic.SpotID.Equals({0})) AND (Promo_topic.SpotID != null)", tbPattern.Text);
            grid_promos.Rebind();
        }
    }
}

but then get the error "Methods on type 'UInt32?' are not accessible"

Before I switch the entire DataLinqSource to reference a custom object, is there something I'm doing wrong?

Thanks.
Marin
Telerik team
 answered on 10 Feb 2015
1 answer
213 views
Can you use RadEditor to upload a pdf, like an image,  and then have the pdf display on the screen and not a link?



Ianko
Telerik team
 answered on 10 Feb 2015
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?