Ask a Question related to ASP.NET General, Design and Development.
-
SatinderGT #1
Re: problem with INamingContainer
Ya sure,
this is the code for 3 text boxes generated:
</div><div id="Panel1" style="height:212px;width:380px;Z-INDEX: 102; LEFT:
439px; POSITION: absolute; TOP: 386px">
Panel<span id="Sat"><table id="Sat_tblEntry" border="0">
<tr id="Sat_ThisRow1532">
<td></td><td></td><td><input name="Sat:ThisRow1532:TXT1532" type="text"
id="Sat_ThisRow1532_TXT1532" /></td><td></td>
</tr><tr id="Sat_ThisRow2663">
<td></td><td></td><td><input name="Sat:ThisRow2663:TXT2663" type="text"
id="Sat_ThisRow2663_TXT2663" /></td><td></td>
</tr><tr id="Sat_ThisRow3726">
<td></td><td></td><td><input name="Sat:ThisRow3726:TXT3726" type="text"
id="Sat_ThisRow3726_TXT3726" /></td><td><span id="Sat_ThisRow3726__ctl0"
controltovalidate="Sat_ThisRow3726_TXT3726" errormessage="test me"
display="Dynamic"
evaluationfunction="RegularExpressionValidatorEval uateIsValid"
validationexpression="\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"
style="color:Red;display:none;">test me</span></td>
</tr>
</table></span>
Just for your info:
I even tried to use page.findcontrol and set the uniqueid, clientid and id
properties individually for the control, but it doesn't works!!!
Also, i tried to set Sat:ThisRow1532:TXT1532
Also, i tired to set ThisRow1532:TXT1532
Also, i tried to set Sat_ThisRow1532_TXT1532
But, all in the above cases it fails and says control not found.
JUST TO REMIND AGAIN WHEN I AM RENDERID "TXT3726" AT THAT TIME I M TRYING
TO VALIDATE "TXT1532",
REASON: I WANT TO USE COMPAREVALIDATOR ON IT.
Waiting for reply,
thanks in advance,
satinder
"William F. Robertson, Jr." <wfrobertson@kpmg.com> wrote in message
news:Oiter8dODHA.1748@TK2MSFTNGP11.phx.gbl...it> So you are saying you are passing aobjViewRowProp because you were usingto> in the past, but now you are trying to use the TestClass mobjViewRow?
>
> Try also changing the ControlToValidate to x.ID instead of hard coding it.
> I know on my composite controls, (that implement INamingContainer) I havelittle> reference the exact ID of it. I couldn't just type it in, because of the
> UniqueID that gets generated for INamingContainer.
>
> Would you post a sample of what your view source from IE looks like? I
> think I just about have something figured out for you, I just need aat> bit more.
>
> bill
>
> "SatinderGT" <satinder@thegt.com> wrote in message
> news:#fWMdEVODHA.2096@TK2MSFTNGP12.phx.gbl...> the> > Hi William,
> >
> > aobjViewRowProp is declared as type TableRow and this row is used to add> But,> > cotnrols.
> > If i declare it as tablerow and do what is rquired, then it works fine.> of> > if i declare aobjViewRowProp as TestClass (that implements
> > INamingContainer), then it says Control TXT1532 not found. If i do not
> > implement INamingContainer it works fine (but implementation of
> > INamingContainer is required).
> > Note that if i change the condition to :
> >> >> > > > If x.ID = "TXT1532" Then
> > > > Dim rfv As New RegularExpressionValidator()
> > > >
> > > > With rfv
> > > > .ControlToValidate = "TXT1532"
> > > > .ValidationExpression =
> > > > "\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"
> > > > .ErrorMessage = "test me"
> > > > .Display = ValidatorDisplay.Dynamic
> > > > End With
> > > > tdDescription.Controls.Add(rfv)
> > > > End If
> > THE ABOVE CODE WORKS FINE !!! NOTE HERE TXT1532 IS CHECKED AND ADDED.
> > IN PREVIOUS CODE TXT3726 WAS CHECKED AND TXT1532 WAS ADDED.
> >
> > I saw the source code carefully that the control has generated after
> > INamingContainer, but specfying the ids generated by INamingContainer
> > doesn't helps.
> > I need this as i want to add CompareValidator, i want to check the value> questions.> > one control with another. All happens Dynamically.
> >
> >
> > Please help.
> >
> > thanks
> > sat
> >
> >
> > "William F. Robertson, Jr." <wfrobertson@kpmg.com> wrote in message
> > news:uS4juQ0NDHA.2788@TK2MSFTNGP10.phx.gbl...> > > This probably won't solve your problem, but these are just some> you> > >
> > > Why are you passing in aobjViewRowProp to AddControlToTable(...) when> it> > > aren't using it inside your method?
> > >
> > > Look at the source code generated using the INamingContainer. See how> > is> > > naming your control. I can't think of how it would be now, but lookINamingContainer> it> the> > > and make sure the ControlToValidate property rendered are the same as> > > clientID of the control you are wishing to develop.
> > >
> > > bill
> > >
> > >
> > >
> > > "SatinderGT" <satinder@thegt.com> wrote in message
> > > news:u92RWqxNDHA.2064@TK2MSFTNGP10.phx.gbl...
> > > > Dear Group,
> > > >
> > > > A problem with INamingContainer reflecting Validator control:
> > > >
> > > > Exact Implementation:
> > > >
> > > > I have a class that Inherits TableRow and implementsByVal> > > >
> > > > Public Class TestClass
> > > > Inherits TableRow
> > > > Implements INamingContainer
> > > >
> > > > End Class
> > > >
> > > >
> > > > In the CreateChildControls i have following Code:
> > > >
> > > > tblMain = New Table()
> > > > Me.Controls.Add(tblMain)
> > > > Call AddEntryControls()
> > > > AddEntryContorls Method has this code:
> > > >
> > > > Private Sub AddEntryControls()
> > > > tblMain.ID = "tblEntry"
> > > > Dim objViewRowProp As New TableRow()
> > > >
> > > > AddControlToTable(objViewRowProp, 1532)
> > > > AddControlToTable(objViewRowProp, 2663)
> > > > AddControlToTable(objViewRowProp, 3726)
> > > > End Sub
> > > >
> > > > And AddControlToTable does this:
> > > >
> > > >
> > > > Private Sub AddControlToTable(ByVal aobjViewRowProp As TableRow,TXT1532> Optional> > > > aintFieldRID As Int64, Optional ByVal astrCount As String = "",> > > > ByVal ablnAddValidator As Boolean = True)
> > > > Dim mobjViewRow As New TestClass()
> > > >
> > > > Dim tdCaption As New TableCell()
> > > > Dim tdMandatory As New TableCell()
> > > > Dim tdControl As New TableCell()
> > > > Dim tdDescription As New TableCell()
> > > >
> > > > Dim x As New TextBox()
> > > >
> > > > x.ID = "TXT" & aintFieldRID
> > > >
> > > > If x.ID = "TXT3726" Then
> > > > Dim rfv As New RegularExpressionValidator()
> > > >
> > > > With rfv
> > > > .ControlToValidate = "TXT1532"
> > > > .ValidationExpression =
> > > > "\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"
> > > > .ErrorMessage = "test me"
> > > > .Display = ValidatorDisplay.Dynamic
> > > > End With
> > > > tdDescription.Controls.Add(rfv)
> > > > End If
> > > >
> > > > tdControl.Controls.Add(x)
> > > >
> > > > mobjViewRow.Cells.Add(tdCaption)
> > > > mobjViewRow.Cells.Add(tdMandatory)
> > > > mobjViewRow.Cells.Add(tdControl)
> > > > mobjViewRow.Cells.Add(tdDescription)
> > > >
> > > > tblMain.Rows.Add(mobjViewRow)
> > > >
> > > > End Sub
> > > >
> > > > NOTICE, WHEN WE ARE ADDING "TXT3726" WE VALIDATE "TXT1532".
> > > >
> > > > Now, the problem is if i try to run this code it says control> fine> > not> > > > found. And if i remove implementation of INamingContainer it works>> >> > > !!!
> > > >
> > > > What could be the reason ???
> > > >
> > > > Any help would be highly appreciated.
> > > >
> > > >
> > > >
> > > > Thanks in advance,
> > > >
> > > > Satinder Singh
> > > >
> > > >
> > > >
> > > >
> > > >
> > >
> > >
> >
>
SatinderGT Guest
-
contribute problem - access denied file may not existpermission problem
Recieving the following error message - "access denied file may not exist , or there could be a permission problem" this happened this morning ,... -
INamingContainer has change my controls event order.....
Hi All, I have built a composite user web control and I've NOT implemented INamingContainer. It does implement IPostBackDataHandler to retrieve... -
Uploading problem = weird warning (was: access denied problem.....)
Hi, I had a problem where my upload form was not working on our production server but was working on two other servers, after checking the... -
#21611 [Opn]: Problem with version_compare() (Was: Problem with pear cli and release numbers)
ID: 21611 Updated by: et@php.net -Summary: Problem with pear cli and release numbers Reported By: jan at horde... -
Problem with Apache Web Server config file and PHP (please give advice on what problem may be me)
HI: Can anyone refer me to someone that can help with the problem below. I installed Apache Web Server on my laptop which has Windows XP. I... -
William F. Robertson, Jr. #2
Re: problem with INamingContainer
Okay, I have been researching this for a while and here is what I came up
with. The short answer is to NOT use INamingContainer. However, not using
it, you will have to come up with your own naming scheme to guarantee there
are not any duplicate names.
Using INamingContainer will guarantee all controls added with have a unique
name. What is happening is the naming interface is giving the textbox
control a unique name: sat_thisrow1532_txt1532. When the sat_thisrow3726 is
rendering the validator on it is to txt1532, but it is being appended with
sat_thisrow3726_txt1532.
I looked and could not find a way to override the interface functionality
for a validate control id.
Points.
1) are you sure it is required to implement the INamingContainer? Could you
just implement your own naming scheme when you added the controls? ie
append the row name and id before the type. Kinda mimick the
INamingContainer functionality?
2) You could write a custom control for that cell, that inside the cell, you
write out the validator by hand. It is kinda a hack that way, but you know
what the html is supposed to look like, just look into registering a
validator with the page and go from there.
Sorry I couldn't be of any more assistance.
bill
"SatinderGT" <satinder@thegt.com> wrote in message
news:uP3TdzvODHA.3192@TK2MSFTNGP10.phx.gbl...TRYING> Ya sure,
>
> this is the code for 3 text boxes generated:
>
>
> </div><div id="Panel1" style="height:212px;width:380px;Z-INDEX: 102; LEFT:
> 439px; POSITION: absolute; TOP: 386px">
> Panel<span id="Sat"><table id="Sat_tblEntry" border="0">
> <tr id="Sat_ThisRow1532">
> <td></td><td></td><td><input name="Sat:ThisRow1532:TXT1532" type="text"
> id="Sat_ThisRow1532_TXT1532" /></td><td></td>
> </tr><tr id="Sat_ThisRow2663">
> <td></td><td></td><td><input name="Sat:ThisRow2663:TXT2663" type="text"
> id="Sat_ThisRow2663_TXT2663" /></td><td></td>
> </tr><tr id="Sat_ThisRow3726">
> <td></td><td></td><td><input name="Sat:ThisRow3726:TXT3726" type="text"
> id="Sat_ThisRow3726_TXT3726" /></td><td><span id="Sat_ThisRow3726__ctl0"
> controltovalidate="Sat_ThisRow3726_TXT3726" errormessage="test me"
> display="Dynamic"
> evaluationfunction="RegularExpressionValidatorEval uateIsValid"
> validationexpression="\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"
> style="color:Red;display:none;">test me</span></td>
> </tr>
> </table></span>
>
> Just for your info:
>
> I even tried to use page.findcontrol and set the uniqueid, clientid and id
> properties individually for the control, but it doesn't works!!!
>
> Also, i tried to set Sat:ThisRow1532:TXT1532
> Also, i tired to set ThisRow1532:TXT1532
> Also, i tried to set Sat_ThisRow1532_TXT1532
>
> But, all in the above cases it fails and says control not found.
> JUST TO REMIND AGAIN WHEN I AM RENDERID "TXT3726" AT THAT TIME I Mit.> TO VALIDATE "TXT1532",
> REASON: I WANT TO USE COMPAREVALIDATOR ON IT.
>
> Waiting for reply,
>
> thanks in advance,
> satinder
>
>
> "William F. Robertson, Jr." <wfrobertson@kpmg.com> wrote in message
> news:Oiter8dODHA.1748@TK2MSFTNGP11.phx.gbl...> it> > So you are saying you are passing aobjViewRowProp because you were using> > in the past, but now you are trying to use the TestClass mobjViewRow?
> >
> > Try also changing the ControlToValidate to x.ID instead of hard codinghave> > I know on my composite controls, (that implement INamingContainer) Ithe> to> > reference the exact ID of it. I couldn't just type it in, because ofadd> little> > UniqueID that gets generated for INamingContainer.
> >
> > Would you post a sample of what your view source from IE looks like? I
> > think I just about have something figured out for you, I just need a> > bit more.
> >
> > bill
> >
> > "SatinderGT" <satinder@thegt.com> wrote in message
> > news:#fWMdEVODHA.2096@TK2MSFTNGP12.phx.gbl...> > > Hi William,
> > >
> > > aobjViewRowProp is declared as type TableRow and this row is used tofine.> > the> > > cotnrols.
> > > If i declare it as tablerow and do what is rquired, then it worksvalue> > But,> > > if i declare aobjViewRowProp as TestClass (that implements
> > > INamingContainer), then it says Control TXT1532 not found. If i do not
> > > implement INamingContainer it works fine (but implementation of
> > > INamingContainer is required).
> > > Note that if i change the condition to :
> > >
> > > > > If x.ID = "TXT1532" Then
> > > > > Dim rfv As New RegularExpressionValidator()
> > > > >
> > > > > With rfv
> > > > > .ControlToValidate = "TXT1532"
> > > > > .ValidationExpression =
> > > > > "\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"
> > > > > .ErrorMessage = "test me"
> > > > > .Display = ValidatorDisplay.Dynamic
> > > > > End With
> > > > > tdDescription.Controls.Add(rfv)
> > > > > End If
> > >
> > > THE ABOVE CODE WORKS FINE !!! NOTE HERE TXT1532 IS CHECKED AND ADDED.
> > > IN PREVIOUS CODE TXT3726 WAS CHECKED AND TXT1532 WAS ADDED.
> > >
> > > I saw the source code carefully that the control has generated after
> > > INamingContainer, but specfying the ids generated by INamingContainer
> > > doesn't helps.
> > > I need this as i want to add CompareValidator, i want to check thewhen> > of> > questions.> > > one control with another. All happens Dynamically.
> > >
> > >
> > > Please help.
> > >
> > > thanks
> > > sat
> > >
> > >
> > > "William F. Robertson, Jr." <wfrobertson@kpmg.com> wrote in message
> > > news:uS4juQ0NDHA.2788@TK2MSFTNGP10.phx.gbl...
> > > > This probably won't solve your problem, but these are just some> > > >
> > > > Why are you passing in aobjViewRowProp to AddControlToTable(...)how> > you> > > > aren't using it inside your method?
> > > >
> > > > Look at the source code generated using the INamingContainer. Seeas> at> > it> > > is
> > > > naming your control. I can't think of how it would be now, but look> > it> > > > and make sure the ControlToValidate property rendered are the same> INamingContainer> > the> > > > clientID of the control you are wishing to develop.
> > > >
> > > > bill
> > > >
> > > >
> > > >
> > > > "SatinderGT" <satinder@thegt.com> wrote in message
> > > > news:u92RWqxNDHA.2064@TK2MSFTNGP10.phx.gbl...
> > > > > Dear Group,
> > > > >
> > > > > A problem with INamingContainer reflecting Validator control:
> > > > >
> > > > > Exact Implementation:
> > > > >
> > > > > I have a class that Inherits TableRow and implements> ByVal> > > > >
> > > > > Public Class TestClass
> > > > > Inherits TableRow
> > > > > Implements INamingContainer
> > > > >
> > > > > End Class
> > > > >
> > > > >
> > > > > In the CreateChildControls i have following Code:
> > > > >
> > > > > tblMain = New Table()
> > > > > Me.Controls.Add(tblMain)
> > > > > Call AddEntryControls()
> > > > > AddEntryContorls Method has this code:
> > > > >
> > > > > Private Sub AddEntryControls()
> > > > > tblMain.ID = "tblEntry"
> > > > > Dim objViewRowProp As New TableRow()
> > > > >
> > > > > AddControlToTable(objViewRowProp, 1532)
> > > > > AddControlToTable(objViewRowProp, 2663)
> > > > > AddControlToTable(objViewRowProp, 3726)
> > > > > End Sub
> > > > >
> > > > > And AddControlToTable does this:
> > > > >
> > > > >
> > > > > Private Sub AddControlToTable(ByVal aobjViewRowProp As TableRow,> TXT1532> > Optional> > > > > aintFieldRID As Int64, Optional ByVal astrCount As String = "",> > > > > ByVal ablnAddValidator As Boolean = True)
> > > > > Dim mobjViewRow As New TestClass()
> > > > >
> > > > > Dim tdCaption As New TableCell()
> > > > > Dim tdMandatory As New TableCell()
> > > > > Dim tdControl As New TableCell()
> > > > > Dim tdDescription As New TableCell()
> > > > >
> > > > > Dim x As New TextBox()
> > > > >
> > > > > x.ID = "TXT" & aintFieldRID
> > > > >
> > > > > If x.ID = "TXT3726" Then
> > > > > Dim rfv As New RegularExpressionValidator()
> > > > >
> > > > > With rfv
> > > > > .ControlToValidate = "TXT1532"
> > > > > .ValidationExpression =
> > > > > "\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"
> > > > > .ErrorMessage = "test me"
> > > > > .Display = ValidatorDisplay.Dynamic
> > > > > End With
> > > > > tdDescription.Controls.Add(rfv)
> > > > > End If
> > > > >
> > > > > tdControl.Controls.Add(x)
> > > > >
> > > > > mobjViewRow.Cells.Add(tdCaption)
> > > > > mobjViewRow.Cells.Add(tdMandatory)
> > > > > mobjViewRow.Cells.Add(tdControl)
> > > > > mobjViewRow.Cells.Add(tdDescription)
> > > > >
> > > > > tblMain.Rows.Add(mobjViewRow)
> > > > >
> > > > > End Sub
> > > > >
> > > > > NOTICE, WHEN WE ARE ADDING "TXT3726" WE VALIDATE "TXT1532".
> > > > >
> > > > > Now, the problem is if i try to run this code it says control>> > fine> > > not
> > > > > found. And if i remove implementation of INamingContainer it works> >> > > > !!!
> > > > >
> > > > > What could be the reason ???
> > > > >
> > > > > Any help would be highly appreciated.
> > > > >
> > > > >
> > > > >
> > > > > Thanks in advance,
> > > > >
> > > > > Satinder Singh
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
>
William F. Robertson, Jr. Guest
-
Sergio FLorez M. #3
Problem with INamingContainer
I created a composite control which works just fine. I want to be able to
set the focus to one of its contained controls (a textbox) but this is
giving me a javascript error. The problem is that the ClientID property of
the contained textbox is not giving me the correct value. When I debug the
application the contained textbox's ClientID is "myControl__ctl1", but when
I look at the generated HTML the input tag looks like this: <input
name="myControl:_ctl1" ... />
How did the first "_" turn into ":" and how do I fix this?
--
Sergio Florez M.
Medellín, Colombia
Sergio FLorez M. Guest
-
lisa@starways.net #4
Re: Problem with INamingContainer
You don't, really. The ID will be NamingContainerID_ChildID, and the
name will be NamingContainerID:ChildID. That's just the way it works.
If you're using Javascript, you could do
document.getElementById(ClientID).focus()
Otherwise, you're going to have to override Render and manually set the
name equal to the id. That's a pain, and unnecessary.
Lisa
Sergio FLorez M. wrote:> I created a composite control which works just fine. I want to be able to
> set the focus to one of its contained controls (a textbox) but this is
> giving me a javascript error. The problem is that the ClientID property of
> the contained textbox is not giving me the correct value. When I debug the
> application the contained textbox's ClientID is "myControl__ctl1", but when
> I look at the generated HTML the input tag looks like this: <input
> name="myControl:_ctl1" ... />
>
> How did the first "_" turn into ":" and how do I fix this?
>
> --
> Sergio Florez M.
> Medellín, Colombialisa@starways.net Guest
-
Sergio FLorez M. #5
Re: Problem with INamingContainer
Actually, that's exactly what I was using -
document.getElementById(ClientID).focus()
The solution is really simple. Instead of ClientID I have to use UniqueID.
--
Sergio Florez M.
Medellín, Colombia
<lisa@starways.net> wrote in message
news:1119281080.663361.21240@g49g2000cwa.googlegro ups.com...
You don't, really. The ID will be NamingContainerID_ChildID, and the
name will be NamingContainerID:ChildID. That's just the way it works.
If you're using Javascript, you could do
document.getElementById(ClientID).focus()
Otherwise, you're going to have to override Render and manually set the
name equal to the id. That's a pain, and unnecessary.
Lisa
Sergio FLorez M. wrote:when> I created a composite control which works just fine. I want to be able to
> set the focus to one of its contained controls (a textbox) but this is
> giving me a javascript error. The problem is that the ClientID property of
> the contained textbox is not giving me the correct value. When I debug the
> application the contained textbox's ClientID is "myControl__ctl1", but> I look at the generated HTML the input tag looks like this: <input
> name="myControl:_ctl1" ... />
>
> How did the first "_" turn into ":" and how do I fix this?
>
> --
> Sergio Florez M.
> Medellín, Colombia
Sergio FLorez M. Guest



Reply With Quote

