473,587 Members | 2,494 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 1359
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
2228
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
1757
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
1109
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
3439
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
5332
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
1026
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
4856
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
6680
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
2750
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.
0
7854
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8349
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
6629
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
5722
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
5395
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
3845
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
3882
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2364
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
1
1455
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.