Telerik Forums
UI for ASP.NET AJAX Forum
0 answers
105 views
hi telerik,
i am working with radgridview and come to face a strange problem with binding. as i know that the default binding mode is 'one way' and if we want to 'two way' mode we have to explicitly specify it .but in my code which i am posting here,the Daat Element column is working in two way manner without specifying it, while checkbox chkIsActive and textblock txtCategory are requiring to mention mode two way otherwise they are not working well . if i try to provide mode 'two way' to the listbox itemsource and not to its child controls then still it behave like one way. please explian me , such behaviour of controls.  
<telerik:RadGridView Grid.Row="1" Grid.Column="0" x:Name="DECategoryMapping" CanUserReorderColumns="True" CanUserResizeColumns="True" CanUserSortColumns="True" AutoGenerateColumns="False" IsEnabled="True">
  
<telerik:RadGridView.Columns>
  
<telerik:GridViewDataColumn DataMemberBinding="{Binding Path=DENameList}" Header="Data Element"></telerik:GridViewDataColumn>
  
<telerik:GridViewDataColumn UniqueName="CategoryList" Header="Category List" DataMemberBinding="{ Binding Path=DElement.Category}">
  
<telerik:GridViewDataColumn.CellTemplate>
  
<DataTemplate>
  
<telerik:ListBox x:Name="lstCategory" ItemsSource="{Binding Path=Category}">
  
<telerik:ListBox.ItemTemplate>
  
<DataTemplate
  
<StackPanel Orientation="Horizontal">
  
<CheckBox x:Name="chkIsActive" IsChecked="{Binding Path=IsActive, Mode=TwoWay}"></CheckBox>
  
<TextBlock x:Name="txtCategory" Text="{Binding Path=CategoryName, Mode=TwoWay}"></TextBlock>
  
</StackPanel>
  
</DataTemplate>
  
</telerik:ListBox.ItemTemplate>
  
</telerik:ListBox>
  
</DataTemplate>
  
</telerik:GridViewDataColumn.CellTemplate>
  
</telerik:GridViewDataColumn>
  
</telerik:RadGridView.Columns>
  
</telerik:RadGridView>
sonam
Top achievements
Rank 1
 asked on 08 Apr 2011
2 answers
64 views

 

 

Hello I want to filter column in my grid with filtertempalte column including RadComboBox
the code look like this(i have already read the blogs and have seen the demos about filter template)

<
telerik:GridTemplateColumn DataField="Obraz" Visible="false" Resizable="false" UniqueName="TemplateColumn"

 

 

 

AllowFiltering="true">

 

 

 

<FilterTemplate>

 

 

 

<telerik:RadComboBox ID="ComboFilterBox" runat="server" AppendDataBoundItems="true" OnSelectedIndexChanged="FilterCombo_SelectedIndexChanged" DataTextField="Obraz" DataValueField="Obraz"

 

 

 

OnLoad="Combo_NeedDataSource" AutoPostBack="true">

 

 

 

<items>

 

 

 

<telerik:RadComboBoxItem />

 

 

 

</items>

 

 

 

</telerik:RadComboBox>

 

 

 

 

</FilterTemplate>

 

 

 

<ItemTemplate>

 

 

 

<asp:Image ID="Image1" runat="server" ImageUrl="<%# bind('Obraz') %>" ForeColor="White" />

 

 

 

</ItemTemplate>

 

 

 

<HeaderStyle Width="170" />

 

 

 

<ItemStyle Width="170px" />

 

 

 

</telerik:GridTemplateColumn>

and then in Code-Behind I have placed the function

 

 

protected

 

 

void FilterCombo_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e)

 

 

{

 

 

 

 

string filterExpression;

 

 

filterExpression =

 

 

"([Obraz] = '" + e.Value + "')";

 

 

RadGrid1.MasterTableView.FilterExpression = filterExpression;

 

RadGrid1.MasterTableView.Rebind();

 

}

and then when I change the values in combobox i get the error
 Sys.WebForms.PageRequestManagerServerErrorException: Expression expected
after Rebind.
Please help.

Tomasz
Top achievements
Rank 1
 answered on 08 Apr 2011
3 answers
184 views
Hellow

   I Want To Expand First Column Of Detail Tables  in hierarchy Grid On Form Load .












Thanks In Advance
Jayesh Goyani
Top achievements
Rank 2
 answered on 08 Apr 2011
1 answer
105 views

I'm using RadDockLayout control which has two zones (i.e. Zone1 and Zone2), each of which has RadDock with some content.

I want to be able to disable zone1 such that the RadDock in zone one cannot be dragged into or outside this zone, and RadDock in zone2 should not be dragged into zone since it's disabled.

I have tried to use Enabled property of RadDockZone but it does not seem to work.

How can disable a zone such that once data is displayed in the zone via RadDock cannot be manipulated by a user? Anybody??
Rumen
Telerik team
 answered on 08 Apr 2011
1 answer
99 views
hi all,

How to show confirm box when selecting treenode? I have some conditions to check before showing confirm.

thanks
benjamin
Princy
Top achievements
Rank 2
 answered on 08 Apr 2011
5 answers
978 views
Hi telerik,

  I was using telerik version Q3 2007 in my project. now we chenged this to Q3 2008.
i am using rowSelected()  function to get values from grid( client side).  like..

function RowClick(rowObject) // function to display details when click on Mr headers

 

{

 

document.getElementById("ctl00_PlaceHolderMain_inputPONumber").value = this.GetCellByColumnUniqueName (rowObject,"poNumber").innerText ;
}

after changing to Q3 2008 this code is not working. can you tel me instead of this which i can use.?

 

 

Princy
Top achievements
Rank 2
 answered on 08 Apr 2011
1 answer
80 views
hi telerik, all,

I have requirement of a control which shows year and month, not entire days for month. Do you have any suggestion to use which control for this? If not available, any way to accomplish same using available controls?


benjamin
Shinu
Top achievements
Rank 2
 answered on 08 Apr 2011
2 answers
498 views
Hola a todos,

He estado en esto por dos días, pero parece que no puede conseguir que funcione solo una parte jejejejejeje.

Tengo tres Tablas, Tema, Conocimiento y ConocimientoEmpleado de la que el Conocimiento tiene una relación ForeignKey a Tema
y ConocimientoEmpleado tiene una relación ForeignKey a Conocimiento . Lo que quiero lograr es que el mastertableview 
se rellena con los datos de la relacion entre Tema y Conocimiento y cada registro tiene detailtables referencia a sí misma con
los datos de Conocimiento. Pero esto si me funciona, pero ahora quiero q me aparezca otro DetailTableView
con la referencia de los datos de ConocimientoEmpleado. Lo me dice q el IdTema no tiene relacion o q no es un datacolumn, lo que tengo es lo siguiente:

ASPX
 protected void BuscarTablaTema(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
        {
            if (!e.IsFromDetailTable)
            {
                RadGrid1.DataSource = ObtenerDatosTabla("SELECT * FROM Tema");
                RadGrid1.MasterTableView.DataKeyNames = new string[] { "IdConocimiento" };  
            }
        }


        protected void BuscarTablaConocimiento(object source, Telerik.Web.UI.GridDetailTableDataBindEventArgs e)
        {
            GridDataItem dataItem = (GridDataItem)e.DetailTableView.ParentItem;
            switch (e.DetailTableView.Name)
            {
                case 1:
                    {
                        string IdConocimiento = dataItem.GetDataKeyValue("IdConocimiento ").ToString();
                        e.DetailTableView.DataSource = GetDataTable("SELECT * FROM Conocimiento WHERE IdConocimiento = '" + IdConocimiento + "'");
                        break;
                    }


                case 2:
                    {
                        string IdTema= dataItem.GetDataKeyValue("IdTema").ToString();
                        e.DetailTableView.DataSource = GetDataTable("SELECT * FROM ConocimientoEmpleado WHERE IdTema = '" + IdTema +"'");
                        break;
                    }
            }
        }
        
        public DataTable ObtenerDatosTabla(string ConsultarTabla)
{
            String ConnString = ConfigurationManager.ConnectionStrings["IgrupoLogosConnectionString"].ConnectionString;
SqlConnection ConexionTabla = new SqlConnection(ConnString);
            SqlDataAdapter Adaptador = new SqlDataAdapter();
            Adaptador.SelectCommand = new SqlCommand(ConsultarTabla, ConexionTabla);
 
DataTable DatosTabla = new DataTable();


ConexionTabla.Open();
try
{
                Adaptador.Fill(DatosTabla);
}
finally
{
ConexionTabla.Close();
}


return DatosTabla;
}
    }
}


ASPX.CS

<MasterTableView Width="100%"  AllowMultiColumnSorting="True">
                <DetailTables>
                    <telerik:GridTableView DataKeyNames="IdConocimiento" Name="Conocimiento" Width="100%">
                        <DetailTables>
                            <telerik:GridTableView DataKeyNames="IdTema" Name="Tema" Width="100%">
                                <Columns>
   <telerik:GridBoundColumn SortExpression="IdEmpleado" HeaderText="IdEmpleado" HeaderButtonType="TextButton"
                                        DataField="IdEmpleado" DataType="System.Int32" Visible="false">
                                    </telerik:GridBoundColumn>                                    
  <telerik:GridBoundColumn SortExpression="IdTema" HeaderText="IdTema" HeaderButtonType="TextButton"
                                        DataField="IdTema" DataType="System.Int32" >
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn SortExpression="Nivel0" HeaderText="Nivel0" HeaderButtonType="TextButton"
                                        DataField="Nivel0">
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn SortExpression="Nivel1" HeaderText="Nivel1" HeaderButtonType="TextButton"
                                        DataField="Nivel1">
                                    </telerik:GridBoundColumn>
   <telerik:GridBoundColumn SortExpression="Nivel2" HeaderText="Nivel2" HeaderButtonType="TextButton"
                                        DataField="Nivel2">
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn SortExpression="Nivel3" HeaderText="Nivel3" HeaderButtonType="TextButton"
                                        DataField="Nivel3">
                                    </telerik:GridBoundColumn>
      <telerik:GridBoundColumn SortExpression="Nivel4" HeaderText="Nivel4" HeaderButtonType="TextButton"
                                        DataField="Nivel4">
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn SortExpression="Experiencia" HeaderText="Experiencia" HeaderButtonType="TextButton"
                                        DataField="Experiencia">
                                    </telerik:GridBoundColumn>
                                </Columns>
                            </telerik:GridTableView>
                        <DetailTables>
                    <telerik:GridTableView DataKeyNames="IdConocimiento" Width="100%">
                        <Columns>
                        <telerik:GridBoundColumn SortExpression="IdTema" HeaderText="IdTema" HeaderButtonType="TextButton"
                                DataField="IdTema" DataType="System.Int32" >
                                </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn SortExpression="IdConocimiento" HeaderText="IdConocimiento" HeaderButtonType="TextButton"
                                DataField="IdConocimiento" DataType="System.Int32" Visible="false">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn SortExpression="IdTema" HeaderText="IdTema" HeaderButtonType="TextButton"
                                DataField="IdTema" UniqueName="IdTema" DataType="System.Int32" Visible="false">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn SortExpression="Descripcion" HeaderText="SubTema" HeaderButtonType="TextButton"
                                DataField="Descripcion" UniqueName="Descripcion">
                            </telerik:GridBoundColumn>
                        </Columns>                       
                    </telerik:GridTableView>
                </DetailTables>
                <Columns>
                <telerik:GridBoundColumn SortExpression="" HeaderText="IdConocimiento " HeaderButtonType="TextButton"
                    DataField="IdConocimiento" DataType="System.Int32" ReadOnly="true" Visible="false">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn SortExpression="Valor" HeaderText="Tema" HeaderButtonType="TextButton"
                    DataField="Valor">
                </telerik:GridBoundColumn>                                   
            </Columns>
            </MasterTableView>
Hugo
Top achievements
Rank 1
 answered on 07 Apr 2011
0 answers
95 views
 como declaro la variable string IdTema = dataItem.GetDataKeyValue("IdTema").ToString();
me sale el erro que no es una referencia o declararla con new string


protected void BuscarTablaConocimiento(object source, Telerik.Web.UI.GridDetailTableDataBindEventArgs e)
        {
            GridDataItem dataItem = (GridDataItem)e.DetailTableView.ParentItem;
            switch (e.DetailTableView.Name)
            {
                case "1":
                    {
                        string IdConocimiento = dataItem.GetDataKeyValue("IdConocimiento").ToString();
                        e.DetailTableView.DataSource = ObtenerDatosTabla("SELECT * FROM Conocimiento WHERE IdConocimiento = '"+ IdConocimiento + "'");
                        break;
                    }


                case "2":
                    {
                        string IdTema = dataItem.GetDataKeyValue("IdTema").ToString();
                        e.DetailTableView.DataSource = ObtenerDatosTabla("SELECT * FROM Conocimiento WHERE IdTema = '" + IdTema);
                        break;
                    }
            }
        }
Hugo
Top achievements
Rank 1
 asked on 07 Apr 2011
2 answers
211 views
Greetings

I am trying to create a basic filtering functionality similar to the found at the Demo documentation at http://demos.telerik.com/aspnet-ajax/listview/examples/filtering/defaultcs.aspx

The only distinction is that my application uses ObjectDataSource to bind  the RadListView control. Here is a brief about the ObjectDataSource

<asp:ObjectDataSource ID="ObjectDataSource1" runat="server" TypeName="FriendBarDataSet"
    SelectMethod="GetFriends" OnSelecting="ObjectDataSource1_Selecting">
    <SelectParameters>
        <asp:Parameter Name="UserTable" />
    </SelectParameters>
</asp:ObjectDataSource>

  protected void ObjectDataSource1_Selecting(object sender, ObjectDataSourceSelectingEventArgs e)
    {
        e.InputParameters["UserTable"] = UserTable;
 
    }
 
/// And in the FriendBarDataSet Class
 
public SQLiteDataReader GetFriends(string UserTable)
    {
        SQLiteConnection connection = new SQLiteConnection(WebConfigurationManager.ConnectionStrings["ConnectionString2"].ConnectionString);
        SQLiteCommand cmd = new SQLiteCommand();
        cmd.Connection = connection;
        StringBuilder SelectCommand = new StringBuilder();
        string Table = "[" + UserTable.ToString() + "]";
        string SQL = "SELECT [ID], [uid], [Name], [sex], [birthday_date] FROM ";
 
        string completeCommand = SQL + Table;
        SelectCommand.Append(completeCommand.ToString());
        cmd.CommandText = SelectCommand.ToString();
 
        connection.Open();
        return cmd.ExecuteReader(CommandBehavior.CloseConnection);
    }

The ListView Binds with No Problem. It is doing what it Suppose to do..

However, when in try to implement a filter similar to the demo one, the filter is not functional and it throws me an error. Here is how i go about Implementing the filter..

if (!String.IsNullOrEmpty(TextBoxFilter.Text))
            {
      
                RadListViewFriendSelection.FilterExpressions.Clear();
                RadListViewFriendSelection.FilterExpressions.BuildExpression().Contains("Name", TextBoxFilter.Text.Trim()).Build();
                RadListViewFriendSelection.Rebind();
 
            }

The filer is throwing me the following exception::

System.InvalidOperationException: DataReader has been closed @ RadListViewFriendSelection.Rebind()

Could you help me implement a simple filter into this application? To filter - The "Name" field of the ListView control using "Contains". notice that I am accessing an SQLite data. I don't know if this happen to influence. In which case, I will be open to suggestions of implementing filtering in a different way.

Thank you for your help.







Sergio
Top achievements
Rank 1
 answered on 07 Apr 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?