We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

How to browse a Gridgrouping and to find items ?

Thread ID:

Created:

Updated:

Platform:

Replies:

41049 Feb 21,2006 06:06 AM Feb 23,2006 10:41 AM ASP.NET Web Forms (Classic) 4
loading
Tags: GridGroupingControl
Claudio
Asked On February 21, 2006 06:06 AM

Using the templated Datagrid of the .NET toolbar, we can find a component (Label and TextBox for example) with this code : foreach (DataGridItem item in Datagrid1.Items) { Label lbl = (Label) item.FindControl("labelName"); TextBox box = (TextBox) item.FindControl("textboxName"); ...... } Using a templated GridGroupingControl how can we browse it and find items (like Label or TextBox). Thank''s

Administrator [Syncfusion]
Replied On February 22, 2006 06:50 PM

Hi Claudio, You can use the GridGroupingControl1.FormEditCell.FindControl method. Take a look at GridGroupingControl1_BarButtonItemClicked() event in the Editing\FormEditMode sample (FormEditModeDemo.aspx.cs). Here is a snippet of code used for a TextBox control: TextBox tb = this.GridGroupingControl1.FormEditCell.FindControl("CustomerIDTB") as TextBox; Regards Arun

Claudio
Replied On February 23, 2006 09:24 AM

Thank you but how can I programmatically go to a ''Record'' (without have to click on it) in my GridGroupingControl. I''d like to know also how to create a Template column in a GridGroupingControl (for example a template column using a Label and a TextBox controls) and databind data with a column from a dataset. After that I will write in my Page_Load() definition : GridGroupingControl1.DataSource = dataset1; GridGroupingControl1.DataBind(); To resume I''d like to have in one column of my GridGroupingControl a Label and a TextBox databinded with the same column from a dataset, so in my Label and TextBox I will have the same information. This is not working : - in my aspx file <%#GetUserId(Container)%> <%#GetUserId(Container)%> - in my aspx.cs file protected string GetUserId(GridCell container) { string TEST; Record rowRecord=container.Row.Record; TEST = rowRecord.GetValue("user_id").ToString(); return TEST; } I get this two errors : "Object reference not set to an instance of an object." Line 45: TEST = rowRecord.GetValue("user_id").ToString(); ''TextBox'' cannot have children of type ''DataBoundLiteralControl''. Line 30: >Hi Claudio, > >You can use the GridGroupingControl1.FormEditCell.FindControl method. Take a look at GridGroupingControl1_BarButtonItemClicked() event in the Editing\FormEditMode sample (FormEditModeDemo.aspx.cs). Here is a snippet of code used for a TextBox control: > >TextBox tb = this.GridGroupingControl1.FormEditCell.FindControl("CustomerIDTB") as TextBox; > >Regards >Arun >

Claudio
Replied On February 23, 2006 09:28 AM

In my aspx file : < ItemTemplate > < asp:Label id="Label1" runat="server" > < % # GetUserId(Container) % > < / asp:Label > < asp:TextBox id="TextBox2" runat="server" > < % #GetUserId(Container) % > < / asp:TextBox > < / ItemTemplate > >Thank you but how can I programmatically go to a ''Record'' (without have to click on it) in my GridGroupingControl. >I''d like to know also how to create a Template column in a GridGroupingControl (for example a template column using a Label and a TextBox controls) and databind data with a column from a dataset. After that I will write in my Page_Load() definition : > >GridGroupingControl1.DataSource = dataset1; >GridGroupingControl1.DataBind(); > >To resume I''d like to have in one column of my GridGroupingControl a Label and a TextBox databinded with the same column from a dataset, so in my Label and TextBox I will have the same information. > >This is not working : > > - in my aspx file > > > > > <%#GetUserId(Container)%> > > > <%#GetUserId(Container)%> > > > > > - in my aspx.cs file > >protected string GetUserId(GridCell container) >{ > string TEST; > Record rowRecord=container.Row.Record; > TEST = rowRecord.GetValue("user_id").ToString(); > return TEST; >} > >I get this two errors : > >"Object reference not set to an instance of an object." >Line 45: TEST = rowRecord.GetValue("user_id").ToString(); > >''TextBox'' cannot have children of type ''DataBoundLiteralControl''. >Line 30: > >>Hi Claudio, >> >>You can use the GridGroupingControl1.FormEditCell.FindControl method. Take a look at GridGroupingControl1_BarButtonItemClicked() event in the Editing\FormEditMode sample (FormEditModeDemo.aspx.cs). Here is a snippet of code used for a TextBox control: >> >>TextBox tb = this.GridGroupingControl1.FormEditCell.FindControl("CustomerIDTB") as TextBox; >> >>Regards >>Arun >>

Claudio
Replied On February 23, 2006 10:41 AM

Actually it is working now ! So you can forget my last messages. But I still have problems. Can I programmatically go to a specific row (without have to click on it) in my GridGroupingControl ? because I just want to find my control in a specific row. Now I know i must use the FindControl method. This is my aspx file code for my Template column in the attached file. >In my aspx file : > >< ItemTemplate > > < asp:Label id="Label1" runat="server" > > < % # GetUserId(Container) % > > < / asp:Label > > < asp:TextBox id="TextBox2" runat="server" > > < % #GetUserId(Container) % > > < / asp:TextBox > >< / ItemTemplate > > >>Thank you but how can I programmatically go to a ''Record'' (without have to click on it) in my GridGroupingControl. >>I''d like to know also how to create a Template column in a GridGroupingControl (for example a template column using a Label and a TextBox controls) and databind data with a column from a dataset. After that I will write in my Page_Load() definition : >> >>GridGroupingControl1.DataSource = dataset1; >>GridGroupingControl1.DataBind(); >> >>To resume I''d like to have in one column of my GridGroupingControl a Label and a TextBox databinded with the same column from a dataset, so in my Label and TextBox I will have the same information. >> >>This is not working : >> >> - in my aspx file >> >> >> >> >> <%#GetUserId(Container)%> >> >> >> <%#GetUserId(Container)%> >> >> >> >> >> - in my aspx.cs file >> >>protected string GetUserId(GridCell container) >>{ >> string TEST; >> Record rowRecord=container.Row.Record; >> TEST = rowRecord.GetValue("user_id").ToString(); >> return TEST; >>} >> >>I get this two errors : >> >>"Object reference not set to an instance of an object." >>Line 45: TEST = rowRecord.GetValue("user_id").ToString(); >> >>''TextBox'' cannot have children of type ''DataBoundLiteralControl''. >>Line 30: >> >>>Hi Claudio, >>> >>>You can use the GridGroupingControl1.FormEditCell.FindControl method. Take a look at GridGroupingControl1_BarButtonItemClicked() event in the Editing\FormEditMode sample (FormEditModeDemo.aspx.cs). Here is a snippet of code used for a TextBox control: >>> >>>TextBox tb = this.GridGroupingControl1.FormEditCell.FindControl("CustomerIDTB") as TextBox; >>> >>>Regards >>>Arun >>>

aspx.zip

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;