Identify ControlID ???

0 views
Skip to first unread message

Raj

unread,
Jun 28, 2005, 10:26:56 PM6/28/05
to DotNetDe...@googlegroups.com
Sir,
I have this one aspx page in which I am using same user control
several times.
Only purpose of this control is to provide 4 set of 4 text boxes.

How do I identify ID of this textboxes ?.

What I am trying is very first time page loads I want some default
text appear in this boxes eg: "Please enter text here"

I tried, view source and copied those id of text boxes but it dose
not work.

Any ideas ?

Thanks

Raj

yu owen

unread,
Jun 28, 2005, 11:29:36 PM6/28/05
to DotNetDe...@googlegroups.com
Could you paste your code?
--
yours owen

Raj

unread,
Jun 29, 2005, 10:39:53 AM6/29/05
to DotNetDe...@googlegroups.com
<%@ Register TagPrefix="HeaderTagPrefix" TagName="HeaderTagName"
Src="controls/Header.ascx" %>
<%@ Register TagPrefix="VerticleMenuTagPrefix"
TagName="VerticleMenuTagName" Src="controls/VerticleMenu.ascx" %>
<%@ Register TagPrefix="FooterTagPrefix" TagName="FooterTagName"
Src="controls/Footer.ascx" %>
<%@ Register TagPrefix="ContLinkTagPrefix" TagName="ContLinkTagName"
Src="controls/ContentLinkEdit.ascx" %>
<%@ Page language="c#" Codebehind="PortalContentManage.aspx.cs"
AutoEventWireup="false" Inherits="_1to1Admin.PortalContentManage" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>Manage Portal Content</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
<link href="Styles.css" type="text/css" rel="stylesheet">
</HEAD>
<body>
<HEADERTAGPREFIX:HEADERTAGNAME id="ctlHeader"
runat="server"></HEADERTAGPREFIX:HEADERTAGNAME>
<VERTICLEMENUTAGPREFIX:VERTICLEMENUTAGNAME id="cntlVMenu"
runat="server"></VERTICLEMENUTAGPREFIX:VERTICLEMENUTAGNAME>
<form id="Form1" method="post" runat="server">
<td align="left" valign="top" width="560px"
style="PADDING-RIGHT:0px; PADDING-LEFT:0px; PADDING-BOTTOM:0px;
MARGIN:0px; PADDING-TOP:0px">
<table border="0" cellpadding="0" cellspacing="0" width="560">
<tr width="560px">
<td width="370" align="left" style="BORDER-TOP:#cccccc 1px solid;
PADDING-BOTTOM:10px">
<span style="MARGIN-TOP:10px; FONT-SIZE:8pt; PADDING-TOP:10px;
FONT-FAMILY:verdana">
To add or edit content, complete the appropriate fields, then
click submit
button to update the portal with the content changes</span>
<hr size="1" color="#cccccc">
</td>
<td width="190" align="right" valign="top"
style="PADDING-LEFT:10px">
<img src="images/08PrtlMngPrtlCntnt_lg_img.jpg"
style="PADDING-RIGHT: 0px;PADDING-LEFT: 0px;PADDING-BOTTOM:
0px;PADDING-TOP: 0px">
</td>
</tr>
</table>
<table width="370" border="1" cellpadding="0" cellspacing="0">
<tr width=370 align=left valign=top>
<td width=370 align=left valign=top>
<asp:Label ID=MessageLabel Runat=server
CssClass=ErrorMessage></asp:Label></td></tr>
<tr width="370" valign=top>
<td width="370" align="left" valign=top>
<span style="FONT-SIZE:8pt; FONT-FAMILY:verdana; valign:top;
padding:0px 0px 5px 0px;">Select Company/Cluster:</span>
<asp:DropDownList ID="CompanyDropDown" Runat="server"
AutoPostBack=True ></asp:DropDownList>
</td>
</tr>
</table>
<asp:Panel ID="RestOfTheForm" Runat="server">
<DIV style="WIDTH: 370px; LINE-HEIGHT: 0.8em"><SPAN
style="FONT-SIZE: 8pt; FONT-FAMILY: verdana">Portal Block 2 (B2)
Content</SPAN><BR>
<HR SIZE=1>
</DIV>
<ContLinkTagPrefix:ContLinkTagName id=cntlContLink
runat="server"></ContLinkTagPrefix:ContLinkTagName>
<DIV style="WIDTH: 370px; LINE-HEIGHT: 0.8em; designtimesp: 3612"><SPAN

style="FONT-SIZE: 8pt; FONT-FAMILY: verdana">Portal Block 4(B4)
Content</SPAN><BR>
<HR SIZE=1>
</DIV>
<TABLE cellSpacing=0 cellPadding=0 width=370 border=0>
<TR>
<TD vAlign=middle align=left>
<TABLE cellSpacing=0 cellPadding=0 border=0>
<TR>
<TD><IMG
style="PADDING-RIGHT: 5px; WIDTH: 64px; PADDING-TOP: 5px;
HEIGHT: 64px"
src=""> </TD></TR></TABLE></TD>
<TD>
<TABLE>
<TR>
<TD vAlign=top align=left><SPAN>Image Name</SPAN></TD></TR>
<TR>
<TD vAlign=bottom align=left><INPUT type=button
value=">>Add/Upload Image">
</TD></TR></TABLE></TD></TR></TABLE>
<DIV style="WIDTH: 370px"><STRONG><SPAN
style="FONT-SIZE: 8pt; FONT-FAMILY: verdana; align: left">B4 Link #
1</SPAN>
</STRONG><BR>
<HR SIZE=1>
</DIV>
<ContLinkTagPrefix:ContLinkTagName id=Contlinktagname1
runat="server"></ContLinkTagPrefix:ContLinkTagName><BR>
<DIV style="WIDTH: 370px"><STRONG><SPAN
style="FONT-SIZE: 8pt; FONT-FAMILY: verdana; align: left">B4 Link #
2</SPAN>
</STRONG><BR>
<HR SIZE=1>
</DIV>
<ContLinkTagPrefix:ContLinkTagName id=Contlinktagname2
runat="server"></ContLinkTagPrefix:ContLinkTagName><BR>
<DIV style="WIDTH: 370px"><STRONG><SPAN
style="FONT-SIZE: 8pt; FONT-FAMILY: verdana; align: left">B4 Link #
3</SPAN>
</STRONG><BR>
<HR SIZE=1>
</DIV>
<ContLinkTagPrefix:ContLinkTagName id=Contlinktagname3
runat="server"></ContLinkTagPrefix:ContLinkTagName><BR>
<TABLE cellSpacing=0 cellPadding=0 width=370 border=0>
<TR width="370">
<TD style="PADDING-LEFT: 5px" vAlign=middle align=left
bgColor=darkblue>
<asp:CheckBox id=DisplayB5 Runat="server" Text="B5 (optional)"
Font-Name="verdana" Font-Size="8pt"
ForeColor="#ffffff"></asp:CheckBox></TD></TR></TABLE>
<TABLE id=B5LinkTable cellSpacing=0 cellPadding=0 width=370 border=0
runat="server">
<TR>
<TD vAlign=middle align=left width=185><SPAN
style="FONT-SIZE: 8pt; FONT-FAMILY: verdana">Link Text:</SPAN>
</TD>
<TD vAlign=middle align=left width=185><SPAN
style="FONT-SIZE: 8pt; FONT-FAMILY: verdana">Link URL:</SPAN>
</TD></TR>
<TR>
<TD vAlign=middle align=left width=185>
<asp:TextBox id=LinkText1 Width="100px"
Runat="server"></asp:TextBox></TD>
<TD vAlign=middle align=left width=185>
<asp:TextBox id=TextURL1 Width="100px"
Runat="server"></asp:TextBox></TD></TR>
<TR>
<TD vAlign=middle align=left width=185><SPAN
style="FONT-SIZE: 8pt; FONT-FAMILY: verdana">Link Text:</SPAN>
</TD>
<TD vAlign=middle align=left width=185><SPAN
style="FONT-SIZE: 8pt; FONT-FAMILY: verdana">Link URL:</SPAN>
</TD></TR>
<TR>
<TD vAlign=middle align=left width=185>
<asp:TextBox id=Textbox2 Width="100px"
Runat="server"></asp:TextBox></TD>
<TD vAlign=middle align=left width=185>
<asp:TextBox id=TextURL2 Width="100px"
Runat="server"></asp:TextBox></TD></TR>
<TR>
<TD vAlign=middle align=left width=185><SPAN
style="FONT-SIZE: 8pt; FONT-FAMILY: verdana">Link Text:</SPAN>
</TD>
<TD vAlign=middle align=left width=185><SPAN
style="FONT-SIZE: 8pt; FONT-FAMILY: verdana">Link URL:</SPAN>
</TD></TR>
<TR>
<TD vAlign=middle align=left width=185>
<asp:TextBox id=Textbox3 Width="100px"
Runat="server"></asp:TextBox></TD>
<TD vAlign=middle align=left width=185>
<asp:TextBox id=TextURL3 Width="100px"
Runat="server"></asp:TextBox></TD></TR>
<TR width="370">
<TD style="PADDING-TOP: 2px" width=370 bgColor=#cccccc colSpan=2
height=10></TD></TR></TABLE>
<DIV style="WIDTH: 370px; PADDING-TOP: 5px">
<HR SIZE=1>
<BR></DIV>
<DIV style="WIDTH: 370px" align=right>
<asp:Button id=Submit Runat="server" Text="Submit"></asp:Button></DIV>
</asp:Panel>
</td></TR></TABLE>
</form>
<FooterTagPrefix:FooterTagName id="cntlFooter" runat="server" />
</body>
</HTML>

Raj

unread,
Jun 29, 2005, 10:46:21 AM6/29/05
to DotNetDe...@googlegroups.com
code for user control is


***********************
<%@ Control Language="c#" AutoEventWireup="false"
Codebehind="ContentLinkEdit.ascx.cs"
Inherits="_1to1Admin.controls.ContentLinkEdit"
TargetSchema="http://schemas.microsoft.com/intellisense/ie5"%>
<%@ Register TagName="ContItemEditTagName"
TagPrefix="ContItemEditTagPrefix" Src="ContentItemEdit.ascx" %>
<table width="370" border="0" cellpadding="0" cellspacing="0">
<tr width="370">
<td width="370" align="left" valign="middle">
<span style="FONT-SIZE:8pt; FONT-FAMILY:verdana">Select Topic
Code</span>


</td>
</tr>
<tr width="370">

<td width="370" align="left" valign="middle">
<asp:DropDownList ID="TopicCodeDropDown" Runat="server"
Width=100px/>
</td>
<tr width="370">
<td>
<ContItemEditTagPrefix:ContItemEditTagName id="ContLinkEdit"
runat="server" />
</td>
</tr>
</table>

*********************************************

code for user control used in above code is:
***************************

<%@ Control Language="c#" AutoEventWireup="false"
Codebehind="ContentItemEdit.ascx.cs"
Inherits="_1to1Admin.controls.ContentItemEdit"
TargetSchema="http://schemas.microsoft.com/intellisense/ie5"%>
<table width="370" border="0" cellpadding="0" cellspacing="0">
<tr width="370">
<td width="50%" align="left" valign="middle">
<span style="FONT-SIZE:8pt; FONT-FAMILY:verdana; align:left">Link
Text</span>
</td>
<td width="50%" align="left" valign="middle">
<span style="FONT-SIZE:8pt; FONT-FAMILY:verdana; align:left">Link
URL</span>


</td>
</tr>
<tr width="370">

<td width="185px" align="left" valign="middle">
<asp:TextBox ID="LinkTextTextBox" Runat="server"></asp:TextBox>
</td>
<td width="185px" align="left" valign="middle">
<asp:TextBox ID="LinkUrlTextBox" Runat="server"></asp:TextBox><br>
</td>
</tr>
</table>
<table border=0 cellpadding=0 cellspacing=0 width=370>
<tr width="370">
<td width="370" align="left" valign="middle">


<span style="FONT-SIZE:8pt; FONT-FAMILY:verdana;

align:left">Content</span>


</td>
</tr>
<tr width="370">

<td width="370" align="left" valign="middle">
<asp:TextBox Width=370 Rows="6" TextMode="MultiLine"
ID="ContentTextBox" Runat="server"></asp:TextBox>
</td>
</tr>
</table>
**********************

yu owen

unread,
Jun 30, 2005, 10:16:22 PM6/30/05
to DotNetDe...@googlegroups.com
Hi Raj

I hope my reply is not too late.

You can add property in user control to solve this problem.

*********************ContentItemEdit.ascx.cs add the source below************************

public string setTextChild
        {
            set
            {
                LinkUrlTextBox.Text = value;
            }
            get
            {
                return LinkUrlTextBox.Text;
            }
        }

*********************ContentLinkEdit.ascx.cs add the source below************************

public string setTextParent
        {
            set
            {
                ContLinkEdit.setTextChild = value;
            }
            get
            {
                return ContLinkEdit.setTextChild;
            }
        }

*********************PortalContentManage.aspx.cs add the source below ************************

private void Page_Load(object sender, System.EventArgs e)
        {
           ......
            if(!Page.IsPostBack)
            {
                ContentLinkEdit1.setTextParent = "Please enter text here";
            }
            ......
        }

Hope this way can help you.


On 6/29/05, Raj <vima...@gmail.com> wrote:



--
yours owen

Raj

unread,
Jul 2, 2005, 2:10:07 PM7/2/05
to DotNetDe...@googlegroups.com
Thanks yu.

I'll try this.

Raj

Reply all
Reply to author
Forward
0 new messages