|
<html>
<body>
<table id="thread-board">
<tr>
<td width="68%">Subject</td>
<td width="12%">Username</td>
<td width="20%">Date Posted</td>
</tr>
<%=ShowMessages(0)%>
</table>
</body>
</html>
'/////////////////////////////////////////
'///// THREAD - MESSAGES //////////////////
intLevel = 0
Function ShowMessages(intParent)
intLevel = intLevel + 1
strSQL = "SELECT * FROM fmsg WHERE fmsg.msg_parent = " & intParent & " ORDER BY CDATE(msg_date) DESC "
Set rstForumMessages = conn.Execute(strSQL)
Do Until rstForumMessages.EOF
response.write("<tr>")
response.write("<td width='68%'><img src='dot.gif' width='" & ((intLevel * 24)-24) & "'>" & rstForumMessages("msg_object") & "</td>")
response.write("<td>" & rstForumMessages("msg_uid") & "<td>")
response.write("<td>" & rstForumMessages("msg_date") & "<td>")
response.write("</tr>")
ShowMessages(rstForumMessages("msg_id"))
rstForumMessages.MoveNext
intLevel = intLevel - 1
Loop
End Function
'///// THREAD - MESSAGES //////////////////
'////////////////////////////////////////
The function above is an asp classic function that I used to display messages and replies in a forum (a sort of treeview). I tried to translate it in asp net but it doesn't work properly.
Imports System
Imports System.IO
Imports system.web.ui
Imports system.web.ui.webcontrols
Imports system.web.ui.htmlcontrols
Imports system.configuration
Imports system.data
Imports system.data.oledb
Public Class Messages
Inherits page
'////////////////////////////////
Dim CN As OleDb.OleDbConnection
Dim CMD As OleDb.OleDbCommand
Dim SQL As String
Dim ODR As OleDb.OleDbDataReader
Dim ODR2 As OleDb.OleDbDataReader
'/////////////////////////////////////
Function ShowMessages(intParent As Integer) As String
Dim tt2 As String = String.Empty
SQL = " SELECT * FROM fmsg WHERE msg_parent=" & intParent
CMD = New OleDbCommand(SQL, CN)
CN.Open()
ODR2 = CMD.ExecuteReader()
If ODR2.HasRows Then
tt2 = ""
While ODR2.Read
intLevel = intLevel + 1
tt2 += "<table>"
tt2 += "<tr>"
tt2 += "<td rowspan=""2""><img src='dot.gif' style='width:" & ((intLevel * 14) - 14) & "px' /></td>"
tt2 += "<td class='child-title'>" & ODR2("msg_id") & " - " & ODR2("msg_object") & "</td>"
tt2 += "</tr>"
tt2 += "<tr>"
tt2 += "<td class='child-body'>" & ODR2("msg_body") & "</td>"
tt2 += "</tr>"
tt2 += "</table>"
tt2 += getChildNode(ODR2("msg_id"))
intLevel = intLevel - 1
End While
tt2 += ""
End If
CN.Close()
Return tt2
End Function
End Class
modified 9-Aug-12 14:58pm.
|
|
|
|
|
Help with what? Not many people are going to read through this unformatted mess. You did not say what you are trying to do nor did you say anything about any problem.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Please stand in front of my pistol, smile and wait for the flash - JSOP 2012
|
|
|
|
|
Sorry for the messy code. I forgot to use preformatted text for the code.
|
|
|
|
|
Which ones which, they both look like classic asp to me,
I must admit that Wes is right on your post and code looking like a mess, That's one messy hay stack you have there.
Clean it up for help
|
|
|
|
|
Sorry for the messy code. I forgot to use preformatted text for the code.
|
|
|
|
|
This is more along the lines of asp.net, in pure form. I don't know what the outside of the haystack looks like, so I have no clue where to inject the html
The use of response.write was popular in classic asp and echo in php, but I think it's poor programming practice. I don't know what the alternative is, I left asp back in 2003, and php in 2005.
Private Sub ShowMessages(ByVal iParent As Integer, ByVal pContainer As Panel)
Dim message(3) As String
Dim myConnectionString As String
myConnectionString = ice5commerce.common.iCE5IniFile.GetSQLConnString()
Dim mySelectQuery As String = "SELECT * FROM fmsg WHERE msg_parent=@Parent"
Dim myConnection As New SqlConnection(myConnectionString)
Dim myCommand As New SqlCommand(mySelectQuery, myConnection)
Dim paramParent As SqlParameter
paramParent = New SqlParameter("@Parent", SqlDbType.Int)
paramParent.Value = iParent
myCommand.Parameters.Add(paramParent)
Try
myConnection.Open()
Dim myReader As SqlDataReader = myCommand.ExecuteReader()
While myReader.Read()
message(0) = myReader.GetBoolean(0).ToString 'mID
message(1) = myReader.GetString(1).ToString 'mObject
message(2) = myReader.GetString(2).ToString 'mBody
End While
myReader.Close()
myConnection.Close()
myReader = Nothing
Catch ex As Exception
End Try
myCommand = Nothing
myConnection = Nothing
If (message.Length > 0) Then
Dim table_Container As Table
table_Container = New Table
With table_Container
.CellPadding = 0
.CellSpacing = 0
.Style.Add(HtmlTextWriterStyle.Width, "100%")
.Attributes.Add("border", "0")
End With
pContainer.Controls.Add(table_Container)
Dim tr_TitleRow As TableRow
tr_TitleRow = New TableRow
table_Container.Controls.Add(tr_TitleRow)
Dim td_TitleRow_Left As TableCell
td_TitleRow_Left = New TableCell
With td_TitleRow_Left
.RowSpan = 2
.Style.Add(HtmlTextWriterStyle.Width, "25%")
End With
tr_TitleRow.Controls.Add(td_TitleRow_Left)
Dim img_UserLevel As UI.WebControls.Image
img_UserLevel = New UI.WebControls.Image
With img_UserLevel
.ImageUrl = "~/image/dot.gif"
End With
td_TitleRow_Left.Controls.Add(img_UserLevel)
Dim td_TitleRow_Right As TableCell
td_TitleRow_Right = New TableCell
With td_TitleRow_Right
.Style.Add(HtmlTextWriterStyle.Width, "25%")
End With
tr_TitleRow.Controls.Add(td_TitleRow_Right)
Dim tr_MessageBody As TableRow
tr_MessageBody = New TableRow
table_Container.Controls.Add(tr_MessageBody)
Dim td_MessageBody As TableCell
td_MessageBody = New TableCell
With td_MessageBody
.CssClass = "child-body"
.Text = message(3)
End With
tr_MessageBody.Controls.Add(td_MessageBody)
Else
'No record was found
End If
End Sub
|
|
|
|
|
Hi,
I am using a gridview (asp.net). in which I have a formatting done to the cells with border color = Black.
{
foreach (TableCell tc in e.Row.Cells)
{
tc.Attributes["style"] = "border-color: Black";
}
}.
The same is working fine locally, but when deployed the Black lines becomes bold and thick.
Any one Please help on this. Awaiting response !!!!
|
|
|
|
|
Does it happen across all browsers? What happens if you explicitly set the border-width to "thin"?
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
We are using Quartz schedular for one of my project.
I'am getting exception when GetSchedular method is called. Exception is "File quartzjobs.config not found"
Both Files (where GetScheduler() method is called & quartzjobs.config) are in same folder.
Below is the code:
ISchedulerFactory factory = new StdSchedulerFactory();
_scheduler = factory.GetScheduler();
XML is
<add key="quartz.plugin.xml.fileNames" value="quartzjobs.config">
Regards,
Shirish.M
|
|
|
|
|
Sounds like you're missing a configuration-file. People here will not have that much experience with the scheduler, I suggest you repost your question on their support-forum[^].
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
content management system in asp.net
|
|
|
|
|
Member 9325229 wrote: content management system in asp.net
This is a forum where on can ask questions. This is not a question. It's not even a statement.
Try again.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
Yeah...what about them?
"Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
|
|
|
|
|
In an existing 2010 C# web form application, I want to setup a hyperlink that will take the user to a new web form page.
1. The user will basically enter some data into a textbox and the user will be redirected to the new web form page. The user will be redirected to the new web page when they that are in the _text_changed event.
2. The other option is that the user will click on a label and be redirected to the new web page.
What I have tried does not work so far. Thus can you tell me and/or point me to a reference that will show me how to setup this code?
|
|
|
|
|
Show us what you have tried. Sounds like a job for javascript or jquery. Capture the onclick event of the label and redirect with location.href = 'page.html'
Read this[^]. Might give you some tips.
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair.
nils illegitimus carborundum
me, me, me
|
|
|
|
|
Why would you use javascript and/or jquery instead of response.redirect? What is the benefit?
|
|
|
|
|
No postback, for a start. If they are just clicking on a label, why go server side?
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair.
nils illegitimus carborundum
me, me, me
|
|
|
|
|
Response.redirect is for posting data from a form and then performing server-side processing, in which the server does a bunch a work, and then determines the outcome based on the results, in which a Response,Redirect can be issued.
If you want to just change pages, you use a hyperlink, or hyperlink button.
Using response.redirect to just change pages is a waste of resources.
Changing pages based off the event (textchanged) is a bad idea, because it fires the event on every key-up, unless you test the magic word 1 char at a time until complete, and then fire off a page change.
|
|
|
|
|
In an existing application, I am changing the following logic:
When the user enters a specific transaction code in a textbox field, a textbox is displayed by setting the visible property of another textbox field to true. What I need to do is to replace the textbox field that is displayed with a link to another page. The link to the other page will allow the user to enter up to 8000 characters in a comment field. Once the user enters the information, they will hit the save button and they will return to the page they started on.
Thus can you tell me how to code for this situation?
|
|
|
|
|
So you enter a code in the textbox. If the code matches, then you can type away in a textarea, when done, the text is saved and you return back to the textbox you enter the code in.
If correct, why not just make it on 1 page.
|
|
|
|
|
I want to mention the following:
1. The page where you enter the data is too small. There is not enough room on the webpage to enter the data. The user wants to be able to enter 8,000 to 20,000 bytes of data if they need to. They want to be able to adjust the new texabox area the way they want to. The user wants to be able to type the data in paragraph format. The user requirement is to have that one textbox on one webpage for their convenience. This is a requirement that can not be changed.
2. I also wanted to mention the following is the code I have to work with right now:
TextBoxCode.TextChanged += new EventHandler(TextBoxCode_TextChanged);
void TextBoxcode_TextChanged(object sender, EventArgs e)
{
if (TextBoxCode.Text == "")
{
ButtonPending.Visible = true;
}
else
{
ButtonPending.Visible = false;
if (TextBoxCode.Text == "999")
{
Response.Redirect("~/Reason.aspx");
}
}
Can you make suggestions how to accomplish this goal, by hopefully using a hyperlink?
|
|
|
|
|
You issued a postback to the server, so response.redirect is appropiate
If you would of went
.onClientClick = "return process_textbox; return false;";
And then write your fucntion - requires jquery
function process_textbox() {
var txtValue = $('[id*="_txtBox"]').val();
var txtValue_Len = $('[id*="_txtBox"]').val().length;
if (txtValueLen > 0) {
var newUrl = "newPage.aspx?id=" + escape(txtValue)";
window.location.replace(newUrl);
}
}
|
|
|
|
|
Thank you for your response!
I have the following questions about the code above:
1. Would the code above need to have a script tag before and after it like javascript required?
2. I am assuming the newUrl is the location of the web page?
3. I am assuming the txtValue is where I can use the specific code the user is required to enter,correct?
4. Is the placement of a jquery request need to be anywhere specfic in the *.aspx page? This would be like javascript tag is usually in the header tag of an html page?
|
|
|
|
|
1. Yes
2. Yes - Place the JQuery Script tag in the header to load it first, then create a separate file, and place the script tags at the bottom of the page. I think it has to be inside the body, but at the bottom to keep it clean
3. I just made that up, I figured the txtValue was important, so you would want to pass it as a querystring value
4. Load the Jquery in the head tag, after your css, and load your function file at the bottom of your page, within the body tag.
If your using master pages, that's ok, just use unique names for your js files such as
jquery.js
jquery.comment.sel.js
jquery.comment.form.js
If your using an update panel, you will need to load the jquery after each async postback the panel creates
$(document).ready(function () {
initializeBinding();
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
});
function EndRequestHandler(sender, args) {
initializeBinding();
}
function initializeBinding() {
$(document).ajaxStart(function () {
});
$(document).ajaxStop(function () {
});
$('[id*="_txt_ProductEditor_Basic_PartNumber"]').blur(function () {
check_PartNumber();
return false;
});
}
function check_PartNumber() {
m_ProductID_Length = $('[id*="_txt_ProductID"]').val().length;
}
|
|
|
|
|
Hi All,
I have a wcf service and its client, a component WCF service is using the following office dlls in generating the word to pdf and excel to pdf files. On my machine everything is working fine, but when I hosted the application on the server, its failing in accessing those dlls. I found that server doesnt have the ms office installed on it. My question is, is there any free way that I can accesss those dlls without installing the office on the server. Actually WCF service is referencing another project on my machine which is referencing those dlls. Means indirectly WCF is referencing those dlls. Is that also a problems. Please help me. If its complesoury to have the office installed on the machine, please advise me which version of office is must to have on the server to make all this working. And when I enabled logging in my WCF service it was throwing exception as
"Microsoft.Office.Interop.Word, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c
"Following are the dlls: Microsoft.Office.Core, Microsoft.Office.Interop.Excel, Microsoft.Office.Interop.Word, Microsoft.Office.Tools.Excel.v9.0, Microsoft.Office.Tools.v9.0, Microsoft.VisualStudion.Tools.Applications.Runtim.v9.0
Please help me I am in desperate need. I want to run all my application without office is there any way to do that.
Thanks & Regards,
Abdul Aleem Mohammad
St Louis MO - USA
modified 8-Aug-12 16:39pm.
|
|
|
|