Wednesday, October 23, 2013

RadGrid

Task 1:

MaintainScrollbar at the edited area after pageload

in C#

Page.MaintainscrollpositionOnPostback=true;

in Asp

<%@ Page Title="" Language="C#" MasterPageFile="masterpage.master"  AutoEventWireup="true" Maintainscrollpositiononpostback="true"
 CodeFile="GroupSubjectMaster.aspx.cs" Inherits="GroupSubjectMaster" %>



Task 2: Nested Grid

Getting values from parent grid  and child grid

 GridDataItem parentItem = e.Item.OwnerTableView.ParentItem
         string datakey = parentItem.OwnerTableView.DataKeyValues[parentItem.ItemIndex]["masterid"].ToString();

 GridDataItem item = (GridDataItem)e.Item;
        string DId = item.OwnerTableView.DataKeyValues[item.ItemIndex                  ["masterdetailid"].ToString();


Task 3:

Call Client side event in RadGrid

   <ClientSettings  ClientEvents-OnRowClick ="comboboxvali()" >
     </ClientSettings>

Task 4:

Change the Fore color of the literal control


In this case the literal is created for showing message that saved/not saved due to...
use code done below in catch block to show error message in different color

  GroupSubjectmasterRadGrid.Controls.Add(new LiteralControl(string.Format("<span style='color:red'>Unable to insert VehicleType. Reason: " + ex.Message + "</span>")));
                e.Canceled = true;

Task 5:
Allow  access only number in  RadGrid  Text box control

              <cc1:FilteredTextBoxExtender ID="filetered1" runat="server"      TargetControlID="Txt_weightage"  FilterType="Numbers">
            </cc1:FilteredTextBoxExtender>



Add the above code to below the asp text box  coded below

<asp:TextBox ID="Txt_weightage" runat="server" Text='<%# Eval("weightage") %>' Width="75px"></asp:TextBox>







 



Thursday, October 3, 2013

Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding


In your code where you run the stored procedure you should have something like this:
SqlCommand cmd = new SqlCommand(...)
Add such a line of code:
cmd.CommandTimeout = 0;
This will wait as much time as needed for the operation to complete.