Can you please help me with following issue ?
we are using SL 2.0 and most recent version of the Telerik controls. On SL page we have a telerik Grid which has a Radio Button Column.
We have implemented a Search functionality on SL page , On click of Search button it calls a Web Service (with required Search criteria ) and the result received from Web Service is displayed in Telerik RAD GRId. User then select a particular Row in GRid by Checking the Radion button corresponding for that Row and another function is called with Selected Row data as parameter.
Grid shows 5 records at one shot and if the user needs to see more data he needs to Scroll Down in Grid , using Grids Vertical Scroll bar
My application works perfectly fine if User don't do any scrolling in Telerik Grid, i.e i can call Search any number of times without any problem....every time it will call web service with out any problem.
but if user scroll down i in Grid to see more search results .. and after that try to Search with another criteria .... My Silverlight application Crashses ..,,,,and a blank screen shows up ...i tried to debug this but it don't show any exception ...this is happenign very consistently ..if don't do any scrolling in Telerik grid ...application works perfectly fine...but crashes if we do scrolling to select another row,,,or to see all the data and then try search again.
Below is My GRID .XAML and Code For ROWLOADED Event
I have implemented following method on Rowloaded event for RadGrid ..which I have received earlier from telerik to ensure that only one Radion button is selected in the RADIO Button Column and user cannot check multiple radio buttons..with below code user can select only radio button at one time
I also tried to comment all the code in ROWLOADED event and test my application but if i Scroll down in Telerik Grid and try searching again application crashes while calling Web Service
- ROWLoaded EVENT
void RadGridView1_RowLoaded(object sender, RowLoadedEventArgs e)
{
if (!(e.Row is GridViewNewRow) && !(e.Row is GridViewHeaderRow))
{
var cell = e.Row.Cells.Where(c => c.Column.UniqueName == "").FirstOrDefault();
if (cell != null)
{
var radioButton = cell.ChildrenOfType<RadioButton>().FirstOrDefault();
if (radioButton != null)
{
radioButton.SetBinding(RadioButton.IsCheckedProperty,
new Binding("IsSelected") { Source = e.Row.Record, Mode = BindingMode.TwoWay });
POCount = POCount + 1;
}
}
}
}
2.XAML
<StackPanel Grid.Row="6" Grid.Column="1" Orientation="Horizontal" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="0,35,0,0" >
<twcgv:RadGridView x:Name="RadGridView1"
IsReadOnly="True"
RowIndicatorVisibility="Collapsed"
AutoGenerateColumns="False"
CanUserFreezeColumns="False"
CanUserReorderColumns="False"
ColumnsWidthMode="None"
ColumnBackground="white"
ScrollMode="Deferred"
UseAlternateRowStyle="True"
MultipleSelect="False"
FontSize="10"
MaxWidth="1060"
MinWidth="1060"
MinHeight="190"
MaxHeight="190"
Margin ="0,-30,0,0"
Style="{StaticResource BPRadGridViewStyle}"
RowStyle="{StaticResource RowStyle}"
AlternateRowStyle="{StaticResource RowStyle_Alternate}"
DataLoaded="RadGridView1_DataLoaded"
>
<twcgv:RadGridView.Columns >
<twcgv:GridViewColumn UniqueName="">
<twcgv:GridViewColumn.CellTemplate>
<DataTemplate>
<RadioButton Checked="RadioButton_Checked" MaxWidth="20" MinWidth="20" />
</DataTemplate>
</twcgv:GridViewColumn.CellTemplate>
</twcgv:GridViewColumn>
<twcgv:GridViewDataColumn HeaderText="PO#" UniqueName="PONumber" Width="90" />
<twcgv:GridViewDataColumn HeaderText="Vendor Name" UniqueName="VendorName" Width="200" />
<twcgv:GridViewDataColumn HeaderText="Description" UniqueName="MaterialDescription" Width="200" />
<twcgv:GridViewDataColumn HeaderText="Cost Center" UniqueName="CostCenter" Width="120" />
<twcgv:GridViewDataColumn HeaderText="WBS" UniqueName="WBS" Width="90" />
<twcgv:GridViewDataColumn HeaderText="Plant Name" UniqueName="PlantName" Width="200"/>
</twcgv:RadGridView.Columns>
</twcgv:RadGridView>
</StackPanel>
With thanks and regards
Nikhil Jain