473,768 Members | 5,794 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

UserControl in Template DataColumn

Hi
I developed a usercontrol with a textbox and an htmlInputHidden
When I add my usercontrol in a webform, it works properly
If I add my control in a template column of a datagrid i have some problems
When I load the webform, the usercontrol has a UniqueID like this: "LookUp1:txtRis ultato", then I value the text of this textbox with a client-side script. If i post the page, the value saved in the textbox.text is null, but i see that the UniqueID is changed, and now is "DataGrid1:Look Up1:txtRisultat o"
How can i refer to my usercontrol with an ID which doesn't changes
Why the UniqueID changes

P.S. I noticed that if I value the textbox sending the right ID (DataGrid1:Look Up1:txtRisultat o) the post is made properl

Thank yo
Alessandro Rossi
Nov 18 '05 #1
3 1368
Hi, Alessandro Rossi,

The UniqueID in this case receives its actual (and final) value after the
binding of the DataGrid. I suppose that you are reading it at some point
before that. That is why it has different value.

Hope this helps
Martin
"Alessandro Rossi" <Al************ **@areait.net> wrote in message
news:F3******** *************** ***********@mic rosoft.com...
Hi,
I developed a usercontrol with a textbox and an htmlInputHidden .
When I add my usercontrol in a webform, it works properly.
If I add my control in a template column of a datagrid i have some problems: When I load the webform, the usercontrol has a UniqueID like this: "LookUp1:txtRis ultato", then I value the text of this textbox with a
client-side script. If i post the page, the value saved in the textbox.text
is null, but i see that the UniqueID is changed, and now is
"DataGrid1:Look Up1:txtRisultat o". How can i refer to my usercontrol with an ID which doesn't changes?
Why the UniqueID changes?

P.S. I noticed that if I value the textbox sending the right ID (DataGrid1:Look Up1:txtRisultat o) the post is made properly
Thank you
Alessandro Rossi

Nov 18 '05 #2
No, I found the problem
I built the client-side script when the UniqueID wasn't complete (in the set method of a property). Now I moved the code in a Control PreRender event handler procedure's, and now all works properly

Thank you for the interest
Alessandro Rossi

----- Martin Dechev wrote: ----

Hi, Alessandro Rossi

The UniqueID in this case receives its actual (and final) value after th
binding of the DataGrid. I suppose that you are reading it at some poin
before that. That is why it has different value

Hope this help
Marti
"Alessandro Rossi" <Al************ **@areait.net> wrote in messag
news:F3******** *************** ***********@mic rosoft.com..
Hi
I developed a usercontrol with a textbox and an htmlInputHidden
When I add my usercontrol in a webform, it works properly
If I add my control in a template column of a datagrid i have som problems When I load the webform, the usercontrol has a UniqueID like this "LookUp1:txtRis ultato", then I value the text of this textbox with
client-side script. If i post the page, the value saved in the textbox.tex
is null, but i see that the UniqueID is changed, and now i
"DataGrid1:Look Up1:txtRisultat o" How can i refer to my usercontrol with an ID which doesn't changes
Why the UniqueID changes
P.S. I noticed that if I value the textbox sending the right I (DataGrid1:Look Up1:txtRisultat o) the post is made properl Thank yo

Alessandro Ross


Nov 18 '05 #3
Hi, Alessandro Rossi,

The code in the PreRender method is executed *after* the binding of the
DataGrid. I was supposing (correctly) that you were reading the UniqueID
*before* the binding.

Anyway, it's good that you have resolved your problem.

Greetings
Martin
"Alessandro Rossi" <al************ **@areait.net> wrote in message
news:9B******** *************** ***********@mic rosoft.com...
No, I found the problem.
I built the client-side script when the UniqueID wasn't complete (in the set method of a property). Now I moved the code in a Control PreRender event
handler procedure's, and now all works properly.
Thank you for the interest.
Alessandro Rossi.

----- Martin Dechev wrote: -----

Hi, Alessandro Rossi,

The UniqueID in this case receives its actual (and final) value after the binding of the DataGrid. I suppose that you are reading it at some point before that. That is why it has different value.

Hope this helps
Martin
"Alessandro Rossi" <Al************ **@areait.net> wrote in message
news:F3******** *************** ***********@mic rosoft.com...
> Hi,
> I developed a usercontrol with a textbox and an htmlInputHidden .
> When I add my usercontrol in a webform, it works properly.
> If I add my control in a template column of a datagrid i have some problems:
> When I load the webform, the usercontrol has a UniqueID like this:

"LookUp1:txtRis ultato", then I value the text of this textbox with a
client-side script. If i post the page, the value saved in the

textbox.text is null, but i see that the UniqueID is changed, and now is
"DataGrid1:Look Up1:txtRisultat o".
> How can i refer to my usercontrol with an ID which doesn't changes?
> Why the UniqueID changes?
>> P.S. I noticed that if I value the textbox sending the right ID (DataGrid1:Look Up1:txtRisultat o) the post is made properly >> Thank you

> Alessandro Rossi


Nov 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2243
by: | last post by:
Hi, All, I'm having problems getting OnInit to fire in my UserControl, when I use a custom template to render the control. The control will render to the browser and it wasn't until I needed to perform some initialization in the OnInit event did I realize that this event was never firing. Two Question:
4
1772
by: Vlady | last post by:
Hello. I recently built an ASP.NET "financial" application. I got to the point where I have a HTML template (a contract) which needs to be filled with various data from the database. I put a "generate contract" button on my ASPX page, but I totally lack ideas of how to put the data in the correct places in the html file. I was recommended (actually "do like this" from my boss) to enclose the variable name like this {variable_name} in the...
0
1118
by: vbMental | last post by:
I created a user control that, had a datalist with checkboxes inside of the item template. These checkboxes would not retain state. For instance, if I set them to checked inside of the load event of the UserControl, they would appear false(the default value) when inside the top level datagrid. Here's the walkthrough (tried to make it as quick as possible): Start a new ASP.NET Web Application project. 1. Create a usercontrol....
2
3451
by: Tim_Mac | last post by:
hi, i have an aspx page which dynamically loads a user control and adds it to a placeholder. the control is recreated and added to the placeholder for postbacks as well. the user control contains a datagrid and some buttons and textboxes. the button events fire correctly and execute their code. however, the datagrid events fire a postback, and execute Page_load in the usercontrol, but the Item_Command code is not executed. the code to...
13
5345
by: Michael Maes | last post by:
Hi, I have a UserControl containing some controls of which one is a ComboBox. All the InternalControls are Private and some are allowed to be accessed through Public Methods. One of the things I would like to do (of course) is set the DataBindings. Something clearly is wrong with the approach I use, because I can't set the Properties in the Designer, the DataSource-Property appears like 'ReadOnly', there is no "dropdown" with the list from...
0
1033
by: Captain Sensible | last post by:
Hello! I created a master page and load usercontrols dynmamically during runtime. So far so good. But for getting a unique frame with functionality buttons like Add, save etc. I created a usercontrol "TemplateUserControl" with a table, within this table a placeholder, where I wanna put in another user control. So I get a unique look for all plus the benefit , that I can check the permissions for the content in the Template control ( in...
1
4861
by: James | last post by:
CWinFormsDialog in .net 2.0 lets you host a .Net UserControl as a dialog in a managed C++ MDI application. I.e. in the sample: ----------------------------------------------- #include <afxwinforms.h> #using <WinFormUserControl1.dll> using namespace WinFormUserControl1;
1
6692
by: Andrew Robinson | last post by:
Is it possible to have a RequiredFieldValidator that targets a UserControl? <asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" ControlToValidate="PhoneUserControlHome" Display="dynamic" Text="&nbsp;(Required Field)" /> This code generates a run time exception of "Control 'PhoneUserControlHome' referenced by the ControlToValidate property of 'RequiredFieldValidator6' cannot be validated. "
6
2760
by: Rolf Welskes | last post by:
Hello, I want to partial cache by using a UserControl. Now I have a file dependency. In msdn I see it is not possible to do it the same way as in a page. The only information is to create a file dependency and assign it to Dependency property.
1
9960
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8840
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7384
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6656
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5280
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5425
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3931
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3534
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2808
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.