ModalPopupExtender in UserControl - user-controls

I want to have a UserControl which represents an input dialog (panel with customizable labels and textboxes). This UserControl needs to be opened via a ModalPopupExtender.
I started with the following solution which works, but is not in a UC:
<!-- Popup to add brand -->
<asp:Panel ID="pnlAddPopup" DefaultButton="cmdOk" runat="server" style="display: none;">
<atk:ModalPopupExtender ID="popupExtender" runat="server" TargetControlID="cmdAdd" PopupControlID="pnlAddPopup" CancelControlID="cmdAbbrechen" BackgroundCssClass="modalBackground" />
<div id="Div1" style="border-style: none; padding: 5px;" runat="server">
<table style="border: 0">
<tr>
<td style="background-color: #CCCCCC; height: 15px; text-align: right" />
</tr>
<tr>
<td style="background-color: #FFE580;">
<div style="padding: 10px;">
<cc1:SDDataLabel ID="name" runat="server" Text="Name"/>
<cc1:SDTextBox ID="txtInput" Width="300" runat="server"/>
</div>
</td>
</tr>
<tr>
<td style="background-color: #FFE580; height: 20px; text-align: center">
<cc1:SDButton ID="cmdOk" OnClick="CmdAddOkClick" CssClass="button" runat="server" />
<cc1:SDButton ID="cmdAbbrechen" CssClass="button" runat="server" />
</td>
</tr>
</table>
</div>
</asp:Panel>
What I would prefer: If I could add one single line like
<uc1:InputPopup ID="inputPopup" runat="server" TargetControlID="cmdAdd"/>
So I created the following "InputPopup" UserControl:
<%# Control Language="C#" AutoEventWireup="true" CodeBehind="InputPopup.ascx.cs" Inherits="ABC.InputPopup" %>
<%# Register Assembly="ABC" TagPrefix="cc1" Namespace="ABC" %>
<atk:ModalPopupExtender ID="popupExtender" runat="server" PopupControlID="pnlAddPopup" CancelControlID="cmdAbbrechen" BackgroundCssClass="modalBackground" />
<asp:Panel ID="pnlAddPopup" DefaultButton="cmdOk" runat="server" style="display: none;">
<div id="Div1" style="border-style: none; padding: 5px;" runat="server">
<table style="border: 0">
<tr>
<td style="background-color: #CCCCCC; height: 15px; text-align: right" />
</tr>
<tr>
<td style="background-color: #FFE580;">
<div style="padding: 10px;">
<cc1:SDDataLabel ID="name" runat="server" Text="Name"/>
<cc1:SDTextBox ID="txtInput" Width="300" runat="server"/>
</div>
</td>
</tr>
<tr>
<td style="background-color: #FFE580; height: 20px; text-align: center">
<cc1:SDButton ID="cmdOk" OnClick="CmdAddOkClick" CssClass="button" runat="server" />
<cc1:SDButton ID="cmdAbbrechen" CssClass="button" runat="server" />
</td>
</tr>
</table>
</div>
</asp:Panel>
In addition, I have the code behind file which does define the property TargetControlID.
public TargetControlID TargetControlID
{
set{ popupExtender.TargetControlID = value;}
}
This solution would be great, but does not work, since the ModalPopupExtender is not listening on the cmdAdd since the cmdAdd is placed in the parent control...
My question: Is it possible to overwrite the TargetControlID setter of ModalPopupExtender in order to listen to the right control click event (the one which is located in the parent control in my case)?
Or is there any other solution for my problem? I read about using
$("#<%= popupExtender.ClientID").show()
as OnClientClick function on the TargetControl, but I am not able to do this in the parent control, since popupExtender would be in the UC.
What also works is the following solution. But I would prefer the "one line UC solution" above, without the ModalPopupExtender in the parent control
<cc1:SDButton ID="cmdAdd" CssClass="button" runat="server" />
<!-- Popup to add brand -->
<atk:ModalPopupExtender ID="popupExtender" runat="server" TargetControlID="cmdAdd" PopupControlID="pnlAddPopup" BackgroundCssClass="modalBackground" />
<asp:Panel ID="pnlAddPopup" runat="server">
<uc1:InputPopup ID="inputPopup" runat="server"/>
</asp:Panel>

The code of the UserControl with the ModalPopupExtender -> PopupInputPanelOkCancel.ascx
<%# Control Language="C#" AutoEventWireup="true" CodeBehind="PopupInputPanelOkCancel.ascx.cs" Inherits="ABC.PopupPanels.PopupInputPanelOkCancel" %>
<%# Register TagPrefix="atk" Namespace="AjaxControlToolkit" Assembly="AjaxControlToolkit, Version=4.5.7.607, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e" %>
<span style="display:none">
<asp:Button runat="server" ID="dummyButton" />
</span>
<atk:ModalPopupExtender ID="popupExtender" runat="server" PopupControlID="pnlPopup" TargetControlID="dummyButton" CancelControlID="cmdAbbrechen" BackgroundCssClass="modalBackground" />
<asp:Panel ID="pnlPopup" DefaultButton="cmdOk" runat="server">
<div id="Div1" style="border-style: none; padding: 5px;" runat="server">
<table style="border: 0">
<tr>
<td style="background-color: #CCCCCC; height: 15px; text-align: right" />
</tr>
<tr>
<td style="background-color: #FFE580;">
<div style="padding: 10px;">
<asp:Label ID="lblLabel" runat="server" Text="Name"/>
<asp:TextBox ID="txtInput" Width="300" runat="server"/>
</div>
</td>
</tr>
<tr>
<td style="background-color: #FFE580; height: 20px; text-align: center">
<asp:Button ID="cmdOk" OnClick="CmdOkClick" CssClass="button" runat="server" />
<asp:Button ID="cmdAbbrechen" CssClass="button" runat="server" />
</td>
</tr>
</table>
</div>
</asp:Panel>
In the code behind, I have a property to set the BehaviorId of the extender and one to get the field on which we should set the focus after the panel pops up -> PopupInputPanelOkCancel.ascx.cs
public string BehaviorId
{
get { return popupExtender.BehaviorID; }
set { popupExtender.BehaviorID = value; }
}
public string FocusId
{
get { return txtInput.ClientID; }
}
In the aspx page, I add the control like this:
<uc1:PopupInputPanelOkCancel ID="PopupInputPanelOkCancel1" BehaviorId="addPopupBehaviorId" runat="server"/>
Make sure that you add the scriptmanager on top of the page (if not added somewhere else in a parent control.
<asp:ScriptManager ID="asm" runat="server" />
To call the show method, I added the following code to a button:
<asp:Button ID="cmdSorteAdd" CssClass="button" runat="server" OnClientClick="showModalPopupExtender('addPopupBehaviorId');return false;" />
Additionally, I added the following javascript code at the end of the aspx page
<script type="text/javascript">
function pageLoad() {
// $find is not jQuery. It's from MS and returns an AJAX control.
var modal = $find('<%=PopupInputPanelOkCancel1.BehaviorId%>');
if (modal != null) {
modal.add_shown(modalPopupExtenderShown);
}
}
function showModalPopupExtender(modalBehaviorId) {
// $find is not jQuery. It's from MS and returns an AJAX control.
var modal = $find(modalBehaviorId);
if (modal != null) {
modal.show();
}
}
function modalPopupExtenderShown() {
//jQuery selector
$('#<%=PopupInputPanelOkCancel1.FocusId%>').focus();
}
</script
What I don't like yet is that I need to set the value of BehaviorId (addPopupBehaviorId) manually in the
OnClientClick="showModalPopupExtender('addPopupBehaviorId');return false;"
It would be perfect if one would need to add it only in the
<uc1:PopupInputPanelOkCancel ID="PopupInputPanelOkCancel1" BehaviorId="addPopupBehaviorId" runat="server"/>
But it does work :)
My problem I am still on is that when the function modalPopupExtenderShown is called, the focus() does fire a postback in my case. I don't understand why there is a postback. Do you have any ideas? -> Edit: I used the wrong function. I used Microsofts $find('id').focus() instead of jQuery's $('#id').focus() to set the focus. Now, everything works like a charm.
Other than that, my solution works fine and I hope that someone finds it useful.

Related

How to get only rely content(black color) and not included quote(blue color) content using Selenium and Python

I want to know what to get some content not include quote content.
The following url is the target webpage:
https://forumd.hkgolden.com/view.aspx?type=BW&message=7219211
I must use a full xpath to get their content. I want to get black color content and I don't want to get blue content, but when I use the following code. I got blue and blank content together.
content = driver_blank.find_element_by_xpath('/html/body/form/div[5]/div/div/div[2]/div[1]/div[5]/table[8]/tbody/tr/td/table/tbody/tr/td[2]/table/tbody/tr[1]/td/div')
print(content.text)
The following is their html code:
<table width="100%" cellpadding="0" cellspacing="0" style="margin-bottom: 7px;">
<tbody>
<tr>
<td align="left">
<table class="repliers">
<tbody>
<tr hc7uwnfktbez9="" id="XoBTa" userid="461194" username="浅川梨奈">
<td class="repliers_left" style="background-color: #F3F2F1;">
<div>
<a name="275220714"></a>
<a href="javascript: ToggleUserDetail(6, 'XoBTa');" style="font-weight: bold; color: #FF0066;">
浅川梨奈
</a>
<br>
<br>
<div id="ThreadUser6" style="position: relative;">
<a href="/ProfilePage.aspx?userid=461194" style="text-decoration: none;">
<img src="/icons/97.gif" style="border-width: 0px;" alt="Logo">
</a>
<br>
<br>
<img src="/labels/4.gif" style="border-width: 0px;" alt="Member">
</div>
</div>
</td>
<td style="background-color: #F3F2F1; height: 100%; border: solid 1px #111111; vertical-align: top;">
<table class="repliers_right" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td style="vertical-align: top;">
<div class="ContentGrid">
<blockquote><div style="color: #0000A0;">有冇第隻款<img data-icons=":-[lm" src="/faces/lomore/angry.gif" alt=":-[lm"> <img data-icons=":-(lm" src="/faces/lomore/frown.gif" alt=":-(lm"> 我想要呢兩隻</div></blockquote>
<br>
係囉,反應好既會唔會考慮出其他?
<br>
我都想要其他
<img data-icons="^3^lm" src="/faces/lomore/kiss.gif" alt="^3^lm">
<img data-icons="[bomb]lm" src="/faces/lomore/bomb.gif" alt="[bomb]lm">
<br><br><br>
</div>
</td>
</tr>
<tr>
<td style="text-align: center; vertical-align: top;">
<div id="lineImage6" style="display: block; overflow: hidden;">
</div>
</td>
</tr>
<tr>
<td style="width: 100%; text-align: right;">
<div style="float: right; vertical-align: bottom; margin-top: 5px;">
<div id="lauming6" style="float: left; vertical-align: bottom;"></div>
<a class="btn btn_small btn_bookmark" href="Javascript:bookmarkThis(7219211)" id="laumingHref">留名</a>
<a class="btn btn_small btn_complain" href="contactus.aspx?messageid=7219211&replyid=275220714">投訴文章</a>
<a class="btn btn_small btn_quote" href="Javascript:QuoteReply(7219211,275220714);">快速引用</a>
<a class="btn btn_small btn_quote" href="post.aspx?mt=Y&rid=275220714&id=7219211&page=2">引用原文</a>
<span style="font-size: 12px; color:gray;">
15/4/2020 13:18
</span>
</div>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
I hope to use start-to, not, or contains instruction to finish it.
Can anyone help me? Thanks~~~

How to update a form that contains pivot tables with timer?

I am using a bootstrap carousel to pass the tables (these are generated from the db), I tried to use the prime-faces poll but it only recharges me once and after that the first table remains static and loses transition effect . Any recommendation...
psdta: Primefaces 4.0, and bootstrap 4 are part of the design.
<h:form id="tablas">
<p:ajaxStatus onstart="statusDialog.show();" onsuccess="statusDialog.hide();"/>
<p:dialog modal="true" widgetVar="statusDialog" resizable="false" draggable="false" closable="false"
showHeader="false" style="border: none; opacity: 0.75;">
<p:graphicImage id="refreshTable" value="./../resources/images/cargandoLogin.gif" style="width: 100px; height: 100px; " />
</p:dialog>
<div id="carouselExampleInterval" class="carousel slide" data-ride="carousel">
<div class="carousel-inner">
<div class="limiter">
<div class="container-table100">
<h:outputText value="#{beansSeguimientoRelease.dateTable}" escape="false"/>
<div class="carousel-item" data-interval="#{beansSeguimientoRelease.contTabla}">
<div id="main-container">
<div class="tituloN">NOTAS</div>
<table class="table table-bordered" style="text-orientation: upright;">
<thead>
<tr>
<th scope="col" style="background-color: #0f7ff4">TEMAS PENDIENTES</th>
<th scope="col" style="background-color: #0f7ff4">NOTAS</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left; border-left: 15px black !important;">
<h:outputText value="#{beansSeguimientoRelease.itemNotas.tareas}" escape="false"/> </td>
<td style="text-align: left;">
<h:outputText value="#{beansSeguimientoRelease.itemNotas.notas}" escape="false"/></td>
</tr>
<tr>
<td style="text-align: right;">Disponibilidad:</td>
<td><h:outputText value= "#{beansSeguimientoRelease.itemNotas.disponibilidad}" escape="false"/></td>
</tr>
<tr>
<td style="text-align: right;">Operador Noc:</td>
<td><h:outputText value="#{beansSeguimientoRelease.itemNotas.operador_noc}" escape="false"/> </td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<a id="aPrev" class="carousel-control-prev" href="#carouselExampleInterval" role="button" data-slide="prev" style="width: 5%">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a id="aNext" class="carousel-control-next" href="#carouselExampleInterval" role="button" data-slide="next" style="width: 5%">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
<p:poll id="Tpoll" interval="#{beansSeguimientoRelease.cont}" update="tablas"/>
</h:form>
I assume that problem is caused by fact that p:poll is inside h:form and that, by updating entire form, it updates itself too and stops working (maybe you can see something in JS debug console).
Try to wrap up carousel div into h:panelGroup like this
<h:panelGroup id="wrapper" layout="block">
<div id="carouselExampleInterval" class="carousel slide"...>
...
</div>
</h:panelGroup>
and then, when poll interval expires, update only newly added h:panelGroup
<p:poll id="Tpoll" interval="#{beansSeguimientoRelease.cont}" update=":tablas:wrapper"/>

XPATH Syntax - Katalon Studio

Hi,
I wanted to get the text from the webpage with Cucumber & Groovy in Katalon Studio. Please find the below Step Definition which has the xpath and below is the html code.
I wanted to read the below two lines from the page which can be referred in the html code also below. The number 596 varies each time i.e., dynamic.
Create Inquiry Tracking # 596
The inquiry for system tracking # 596 has been submitted successfully
Step Definition
inquiryt1 = WebUI.getText(findTestObject(By.xpath("//td[#class='pageTitle'][1]")))
Full Page HTML :
<html lang="en">
<head>
<title>Govt Inquiry</title>
<link rel="stylesheet" type="text/css" href="?appId=gmpinquiry&flName=/uitmpl/en/css/uitmpl.css" />
<link rel="stylesheet" type="text/css" href="?appId=gmpinquiry&flName=/gmpinquiry/css/gmpinquiry.css" />
<script type="text/javascript" src="?appId=gmpinquiry&flName=/uitmpl/js/other_scripts.js"></script>
<script type="text/javascript" src="?appId=gmpinquiry&flName=/uitmpl/js/freezingHeader.js"></script>
<script type="text/javascript" src="?appId=gmpinquiry&flName=/uitmpl/js/sortTable.js"></script>
<noscript>
<style>
table.mQH {display:block;}
</style>
</noscript>
<style id="antiClickjack">body{display:none !important;}</style>
<script type="text/javascript">
if (self === top) {
var antiClickjack = document.getElementById("antiClickjack");
antiClickjack.parentNode.removeChild(antiClickjack);
} else {
top.location = self.location;
}
</script>
</head>
<body onload="uitmpl_qhPageInit()">
<!-- Skip To Main Content should be the next element immediately after body element -->
<div class="skipnav">Skip to Main Content </div>
<script type="text/javascript" src="?appId=gmpinquiry&flName=/uitmpl/js/menu_script.js"></script>
<script type="text/javascript" src="?appId=gmpinquiry&flName=/uitmpl/js/application_settings.js"></script>
<script type="text/javascript" src="?appId=gmpinquiry&flName=/uitmpl/js/global_settings.js"></script>
<script language="javascript">
application.data = {
td_1: "Home",
td_2: "Govt Inquiry",
td_3: "Create Inquiry",
td_4: "Reports/Search",
td_5: "My Preference",
url_1: "javascript:OnGMPPortalSubmit(document.frmMenuScr, '')",
url_2: "javascript:OnMenuSubmit (document.frmMenuScr, 'homepage')",
url_3: "javascript:OnMenuDispatch (document.frmMenuScr, 'setupinquiry','create')",
url_4: "javascript:OnMenuSubmit (document.frmMenuScr, 'inqsubmenu')",
url_5: "javascript:OnMenuSubmit (document.frmMenuScr, 'userpref')"
};
global.data = {
//td_1: "AT&T BusinessDirect",
td_1: "Write Us",
td_2: "Help <span class=\"offscrn\"> - Opens a PDF Document for Help</span>",
td_3: "Close",
//td_3_1: "General Help",
//td_3_2: "Application Tutorial",
//td_3_3: "<span id=\"shHd\">Show</span> Quick Help",
//url_1: "javascript:bizDirect()",
url_1: "javascript:OnMenuSubmit(document.frmMenuScr, 'compose')",
url_2: "javascript:uitmpl_popUpReg(document.frmMenuScr.action + '?appId=' + document.frmMenuScr.appId.value + '&flName=' + document.frmMenuScr.context.value + '/help/Inquiry_UG.pdf')",
url_3: "javascript:window.close();"
//url_3_1: "javascript:uitmpl_popUpReg(document.frmMenuScr.action + \\'?appId=\\' + document.frmMenuScr.appId.value + \\'&flName=\\' + document.frmMenuScr.context.value + \\'/help/Inquiry_UG.pdf\\')",
//url_3_2: "#",
//url_3_3: "javascript:uitmpl_qhPageToggle()"
};
</script>
<script type="text/javascript" src="?appId=gmpinquiry&flName=/gmpinquiry/js/script.js"></script>
<!--************ uitmplbegin: tBAN ************-->
<!--****** begin:background graphic ******-->
<table width="100%" cellspacing="0" border="0" class="tBAN">
<tr>
<td><img src="?appId=gmpinquiry&flName=/uitmpl/en/img/swoosh.gif" width="650" height="69" alt="" border="0" /></td>
</tr>
</table>
<!--****** end:background graphic ******-->
<!--****** begin:logo and company title ******-->
<div class="logoCompany">
<table width="100%" cellspacing="0" border="0" class="tBAN">
<tr>
<td class="logo"><img src="?appId=gmpinquiry&flName=/uitmpl/en/img/attbizdirect.gif" width="291" height="63" alt="AT&T | Business Direct" border="0" /></td>
<td><!-- stretchable cell --></td>
<!-- max characters for company title: 72 w/ breaks (24 per line) -->
<td class="company">ATT Gov Sol Dev<br/>rm0013
<!-- Begin Skip Top Navigation -->
<!-- <div class="skipnav">Skip to Main Content</div> -->
<!-- End Skip Top Navigation --></td>
</tr>
</table>
</div>
<!--****** end:logo and company title ******-->
<!--****** begin:application title ******-->
<table cellspacing="0" border="0" class="appTitle">
<tr>
<td>View and Analyze Govt. Bills: Govt Inquiry</td>
</tr>
</table>
<!--****** end:application title ******-->
<!--************ uitmplend: tBAN ************-->
<!--************ uitmplbegin: tNAV ************-->
<div id="glbl">
<script language="JavaScript1.3">
<!--
uitmpl_list("global");
//-->
</script>
<noscript>
<div class="globalAcc">
<table class="global_main" cellspacing="0" border="0">
<tr>
<td class="global_main_spacer"> </td>
<td>AT&T BusinessDirect</td><td class="pipe">|</td><td>Write Us</td><td class="pipe">|</td><td>Help</td>
</tr>
</table>
</div>
</noscript>
</div>
<div id="app">
<script language="JavaScript1.3">
<!--
uitmpl_list("application");
//-->
</script>
<noscript>
<div class="applicationAcc"><table class="application_main" cellspacing="0" border="0">
<tr>
<td>Home</td>
<td class="pipe">|</td>
<td>Create/Update Dispute</td>
<td class="pipe">|</td>
<td>Reports/Search</td>
<td class="pipe">|</td>
<td>My Preference</td>
<td class="pipe">|</td>
<td>User Management</td>
</tr>
</table>
</div>
</noscript>
</div>
<!--************ uitmplend: tNAV ************-->
<form name="frmMenuScr" action="/servlet/GMPGate" method="get">
<input type="hidden" name="appId" value="gmpinquiry">
<input type="hidden" name="nextScr" value="userpref">
<input type="hidden" name="methodToCall" value=""/>
<input type="hidden" name="context" value="/gmpinquiry"/>
</form>
<!--***** begin:grid *****-->
<table width="100%" cellspacing="0" border="0" class="wrap">
<tr>
<td width="100%" class="grid">
<!-- InstanceBeginEditable name="PageHeader" -->
<!--************ uitmplbegin: tPH ************-->
<!--****** begin:titles ******-->
<table cellspacing="0" border="0" class="tPH">
<!--****** begin:page title ******-->
<tr>
<td class="pageTitle">Create Inquiry Tracking # 599</td>
</tr>
<!--****** end:page title ******-->
</table>
<!--****** end:titles ******-->
<!--************ uitmplend: tPH ************-->
<!-- InstanceEndEditable -->
</td>
<td width="182" class="grid"><img src="?appId=gmpinquiry&flName=/uitmpl/en/img/pixel.gif" width="182" height="1" alt="" border="0" /></td>
</tr>
</table>
<!--***** end:grid *****-->
<!--***** begin:grid *****-->
<table width="100%" cellspacing="0" border="0" class="wrap">
<tr>
<td width="100%" class="grid">
<!--- BeginOptional name="TaskConfirmation" --->
<!-- InstanceBeginEditable name="TaskConfirmation" -->
<!--************ uitmplbegin: mTC ************-->
<table cellspacing="0" cellpadding="2" border="0" class="mTC">
<tr class="msgConfirm">
<td> <img src="?appId=gmpinquiry&flName=/uitmpl/en/img/confirmation.gif" width="29" height="29"
border="0" alt="Confirmation." /></td><td>The inquiry for system tracking # 599 has been submitted successfully. </td>
</tr>
</table>
REASON FOR FAILED WITH THE SOLUTION
2019-06-26 18:40:10.049 ERROR c.k.k.c.c.keyword.CucumberReporter
- ❌ it should displays create inquiry pages FAILED.
Reason:
groovy.lang.MissingMethodException: No signature of method: static com.kms.katalon.core.testobject.ObjectRepository.findTestObject()
is applicable for argument types: (org.openqa.selenium.By$ByXPath) values: [By.xpath: //td[#class='pageTitle'][1]]
Possible solutions: findTestObject(java.lang.String), findTestObject(java.lang.String, java.util.Map) at CreateInquiry001.it_should_displays_create_inquiry_page2(CreateInquiry001.groovy:369)
at ✽.it should displays create inquiry pages(C:/Users/vdavuluri2/Katalon Studio/Govt Inquiry/Include/features/Create Inquiry-001.feature:55)
Katalon's findTestObject() method is used for selecting an object from the object repository. It doesn't work with By class.
You can try with something like the following: create an object with the given Xpath and then use WebUI.getText() on it:
TestObject testObject = new TestObject().addProperty("xpath", ConditionType.EQUALS, "//td[#class='pageTitle'][1]")
WebUI.getText(testObject)
The element with class pageTitle looks unique so why not user
//td[#class='pageTitle']

Sharepoint. Custom buttons

I have a SharePoint site, I want all the buttons to be in center and visible, but some of them are out of borders, I replaced my file Default.aspx with another from site with buttons(I also copied Image folder and all files I need). But in my site all buttons are placed very left and I want them to be in center.
What can I do?
For example this is code of button with phone on it:
<tr>
<td width="181" height="120" rowspan="1" colspan="1" style="padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px">
<div class="mosaic-news right">
<div class="mosaic-overlay">
<a href="http://workpoint.company.corp/teams/TEM1/BAT%20IS/Pages/Telephony_rus.aspx" style="display: block">
<img class="teams" src="images/rus/telephony.png" alt=""/>
</div>
<div class="details">
<!-- INNER TEXT -->
<div style="position: absolute; width: 182px; height: 120px">
<p class="sq_section" style="top: 50%;height: 120px; margin-top: 40px;">Fabric phones<br/>and phones</p>
</div>
</a>
<!-- END -->
</div>
</div>
</td>
</tr>
<tr>

When adding Runat="Server" tag to HTML table, the sharepoint not displaying the usercontrol

I have an .ascx control. That is having few Html table and Div section Runat = "Server"
The Code looks like following,
<div id = "divpayinfo" runat = "server">
<%!-- Some Code Here --%>
<table style="width: 403px" runat = "server">
<tr>
<td style="width: 63px; height: 22px;">
test</td>
<td colspan="2" style="height: 22px">
<strong><span style="color: #ffffff">ผู้ขอกู้หลัก</span></strong></td>
</tr>
<tr>
<td style="width: 63px; height: 21px">
</td>
<td style="width: 180px; height: 21px">
<strong>วงเงิน</strong></td>
<td style="height: 21px">
<strong>ยอดคงค้าง</strong></td>
</tr>
<tr>
<td style="width: 63px">
1. เงินกู้เพื่อที่อยู่อาศัย</td>
<td style="width: 180px">
<asp:TextBox ID="b_txt_lh_loan_h_all" runat="server" CssClass="box_nosize_right"
MaxLength="8" onchange="To_Set_Value(document.getElementById('d_txt_lh_loan_h_all'),document.getElementById('b_txt_lh_loan_h_all'))"
onfocus="To_Get_Value(document.getElementById('d_txt_lh_loan_h_all'),document.getElementById('b_txt_lh_loan_h_all'))"
onmouseout="To_Set_Value(document.getElementById('d_txt_lh_loan_h_all'),document.getElementById('b_txt_lh_loan_h_all'))"
Text="0" Width="90px"></asp:TextBox><asp:TextBox ID="d_txt_lh_loan_h_all" runat="server"
Text="0"></asp:TextBox></td>
<td>
<asp:TextBox ID="b_txt_lh_loan_h_remain" runat="server" CssClass="box_nosize_right"
MaxLength="8" onchange="To_Set_Value(document.getElementById('d_txt_lh_loan_h_remain'),document.getElementById('b_txt_lh_loan_h_remain'))"
onfocus="To_Get_Value(document.getElementById('d_txt_lh_loan_h_remain'),document.getElementById('b_txt_lh_loan_h_remain'))"
onmouseout="To_Set_Value(document.getElementById('d_txt_lh_loan_h_remain'),document.getElementById('b_txt_lh_loan_h_remain'))"
Text="0" Width="90px"></asp:TextBox><asp:TextBox ID="d_txt_lh_loan_h_remain" runat="server"
Text="0"></asp:TextBox></td>
</tr>
<tr>
<td style="width: 63px; height: 102px;">
2. เงินกู้เบิกเกินบัญชี</td>
<td style="width: 180px; height: 102px;">
<asp:TextBox ID="b_txt_lh_loan_a_all" runat="server" CssClass="box_nosize_right"
MaxLength="8" onchange="To_Set_Value(document.getElementById('d_txt_lh_loan_a_all'),document.getElementById('b_txt_lh_loan_a_all'))"
onfocus="To_Get_Value(document.getElementById('d_txt_lh_loan_a_all'),document.getElementById('b_txt_lh_loan_a_all'))"
onmouseout="To_Set_Value(document.getElementById('d_txt_lh_loan_a_all'),document.getElementById('b_txt_lh_loan_a_all'))"
Text="0" Width="90px"></asp:TextBox><asp:TextBox ID="d_txt_lh_loan_a_all" runat="server"
Text="0"></asp:TextBox></td>
<td style="height: 102px">
<asp:TextBox ID="b_txt_lh_loan_a_remain" runat="server" CssClass="box_nosize_right"
MaxLength="8" onchange="To_Set_Value(document.getElementById('d_txt_lh_loan_a_remain'),document.getElementById('b_txt_lh_loan_a_remain'))"
onfocus="To_Get_Value(document.getElementById('d_txt_lh_loan_a_remain'),document.getElementById('b_txt_lh_loan_a_remain'))"
onmouseout="To_Set_Value(document.getElementById('d_txt_lh_loan_a_remain'),document.getElementById('b_txt_lh_loan_a_remain'))"
Text="0" Width="90px"></asp:TextBox><asp:TextBox ID="d_txt_lh_loan_a_remain" runat="server"
Text="0"></asp:TextBox></td>
</tr>
</table>
I am doing some manupulation with DIV and HTML table at server side. so that i have mentioned as Server Side. I upload this control to Sharepoint as formusercontrolwebpart.
The Problem is when i upload the table with runat="Server" tag, the usercontrol is not displaying at sharepoint page... So that I copy this table and create another ascx only with this table and upload it to sharepoint but this is working fine.
I have checked all my user control code and adding with ASP.NET application. The usercontrol is working as expectedly there is no problem. But only when i adding with Sharepoint page it is giving problem..
I have found the following solution,
Remove all the runat = "server" tag from every Div section and add runat ="server" to table then the sharepoint page is working. But my problem is i have lot of manupulation with Div tag at server side.So that I cannot use this solution..
Please advise me experts.. is there anyway sharepoint protecting runat = "server" tag from usercontrol or anything related to that... Thank you in advance..
If I add follwing lines of code then my user control display not rendering,
<asp:TableCell id="d_div_l2_row9" runat="server" style="display: none; vertical-align: middle;
text-align: center">
<asp:TextBox ID="b_txt_l2_comission" runat="server" CssClass="box_nosize_right" MaxLength="8"
onchange="To_Set_Value(document.getElementById('d_txt_l2_comission'),document.getElementById('b_txt_l2_comission'))"
onfocus="To_Get_Value(document.getElementById('d_txt_l2_comission'),document.getElementById('b_txt_l2_comission'))"
onmouseout="To_Set_Value(document.getElementById('d_txt_l2_comission'),document.getElementById('b_txt_l2_comission'))"
Text="0" Width="180px"></asp:TextBox><span style="display: none"><asp:TextBox ID="d_txt_l2_comission"
runat="server" Text="0"></asp:TextBox></span></asp:TableCell>
I think asp:panel gets converted to a div in the underlying HTML. You could try that;
<asp:panel id="divpayinfo" runat="server">
<!-- Your code here -->
</asp:panel>
<asp:TableCell id="d_div_l2_row9" runat="server" style="**display: none;** vertical-align: middle;
text-align: center">
<asp:TextBox ID="b_txt_l2_comission" runat="server" CssClass="box_nosize_right" MaxLength="8"
onchange="To_Set_Value(document.getElementById('d_txt_l2_comission'),document.getElementById('b_txt_l2_comission'))"
onfocus="To_Get_Value(document.getElementById('d_txt_l2_comission'),document.getElementById('b_txt_l2_comission'))"
onmouseout="To_Set_Value(document.getElementById('d_txt_l2_comission'),document.getElementById('b_txt_l2_comission'))"
Text="0" Width="180px"></asp:TextBox><span style="display: none"><asp:TextBox ID="d_txt_l2_comission"
runat="server" Text="0"></asp:TextBox></span></asp:TableCell>
Text display:none in the style is this generated or added by you. Cause this means that control should not be displayed.
Moose,Andrew and Banana,
Thank you so much for your efforts to help me out.
I found another way to acheive the solution but still it is headache for me to find out the cause.
I uploaded the same usercontrol in sharepoint server "control template" folder and I have created an .aspx page for that user control and upload the aspx in sharepoint. now it is working fine the way it was working with asp.net application.

Resources