.NET Forum / ASP.NET / General / February 2008
HyperLink in ASP.NET 2.0 Web Page
|
|
Thread rating:  |
ABHIJIT B - 04 Feb 2008 19:33 GMT Hi,
I am developing one WebPage which has table stucture for which I acnnot us HtmlTable class,GridView,DataGrid etc. for display.
The following is script inwhich I am using Response.Write() for generating Table. This script I am assigning to Literal Control in next step.
The problem I am facing is I want to open .htm page as PopuP either by using window.open or showmodal dialog.
------------------------------------------------------------ Normal html code :
body>
<a href="#" onclick="mywin001=window.open('DataCheckerStatusReport.htm', 700,450,null,null,'mywin001',5,true,true,true);return false">Slide1</ a> <br /> <a href="#" onclick="mywin001=OpenIt()">Slide2</a>
</body> </html> <script language="javascript" type="text/javascript">
function OpenIt() { alert("Hi");
window.event.returnValue=false;
//var returnVal = '';
//returnVal = window.showModalDialog('SearchUsers.htm','','center:yes;scroll:no;resizable:no;dialogWidth: 750px;dialogHeight:425px;dialogHide:true;status:no;help:no'); var mywin001 = window.open('DataCheckerStatusReport.htm', 700,450,null,null,'mywin001',5,true,true,true);
return true; }
</script>
------------------------------------------------------------ I want tto use <a href='#' functionality in Response.Write I replaced double qutoes with single quote it is giving syntax error..Kindly help me out.
ASPX.cs code :
if (dtServiceStatusInfo.Rows.Count > 0) {
Response.Write("<table border='1'>"); Response.Write("<tr>"); Response.Write("<td rowspan='2' style='width: 175px' align='center'> SERVICE </td>"); Response.Write("<td rowspan='1' colspan='3' style='width: 225px' align='center'> EXPECTED </td>"); Response.Write("<td rowspan='2' align='center'> PROCESSED </td>"); Response.Write("<td rowspan='2' align='center'> DATACHECKER <br /> RUN </td>"); Response.Write("<td rowspan='2' align='center'> NOT <br /> OPEN </td>"); Response.Write("<td rowspan='2' align='center'> IN <br /> PROGRESS </td>"); Response.Write("<td rowspan='2' align='center'> SUB. FOR <br /> RELEASE </td>"); Response.Write("<td rowspan='2' colspan='2' align='center'> SUB. FOR <br /> RE-RUN </td>"); Response.Write("</tr>"); Response.Write("<tr>"); Response.Write("<td rowspan='1' style='width: 75px' align='center'> IN CRS <br /> & NOT IN PRODN. </td>"); Response.Write("<td rowspan='1' style='width: 75px' align='center'> NOT IN CRS <br /> BUT IN PRODN. </td>"); Response.Write("<td rowspan='1' style='width: 75px' align='center'> IN CRS <br /> & IN PRODN. </td>"); Response.Write("</tr>");
foreach (DataRow record in dtServiceStatusInfo.Rows) { Response.Write("<tr>"); Response.Write("<td rowspan='1' style='width: 175px' align='center'><a href='DatabaseControl.aspx?QStrServiceDesc=" + record["ServiceDesc"].ToString() + "'>" + record["ServiceDesc"].ToString() + "</a></td>"); //Response.Write("<td rowspan='1' align='center'><a href='http://www.google.com'>" + record["NoOfDBinCRS"].ToString() + "</a></td>"); //Response.Write("<td rowspan='1' align='center'><a href='#' onclick='mywin001=window.open('DataCheckerStatusReport.htm', 700,450,null,null,'mywin001',5,true,true,true);return false'>" + record["NoOfDBinCRS"].ToString() + "</a></td>"); //Response.Write("<td rowspan='1' align='center'><a href='#'mywin001=OpenIt() '>" + record["NoOfDBinCRS"].ToString() + "</a></td>"); Response.Write("<td rowspan='1' align='center'><a href='http://www.google.com'>" + record["NoOfDBinPDN"].ToString() + "</a></td>"); Response.Write("<td rowspan='1' align='center'><a href='http://www.google.com'>" + record["NoOfDBinBoth"].ToString() + "</a></td>"); Response.Write("<td rowspan='1' align='center'><a href='http://www.google.com'>" + record["NoOfDBProcessed"].ToString() + "</a></td>"); Response.Write("<td rowspan='1' align='center'><a href='http://www.google.com'>" + record["DCRun"].ToString() + "</a></td>"); Response.Write("<td rowspan='1' align='center'><a href='http://www.google.com'>" + record["NotOpenedDBCnt"].ToString() + "</a></td>"); Response.Write("<td rowspan='1' align='center'><a href='http://www.google.com'>" + record["InProgressDBCnt"].ToString() + "</a></td>"); Response.Write("<td rowspan='1' align='center'><a href='http://www.google.com'>" + record["ReleaseDBCnt"].ToString() + "</a></td>"); Response.Write("<td rowspan='1' align='center'><a href='http://www.google.com'>" + record["ReRunDBCnt"].ToString() + "</a></td>"); Response.Write("</tr>");
}
Response.Write("</table>"); dcDCHSucess = true; }
Coskun SUNALI [MVP] - 05 Feb 2008 00:03 GMT Hi,
I can't say that using Response.Write to create your controls structure is the best way to do that.
I would rather suggest you using the Controls collection of the Page and add your child controls inside it or creating a container control - Panel for example - and add your child controls to the Controls collection of that Panel.
The solution for your problem is below:
Response.Write("<td rowspan=\"1\" align=\"center\"><a href=\"#\" onclick=\"mywin001=window.open('DataCheckerStatusReport.htm',700,450,null,null,'mywin001',5,true,true,true);return false\">" + record ["NoOfDBinCRS"].ToString() + "</a></td>");
 Signature All the best, Coskun SUNALI MVP ASP/ASP.NET http://sunali.com http://www.propeople.dk
> Hi, > [quoted text clipped - 131 lines] > dcDCHSucess = true; > } ABHIJIT B - 05 Feb 2008 20:31 GMT Thanks Coskun for your reply.
I did certain changes now I am appending create table string to Literal Control. Now I am small issue.I am using following code,
strTable = strTable + "<td rowspan=\"1\" align=\"center\"><a href=\"# \" onclick=\"mywin001=window.open('DataCheckerStatusReport.htm? Param1=Test1&Param2=Test2',825,500,null,null,'mywin001', 5,true,true,true);return true;\">" + record["NoOfDBinCRS"].ToString() + "</a></td>";
I want to access querystring Paaram1 value in Popup form 'DataCheckerStatusReport.htm'
I tried to use Request.Params[] and bind value to hidden control
<input id="hidName" runat="server" type="hidden" />
It is displaying error.
So I use this code in Popup form
string strq = (string)Request.QueryString["Param1"];
strq value is null.
Kindly assist me for same.
> Hi, > [quoted text clipped - 158 lines] > > - Show quoted text - Coskun SUNALI [MVP] - 05 Feb 2008 21:16 GMT Hi,
You request to access Param1 value using the code you mentioned. Though a conversion to "string" is not required since Request.QueryString is basicly a string array. I have no idea why it doesn't work.
I see a ".htm" extention in the popup URL, are you sure this function opens a window with a location of your Aspx page?
 Signature All the best, Coskun SUNALI MVP ASP/ASP.NET http://sunali.com http://www.propeople.dk
Thanks Coskun for your reply.
I did certain changes now I am appending create table string to Literal Control. Now I am small issue.I am using following code,
strTable = strTable + "<td rowspan=\"1\" align=\"center\"><a href=\"# \" onclick=\"mywin001=window.open('DataCheckerStatusReport.htm? Param1=Test1&Param2=Test2',825,500,null,null,'mywin001', 5,true,true,true);return true;\">" + record["NoOfDBinCRS"].ToString() + "</a></td>";
I want to access querystring Paaram1 value in Popup form 'DataCheckerStatusReport.htm'
I tried to use Request.Params[] and bind value to hidden control
<input id="hidName" runat="server" type="hidden" />
It is displaying error.
So I use this code in Popup form
string strq = (string)Request.QueryString["Param1"];
strq value is null.
Kindly assist me for same.
On Feb 4, 7:03 pm, "Coskun SUNALI [MVP]" <Cos...@SUNALI.com> wrote:
> Hi, > [quoted text clipped - 159 lines] > > - Show quoted text - ABHIJIT B - 05 Feb 2008 21:41 GMT Hi Coskun,
Yes it is opening page. I tried different way instead of using .htm I used .aspx page and it worked out for me.
Thanks & Take care.
> Hi, > [quoted text clipped - 209 lines] > > - Show quoted text - Coskun SUNALI [MVP] - 05 Feb 2008 22:18 GMT Hi,
Just to remind; as long as you don't register "htm" extention to be served using ASP.NET ISAPI in your IIS configuration, you can not execute any ASP.NET code inside it.
Glad that it worked for you.
 Signature All the best, Coskun SUNALI MVP ASP/ASP.NET http://sunali.com http://www.propeople.dk
Hi Coskun,
Yes it is opening page. I tried different way instead of using .htm I used .aspx page and it worked out for me.
Thanks & Take care.
On Feb 5, 4:16 pm, "Coskun SUNALI [MVP]" <Cos...@SUNALI.com> wrote:
> Hi, > [quoted text clipped - 211 lines] > > - Show quoted text - ABHIJIT B - 06 Feb 2008 15:52 GMT Hi Coskun,
Thanks for updating my knowledge.
I want to use CSS in following table.I am new to ASP.NET 2.0 Literal Control concept. Kindly help me out for same.
CS file code:
if (dtServiceStatusInfo.Rows.Count > 0) { //Literal Control
strTable = "<table border='1'><tr>"; strTable = strTable + "<td rowspan='2' style='width: 175px' align='center'> SERVICE </td>"; strTable = strTable + "<td rowspan='1' colspan='3' style='width: 225px' align='center'> EXPECTED </td>"; strTable = strTable + "<td rowspan='2' align='center'> PROCESSED </td>"; strTable = strTable + "<td rowspan='2' align='center'> DATACHECKER <br /> RUN </td>"; strTable = strTable + "<td rowspan='2' align='center'> NOT <br /> OPEN </td>"; strTable = strTable + "<td rowspan='2' align='center'> IN <br /> PROGRESS </td>"; strTable = strTable + "<td rowspan='2' align='center'> SUB. FOR <br /> RELEASE </td>"; strTable = strTable + "<td rowspan='2' colspan='2' align='center'> SUB. FOR <br /> RE-RUN </td>"; strTable = strTable + "</tr>"; strTable = strTable + "<tr>"; strTable = strTable + "<td rowspan='1' style='width: 75px' align='center'> IN CRS <br /> & NOT IN PRODN. </ td>"; strTable = strTable + "<td rowspan='1' style='width: 75px' align='center'> NOT IN CRS <br /> BUT IN PRODN. </ td>"; strTable = strTable + "<td rowspan='1' style='width: 75px' align='center'> IN CRS <br /> & IN PRODN. </td>"; strTable = strTable + "</tr>";
foreach (DataRow record in dtServiceStatusInfo.Rows) { ServiceDesc = ""; ServiceDesc = record["ServiceDesc"].ToString();
strTable = strTable + "<tr>"; strTable = strTable + "<td rowspan='1' style='width: 175px' align='center'><a href='DatabaseControl.aspx? ServiceDesc=" + ServiceDesc + "'>" + record["ServiceDesc"].ToString() + "</a></td>"; strTable = strTable + "<td rowspan='1' align='center'><a href=\"#\" onclick= \"dchwindow=window.open('DataCheckerStatusReport.aspx?ServiceDesc=" + ServiceDesc + "',760,500,null,null,'dchwindow', 5,true,true,true);return true;\">" + record["NoOfDBinCRS"].ToString() + "</a></td>"; strTable = strTable + "<td rowspan='1' align='center'><a href=\"#\" onclick= \"dchwindow=window.open('DataCheckerStatusReport.aspx?ServiceDesc=" + ServiceDesc + "',760,500,null,null,'dchwindow', 5,true,true,true);return true;\">" + record["NoOfDBinPDN"].ToString() + "</a></td>"; strTable = strTable + "<td rowspan='1' align='center'><a href=\"#\" onclick= \"dchwindow=window.open('DataCheckerStatusReport.aspx?ServiceDesc=" + ServiceDesc + "',760,500,null,null,'dchwindow', 5,true,true,true);return true\">" + record["NoOfDBinBoth"].ToString() + "</a></td>"; strTable = strTable + "<td rowspan='1' align='center'><a href=\"#\" onclick= \"dchwindow=window.open('DataCheckerStatusReport.aspx?ServiceDesc=" + ServiceDesc + "',760,500,null,null,'dchwindow', 5,true,true,true);return true\">" + record["NoOfDBProcessed"].ToString() + "</a></td>"; strTable = strTable + "<td rowspan='1' align='center'><a href=\"#\" onclick= \"dchwindow=window.open('DataCheckerStatusReport.aspx?ServiceDesc=" + ServiceDesc + "',760,500,null,null,'dchwindow', 5,true,true,true);return true\">" + record["DCRun"].ToString() + "</ a></td>"; strTable = strTable + "<td rowspan='1' align='center'><a href=\"#\" onclick= \"dchwindow=window.open('DataCheckerStatusReport.aspx?ServiceDesc=" + ServiceDesc + "',760,500,null,null,'dchwindow', 5,true,true,true);return true\">" + record["NotOpenedDBCnt"].ToString() + "</a></td>"; strTable = strTable + "<td rowspan='1' align='center'><a href=\"#\" onclick= \"dchwindow=window.open('DataCheckerStatusReport.aspx?ServiceDesc=" + ServiceDesc + "',760,500,null,null,'dchwindow', 5,true,true,true);return true\">" + record["InProgressDBCnt"].ToString() + "</a></td>"; strTable = strTable + "<td rowspan='1' align='center'><a href=\"#\" onclick= \"dchwindow=window.open('DataCheckerStatusReport.aspx?ServiceDesc=" + ServiceDesc + "',760,500,null,null,'dchwindow', 5,true,true,true);return true\">" + record["ReleaseDBCnt"].ToString() + "</a></td>"; strTable = strTable + "<td rowspan='1' align='center'><a href=\"#\" onclick= \"dchwindow=window.open('DataCheckerStatusReport.aspx?ServiceDesc=" + ServiceDesc + "',760,500,null,null,'dchwindow', 5,true,true,true);return true\">" + record["ReRunDBCnt"].ToString() + "</a></td>"; strTable = strTable + "</tr>"; }
strTable = strTable + "</table>";
LiteralDCHome.Text = strTable; }
Best Regards, Abhijit B
> Hi, > [quoted text clipped - 239 lines] > > - Show quoted text - Coskun SUNALI [MVP] - 06 Feb 2008 16:42 GMT Hi,
I will suggest you to read about Table, TableRow, TableCell and how to create a HTML Table on the fly, programmatically.
http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.table.aspx
http://technet.microsoft.com/en-us/library/system.web.ui.webcontrols.tablerow.aspx
http://technet.microsoft.com/en-us/library/system.web.ui.webcontrols.tablecell.aspx
http://msdn2.microsoft.com/en-us/library/7bewx260(VS.80).aspx
 Signature All the best, Coskun SUNALI MVP ASP/ASP.NET http://sunali.com http://www.propeople.dk
Hi Coskun,
Thanks for updating my knowledge.
I want to use CSS in following table.I am new to ASP.NET 2.0 Literal Control concept. Kindly help me out for same.
CS file code:
if (dtServiceStatusInfo.Rows.Count > 0) { //Literal Control
strTable = "<table border='1'><tr>"; strTable = strTable + "<td rowspan='2' style='width: 175px' align='center'> SERVICE </td>"; strTable = strTable + "<td rowspan='1' colspan='3' style='width: 225px' align='center'> EXPECTED </td>"; strTable = strTable + "<td rowspan='2' align='center'> PROCESSED </td>"; strTable = strTable + "<td rowspan='2' align='center'> DATACHECKER <br /> RUN </td>"; strTable = strTable + "<td rowspan='2' align='center'> NOT <br /> OPEN </td>"; strTable = strTable + "<td rowspan='2' align='center'> IN <br /> PROGRESS </td>"; strTable = strTable + "<td rowspan='2' align='center'> SUB. FOR <br /> RELEASE </td>"; strTable = strTable + "<td rowspan='2' colspan='2' align='center'> SUB. FOR <br /> RE-RUN </td>"; strTable = strTable + "</tr>"; strTable = strTable + "<tr>"; strTable = strTable + "<td rowspan='1' style='width: 75px' align='center'> IN CRS <br /> & NOT IN PRODN. </ td>"; strTable = strTable + "<td rowspan='1' style='width: 75px' align='center'> NOT IN CRS <br /> BUT IN PRODN. </ td>"; strTable = strTable + "<td rowspan='1' style='width: 75px' align='center'> IN CRS <br /> & IN PRODN. </td>"; strTable = strTable + "</tr>";
foreach (DataRow record in dtServiceStatusInfo.Rows) { ServiceDesc = ""; ServiceDesc = record["ServiceDesc"].ToString();
strTable = strTable + "<tr>"; strTable = strTable + "<td rowspan='1' style='width: 175px' align='center'><a href='DatabaseControl.aspx? ServiceDesc=" + ServiceDesc + "'>" + record["ServiceDesc"].ToString() + "</a></td>"; strTable = strTable + "<td rowspan='1' align='center'><a href=\"#\" onclick= \"dchwindow=window.open('DataCheckerStatusReport.aspx?ServiceDesc=" + ServiceDesc + "',760,500,null,null,'dchwindow', 5,true,true,true);return true;\">" + record["NoOfDBinCRS"].ToString() + "</a></td>"; strTable = strTable + "<td rowspan='1' align='center'><a href=\"#\" onclick= \"dchwindow=window.open('DataCheckerStatusReport.aspx?ServiceDesc=" + ServiceDesc + "',760,500,null,null,'dchwindow', 5,true,true,true);return true;\">" + record["NoOfDBinPDN"].ToString() + "</a></td>"; strTable = strTable + "<td rowspan='1' align='center'><a href=\"#\" onclick= \"dchwindow=window.open('DataCheckerStatusReport.aspx?ServiceDesc=" + ServiceDesc + "',760,500,null,null,'dchwindow', 5,true,true,true);return true\">" + record["NoOfDBinBoth"].ToString() + "</a></td>"; strTable = strTable + "<td rowspan='1' align='center'><a href=\"#\" onclick= \"dchwindow=window.open('DataCheckerStatusReport.aspx?ServiceDesc=" + ServiceDesc + "',760,500,null,null,'dchwindow', 5,true,true,true);return true\">" + record["NoOfDBProcessed"].ToString() + "</a></td>"; strTable = strTable + "<td rowspan='1' align='center'><a href=\"#\" onclick= \"dchwindow=window.open('DataCheckerStatusReport.aspx?ServiceDesc=" + ServiceDesc + "',760,500,null,null,'dchwindow', 5,true,true,true);return true\">" + record["DCRun"].ToString() + "</ a></td>"; strTable = strTable + "<td rowspan='1' align='center'><a href=\"#\" onclick= \"dchwindow=window.open('DataCheckerStatusReport.aspx?ServiceDesc=" + ServiceDesc + "',760,500,null,null,'dchwindow', 5,true,true,true);return true\">" + record["NotOpenedDBCnt"].ToString() + "</a></td>"; strTable = strTable + "<td rowspan='1' align='center'><a href=\"#\" onclick= \"dchwindow=window.open('DataCheckerStatusReport.aspx?ServiceDesc=" + ServiceDesc + "',760,500,null,null,'dchwindow', 5,true,true,true);return true\">" + record["InProgressDBCnt"].ToString() + "</a></td>"; strTable = strTable + "<td rowspan='1' align='center'><a href=\"#\" onclick= \"dchwindow=window.open('DataCheckerStatusReport.aspx?ServiceDesc=" + ServiceDesc + "',760,500,null,null,'dchwindow', 5,true,true,true);return true\">" + record["ReleaseDBCnt"].ToString() + "</a></td>"; strTable = strTable + "<td rowspan='1' align='center'><a href=\"#\" onclick= \"dchwindow=window.open('DataCheckerStatusReport.aspx?ServiceDesc=" + ServiceDesc + "',760,500,null,null,'dchwindow', 5,true,true,true);return true\">" + record["ReRunDBCnt"].ToString() + "</a></td>"; strTable = strTable + "</tr>"; }
strTable = strTable + "</table>";
LiteralDCHome.Text = strTable; }
Best Regards, Abhijit B
On Feb 5, 5:18 pm, "Coskun SUNALI [MVP]" <Cos...@SUNALI.com> wrote:
> Hi, > [quoted text clipped - 248 lines] > > - Show quoted text -
Free MagazinesGet these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...
|
|
|