Click here to Skip to main content
       

ASP.NET

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page  Show 
GeneralRe: A liitle help on submitting a json array, no-primitive to a web servicememberjkirkerx31 Aug '12 - 6:25 
It's a holiday weekend here, labor day, but I may send another array to a web service next week. I'm reworking my shopping cart and checkout program, implementing better and faster code, while cleaning up.
 
Have a great weekend!
QuestionPage.Response.Redirect not workingmemberdcof9 Aug '12 - 5:21 
I am using Page.Response.Redirect and the following code is not working:
 
Page.Response.Redirect("test.aspx")
 
I never get to the requested page.
 
I have tried
Page.Response.Redirect("test.aspx", false )
and that does not work.
 
The code that calls the routine is the following:
 onKeyPress="return numbersonly(this, event)"
 
The user has to enter a value in the textbox for the code to work.
 
Do you think I need to setup the absolute path in this call?
 

Thus do you think I need another event to trigger the call to the correct method call?
 
What would you suggest?
AnswerRe: Page.Response.Redirect not workingmemberjkirkerx9 Aug '12 - 6:50 
Correct me if I'm wrong on this
 
Objects like Request, Response, Server are part of the HttpContext, which I think is a link to the web server, and allows the web server to communicate with asp.net
 
So when you get more advanced with your code, and you no longer bind objects, then you use
 
httpContext.current.response.redirect("~/default.aspx")
 
As far as the folder system goes
 
If I have a folder structure like
 
/
/images/
/admin/management/login.aspx
/admin/management/logout.aspx
 
I'm in the root, and want the image folder
redirect(~/images/default.aspx")
 
I'm in /admin/management/ and I want the logout page
redirect("logout.aspx")
 
now I want the root default
redirect("~/")
 
Using Page is for talking to Page Objects, like the header tag, script tags, register a script via the client script manager
 
Hope that helps
AnswerRe: Page.Response.Redirect not workingprotectorAspDotNetDev9 Aug '12 - 6:51 
dcof wrote:
The code that calls the routine is the following

 
Page.Response.Redirect is a server-side function, yet return numbersonly(this, event) appears to be a call to a JavaScript function. That's not going to work. Here is an example of how you can do a server-side redirect:
<%@ Page Language="vb" AutoEventWireup="false" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<script runat="server">
  Protected Sub btnTest_Click(sender As Object, e As System.EventArgs)
    Page.Response.Redirect("http://www.google.com/")
  End Sub
</script>
 
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Test Redirect</title>
</head>
<body>
    <form id="frmMain" runat="server">
      <asp:Button runat="server" ID="btnTest" Text="Redirect" onclick="btnTest_Click" />
    </form>
</body>
</html>
If you want to do it with JavaScript, it would be different (you'd use window.location).

AnswerMessage Removedmemberjkirkerx9 Aug '12 - 8:14 
Message Removed
GeneralRe: Page.Response.Redirect not workingmemberdcof9 Aug '12 - 12:11 
Can you show me how you use "window,location("/index.aspx");"
 in javascript?
 
how would you wire up this feature to the web form page?
GeneralRe: Page.Response.Redirect not workingmemberjkirkerx9 Aug '12 - 17:09 
I didn't mention that to you, I posted that to stein in a post below yours.
 
You would have to read all the post to get the full story on that. But it includes some samples on how to wire it up. Read the post first,
 
[^]
 
[edit]
 
I did write that to you, still not clear if your posting back, or trying to do that on the client side.
GeneralRe: Page.Response.Redirect not workingmemberdcof9 Aug '12 - 18:40 
Even though the post you pointed out to me looks like it would work, I would rather post back to the server. I need to obtain some data from the server.
How ould I post back to the server?
AnswerRe: Page.Response.Redirect not workingmemberdipsvp10 Aug '12 - 2:42 
Laugh | :laugh:
GeneralRecursion from asp classic to asp net [modified]memberEnricoRS19 Aug '12 - 4:45 
<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:58.

AnswerRe: Recursion from asp classic to asp netmemberWes Aday9 Aug '12 - 5:54 
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

GeneralRe: Recursion from asp classic to asp netmemberEnricoRS19 Aug '12 - 9:00 
Sorry for the messy code. I forgot to use preformatted text for the code.
AnswerRe: Recursion from asp classic to asp netmemberjkirkerx9 Aug '12 - 8:19 
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
GeneralRe: Recursion from asp classic to asp netmemberEnricoRS19 Aug '12 - 9:01 
Sorry for the messy code. I forgot to use preformatted text for the code.
GeneralThis is how I would of wrote it,memberjkirkerx10 Aug '12 - 7:04 
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

QuestionGridview formatting acts wierd when dployed in servermemberpreetham_s8 Aug '12 - 20:40 
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 !!!!
QuestionRe: Gridview formatting acts wierd when dployed in servermemberEddy Vluggen9 Aug '12 - 0:56 
Does it happen across all browsers? What happens if you explicitly set the border-width to "thin"?
Bastard Programmer from Hell Suspicious | :suss:
if you can't read my code, try converting it here[^]

QuestionIssue for Quartz schedularmemberShirish kumar manda8 Aug '12 - 20:39 
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
 

 

 
Regards,
Shirish.M
AnswerRe: Issue for Quartz schedularmemberEddy Vluggen9 Aug '12 - 0:54 
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 Suspicious | :suss:
if you can't read my code, try converting it here[^]

QuestioncmsmemberMember 93252298 Aug '12 - 20:10 
content management system in asp.net
SuggestionRe: cmsmemberEddy Vluggen9 Aug '12 - 0:55 
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 Suspicious | :suss:
if you can't read my code, try converting it here[^]

AnswerRe: cmsmemberPaul Conrad9 Aug '12 - 19:11 
Yeah...what about them? Hmmm | :|
"Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus

Questionsetup hyperlinkmembersc steinhayse8 Aug '12 - 8:01 
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?
AnswerRe: setup hyperlinkmembermark merrens8 Aug '12 - 8:55 
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

GeneralRe: setup hyperlinkmembersc steinhayse8 Aug '12 - 9:31 
Why would you use javascript and/or jquery instead of response.redirect? What is the benefit?

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   


Advertise | Privacy | Mobile
Web04 | 2.6.130516.1 | Last Updated 21 May 2013
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid