Telerik Forums
UI for ASP.NET AJAX Forum
8 answers
146 views
Hi,

Can someone please help me with the following problem?

In my current project I have an advanced hierarchy model of Telerik RadGrid.

I need to set the CheckBoxes grid items into Edit Mode similar to the following http://www.gouw.ws/EditGrouping.aspx

I followed the documentation as given here "Put all items in edit mode without additional rebind"

However, it does not seem to work.

The web page is available on http://www.gouw.ws/HierarchyWithDS.aspx

The code are given as follows:

ASPX
<telerik:RadGrid ID="RadGrid1" AutoGenerateColumns="False" AutoGenerateHierarchy="True" AllowMultiRowEdit="true" Width="70%" OnNeedDataSource="RadGrid1_NeedDataSource" runat="server">
    <ClientSettings EnableAlternatingItems="false">
        <Scrolling UseStaticHeaders="true" />
    </ClientSettings>
     <MasterTableView DataKeyNames="CategoryId" EditMode="InPlace" TableLayout="Fixed">
        <DetailTables>
            <telerik:GridTableView DataKeyNames="CategoryId,TypeId" runat="server">
                <ParentTableRelation>
                     <telerik:GridRelationFields DetailKeyField="CategoryId" MasterKeyField="CategoryId" />
                </ParentTableRelation>
                <DetailTables>
                    <telerik:GridTableView DataKeyNames="TypeId,ContactName" runat="server">
                        <ParentTableRelation>
                            <telerik:GridRelationFields DetailKeyField="TypeId" MasterKeyField="TypeId" />
                        </ParentTableRelation>
                        <Columns>
                            <telerik:GridBoundColumn DataField="TypeId" DataType="System.String" ReadOnly="true" Visible="false" UniqueName="TypeId" />
                            <telerik:GridBoundColumn DataField="ContactName" DataType="System.String" HeaderText="Contact Name" ReadOnly="true" UniqueName="ContactName" />
                            <telerik:GridCheckBoxColumn DataField="Email" DataType="System.Boolean" HeaderText="Email" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" ReadOnly="false" UniqueName="Email" />
                            <telerik:GridCheckBoxColumn DataField="SMS" DataType="System.Boolean" HeaderText="SMS" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" ReadOnly="false" UniqueName="SMS" />
                            <telerik:GridCheckBoxColumn DataField="NotifyByEmail" DataType="System.Boolean" HeaderText="Notify By Email" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" ReadOnly="false" UniqueName="NotifyByEmail" />
                        </Columns>
                    </telerik:GridTableView>
                </DetailTables>
                <Columns>
                    <telerik:GridBoundColumn DataField="CategoryId" DataType="System.String" ReadOnly="true" Visible="false" UniqueName="CategoryId" />
                    <telerik:GridBoundColumn DataField="TypeId" DataType="System.String" ReadOnly="true" Visible="false" UniqueName="TypeId" />
                    <telerik:GridBoundColumn DataField="TypeName" DataType="System.String" HeaderText="Type Name" ReadOnly="true" UniqueName="TypeName" />
                    <telerik:GridCheckBoxColumn DataField="NoEncryption" DataType="System.Boolean" HeaderText="Encryption Not Required" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" ReadOnly="false" UniqueName="NoEncryption" />
                </Columns>
            </telerik:GridTableView>
        </DetailTables>
        <Columns>
            <telerik:GridBoundColumn DataField="CategoryId" DataType="System.String" ReadOnly="true" Visible="false" UniqueName="CategoryId" />
            <telerik:GridBoundColumn DataField="CategoryName" DataType="System.String" HeaderText="Category Name" ReadOnly="true" UniqueName="CategoryName" />
        </Columns>
    </MasterTableView>
</telerik:RadGrid>

C#
public partial class HierarchyWithDS : System.Web.UI.Page
{
    private DataSet _dataSet = null;
 
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (_dataSet == null) _dataSet = CreateDataSet();
            Session["DATASET"] = _dataSet;
        }
        else
        {
            _dataSet = (DataSet)Session["DATASET"];
        }
 
        SetEditMode();
    }
 
    protected void RadGrid1_NeedDataSource(object source, GridNeedDataSourceEventArgs e)
    {
        this.RadGrid1.DataSource = _dataSet;
    }
 
    private void SetEditMode()
    {
        int size = 0;
        for (int i = 0; i < _dataSet.Tables.Count; i++)
        {
            size += _dataSet.Tables[i].Rows.Count;
        }
        for (int i = 0; i < size; i++)
        {
            this.RadGrid1.EditIndexes.Add(i);
        }
    }
 
    private DataSet CreateDataSet()
    {
        DataSet dataSet = new DataSet();
 
        // Category table
        DataTable dtCategory = new DataTable("Category");
        dtCategory.Columns.Add("CategoryId", typeof(string));
        dtCategory.Columns.Add("CategoryName", typeof(string));
        dataSet.Tables.Add(dtCategory);
        foreach (Category category in Category.Load())
        {
            DataRow row = dataSet.Tables["Category"].NewRow();
            row["CategoryId"] = category.CategoryId;
            row["CategoryName"] = category.CategoryName;
            dataSet.Tables["Category"].Rows.Add(row);
        }
 
        // Type table
        DataTable dtType = new DataTable("Type");
        dtType.Columns.Add("CategoryId", typeof(string));
        dtType.Columns.Add("TypeId", typeof(string));
        dtType.Columns.Add("TypeName", typeof(string));
        dtType.Columns.Add("NoEncryption", typeof(bool));
        dataSet.Tables.Add(dtType);
        foreach (Category category in Category.Load())
        {
            foreach (Type type in Type.Load())
            {
                if (category.CategoryId == type.CategoryId)
                {
                    DataRow row = dataSet.Tables["Type"].NewRow();
                    row["CategoryId"] = type.CategoryId;
                    row["TypeId"] = type.TypeId;
                    row["TypeName"] = type.TypeName;
                    row["NoEncryption"] = type.NoEncryption;
                    dataSet.Tables["Type"].Rows.Add(row);
                }
            }
        }
 
        // Subscription table
        DataTable dtSubscription = new DataTable("Subscription");
        dtSubscription.Columns.Add("TypeId", typeof(string));
        dtSubscription.Columns.Add("ContactName", typeof(string));
        dtSubscription.Columns.Add("Email", typeof(bool));
        dtSubscription.Columns.Add("SMS", typeof(bool));
        dtSubscription.Columns.Add("NotifyByEmail", typeof(bool));
        dataSet.Tables.Add(dtSubscription);
        foreach (Type type in Type.Load())
        {
            foreach (Subscription subscription in Subscription.Load())
            {
                if (type.TypeId == subscription.TypeId)
                {
                    DataRow row = dataSet.Tables["Subscription"].NewRow();
                    row["TypeId"] = subscription.TypeId;
                    row["ContactName"] = subscription.ContactName;
                    row["Email"] = subscription.Email;
                    row["SMS"] = subscription.SMS;
                    row["NotifyByEmail"] = subscription.NotifyByEmail;
                    dataSet.Tables["Subscription"].Rows.Add(row);
                }
            }
        }
 
        // Table relations
        dataSet.Relations.Add(new DataRelation("Category-Type", dataSet.Tables["Category"].Columns["CategoryId"], dataSet.Tables["Type"].Columns["CategoryId"]));
        dataSet.Relations.Add(new DataRelation("Type-Subscription", dataSet.Tables["Type"].Columns["TypeId"], dataSet.Tables["Subscription"].Columns["TypeId"]));
 
        return dataSet;
    }
}
 
public class Category
{
    public string CategoryId { get; set; }
    public string CategoryName { get; set; }
 
    public Category(string categoryId = null, string categoryName = null)
    {
        CategoryId = categoryId;
        CategoryName = categoryName;
    }
 
    public static List<Category> Load()
    {
        List<Category> category = new List<Category>();
        category.Add(new Category("NEM_STATEMENTS", "NEM Statements"));
        return category;
    }
}
 
public class Type
{
    public string CategoryId { get; set; }
    public string TypeId { get; set; }
    public string TypeName { get; set; }
    public bool NoEncryption { get; set; }
 
    public Type(string categoryId = null, string typeId = null, string typeName = null, bool noEncryption = false)
    {
        CategoryId = categoryId;
        TypeId = typeId;
        TypeName = typeName;
        NoEncryption = noEncryption;
    }
 
    public static List<Type> Load()
    {
        List<Type> type = new List<Type>();
        type.Add(new Type("NEM_STATEMENTS", "NEM_STMT_PRELIM", "Preliminary"));
        type.Add(new Type("NEM_STATEMENTS", "NEM_STMT_FINAL", "Final"));
        type.Add(new Type("NEM_STATEMENTS", "NEM_STMT_REVISION", "Revision"));
        return type;
    }
}
 
public class Subscription
{
    public string TypeId { get; set; }
    public string ContactName { get; set; }
    public bool Email { get; set; }
    public bool SMS { get; set; }
    public bool NotifyByEmail { get; set; }
 
    public Subscription(string typeId = null, string contactName = null, bool email = false, bool sms = false, bool notifyByEmail = false)
    {
        TypeId = typeId;
        ContactName = contactName;
        Email = email;
        SMS = sms;
        NotifyByEmail = notifyByEmail;
    }
 
    public static List<Subscription> Load()
    {
        List<Subscription> subscription = new List<Subscription>();
        subscription.Add(new Subscription("NEM_STMT_PRELIM", "Inger Wills"));
        subscription.Add(new Subscription("NEM_STMT_PRELIM", "Keith Armstrong"));
        subscription.Add(new Subscription("NEM_STMT_PRELIM", "Lance McMinn"));
        subscription.Add(new Subscription("NEM_STMT_FINAL", "Inger Wills"));
        subscription.Add(new Subscription("NEM_STMT_FINAL", "Keith Armstrong"));
        subscription.Add(new Subscription("NEM_STMT_FINAL", "Lance McMinn"));
        subscription.Add(new Subscription("NEM_STMT_REVISION", "Inger Wills"));
        subscription.Add(new Subscription("NEM_STMT_REVISION", "Keith Armstrong"));
        subscription.Add(new Subscription("NEM_STMT_REVISION", "Lance McMinn"));
        return subscription;
    }
}

Mira
Telerik team
 answered on 30 Sep 2010
1 answer
58 views
Hello, 

    I have some RadGrid in my page, but when i make a postback to upload files, after postback all RadGrid's miss the skin, do you know why??

Thank's
Dimo
Telerik team
 answered on 30 Sep 2010
3 answers
166 views
We're using ver 5.7.1 of the editor and it's important that we use absolute file paths when publishing links.  No matter what i try the editor always makes the link a relative path when i save the item, which will not work as our publishing site is on a different site than our front end.  The resources that we want to link to are in the publishing site but because the link is relative users are being redirected to the front end site and are getting a file not found error.  I've tried just about everything that i can find in the forums - i understand that the StripAbsoluteFilePaths has been done away with, and i've added the MakeUrlsAbsolute only seems to be a display attribute - meaning the URLs look to be absolute in the editor but are saved as relative paths.  Any suggestions on how we turn off whatever is modifying the URLs on save?
Rumen
Telerik team
 answered on 30 Sep 2010
2 answers
76 views
Hi,

(Related to previous post, but information there not needed for this query)
I have a form with a RadWindow that pops up on Submit.  All the code within the RadWindow performs properly, but I need it to refresh the page behind on close.  I have this code:

RadWindowManager1.OnClientClose = "FuncName";
which generates this in the client:
in the Sys.Application.add_init(function() {
$create(Telerik.Web.UI.RadWindowManager, [stuff snipped here] {"close":FuncName} [more stuff]
so does appear to be doing what it should within the RadWindow

However, on closing my RadWindow, FuncName is not called at all (tested with alerts and debugger calls).
Any idea why?

(Previous problem was caused by the FuncName function not being in scope at the time of the $create call, this is fixed now, so can't see any reason this should be failing)

Richard.
Richard
Top achievements
Rank 1
 answered on 30 Sep 2010
1 answer
186 views
hi
my language is persian
but in radgrid numbers show english
please help
thanks
Maria Ilieva
Telerik team
 answered on 30 Sep 2010
2 answers
327 views
Hi Team

Ho to i use Webserice in Rad combobox i'll send you the sample code which i using in application

<

 

telerik:RadComboBox ID="ddlsample" runat="server" EmptyMessage="Select" DataTextField="FirstName" DataValueField="ReferalID"

 

 

EnableLoadOnDemand="true" TabIndex="133" Width="200px">

 

 

<WebServiceSettings Method="GetRefDoc" Path="RefDoc.asmx" />

 

 

</telerik:RadComboBox>

// Webservice RefDoc.asmx

 

[

WebMethod]

 

 

public DataSet GetRefDoc()

 

{

 

DataSet ds = new DataSet();

 

ds =

GlobalGui.Instance.FillReferralDoctorCombobox1();

 

 

return ds;

 

}

this is my method calling to fill

 

public

 

DataSet FillReferralDoctorCombobox1()

 

{

 

DataSet dset = aaa.ProcessSelectStatements("Mystored_Procedure");

 

 

return dset;

 

}

i must want to store DataValueField to database and also i've to do some autopostback event for some controls.
Please Give me the solution or suggession how to use webservice ..
as soon as possible.. need to implement.

Regards,
Ashok Anbarasu

Ashok
Top achievements
Rank 1
 answered on 30 Sep 2010
3 answers
98 views
At the moment, aligning items to the right will produce <p style="text-align:right"> etc.. for many other options also.

Is there a way to by pass this to place <p class="right"> instead. this would help us with updating our editor for our current setup.

Many Thanks,

Paul.
Rumen
Telerik team
 answered on 30 Sep 2010
1 answer
78 views
Short question. Does the Telerik ASP.NET AJAX controls support Chinese characters? Is it posible to view any sample of that?
Sebastian
Telerik team
 answered on 30 Sep 2010
3 answers
406 views
Hello,

I need to be able to keep the caret in the same location on a masked textbox when a user leaves our webpage (switches tabs) and comes back.

Currently, if the user enters some text, '123', and then goes to a different tab and comes back, the caret does not remain after the '3'.  It has moved to the end of the mask.
<telerik:RadMaskedTextBox ID="RMTBZip" runat="server" Mask="#####-####" SelectionOnFocus="None" />

This happens regardless of whether I set the SelectionOnFocus attribute to "None" or not.

A standard asp textbox keeps the caret in the same location.  If I type "test" and leave the caret between the 'e' and the 's'.  Tab away and come back, the caret is still in the same location.  Is there another attribute I need to use in order to replicate this functionality?  Or in other words, stop the caret from moving?

Regards,
Chris
Maria Ilieva
Telerik team
 answered on 30 Sep 2010
3 answers
68 views
Hi,

I'm trying to use the code from this demo http://telerikwatch.com/2008/09/telerik-watch-minute-enhancing-radgrid.html. The problem I'm having is I get this error the second time I try to edit the filter textbox and hit Enter. This seems to be happening in all browsers.



This is a very complex page so I can't copy all the code here. So, here is an idea of what is going on that may be helpful:

       1. Columns are dynamically created with AutoPostBackonFilter = false (I've tried both ways)
       2. Using RadAjaxManager to update grid and controls.
       3. There is a ASP:Panel around the grid with the DefaultButton set to a control to keep it from randomly launching other buttons     on the page.
       4. Using RadComboxes in the grid also. They are all working fine and are using the masterTableView.filter() function.    

Any help would be appreciated.

Blair

Possible offending code:

,_recreateControls:function(e){var d=e.getElementsByTagName("*");

for(var a=0,c=d.length;

a<c;

a++){var f=d[a];

if(typeof(f.id)!="undefined"&&f.id!=""){var b=$find(f.id);

if(!b){continue;

}b._element=$get(f.id);

}}},getColumnByUniqueName:function(a){for(var b=0;

b<this.get_columns().length;

b++){if(this.get_columns()[b].get_element().UniqueName==a){return this.get_columns()[b];

}}return null;

 


Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET CLR 1.1.4322)
Timestamp: Fri, 17 Sep 2010 16:56:07 UTC

Message: 'this.get_columns()[...].get_element().UniqueName' is null or not an object
Line: 3398
Char: 6
Code: 0
URI: https://mini.salesnet.com/Telerik.Web.UI.WebResource.axd?_TSM_HiddenField_=RadScriptManager1_TSM&compress=1&_TSM_CombinedScripts_=%3b%3bSystem.Web.Extensions%2c+Version%3d3.5.0.0%2c+Culture%3dneutral%2c+PublicKeyToken%3d31bf3856ad364e35%3aen-US%3ad0c4ca6e-6b5d-49b6-922d-5244924fb100%3aea597d4b%3ab25378d2%3bTelerik.Web.UI%2c+Version%3d2010.2.713.35%2c+Culture%3dneutral%2c+PublicKeyToken%3d121fae78165ba3d4%3aen-US%3a7302be66-e7a1-4bc1-8280-71f03d66eba0%3a16e4e7cd%3a58366029%3af7645509%3a24ee1bba%3a1e771326%3aaa288e2d%3ae330518b%3ac8618e41%3ae4f8f289%3aed16cbdc

 

Pavlina
Telerik team
 answered on 30 Sep 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Andrey
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Andrey
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?