Quantcast
Channel: CodeProject Latest postings for ASP.NET
Viewing all 3938 articles
Browse latest View live

dynamically URL for JS file

$
0
0
Hi,
 
I see in some places when I try to debug a .js file that the url of the file is different from call to call.
How do I accomplish it?
If I have a .js file with a name, how can I change the url to it every call.
 

thanks or the help

url Redirection in asp.net

$
0
0
Hello sir my question is that i want to redirect one url to another url through web config
 

mean http://default.aspx to http://default.aspx" ...
anybody please help me for this.......?????

How to display message/pop-up in web api?

$
0
0
Hello,
 
I am writing to seek help, in how do I go about writing pop-up message, when the user fails to login or is not logged in. This is what I have so far:
[Authorize]
        public HttpResponseMessage GetUser()
        {
 
            if (User.IsInRole("admin"))
            {
                var mes = string.Format("admin user");
                return Request.CreateErrorResponse(HttpStatusCode.NotFound, mes);
            }
 
            elseif (User.IsInRole("trial"))
            {
                var mes = string.Format("trial customer");
                return Request.CreateErrorResponse(HttpStatusCode.NotFound, mes);
            }
 
            // code for not logged on users.
        }
 

Any guidance or help would be very much appreciated.
Many thanks in advance.

implementation of contact manager

$
0
0
Hi frnds, i am implementing contact manager, in it user can add groups and manage the groups by adding contacts init and vise verse, but when the user want to add or remove contacts from particular group how to update it in the database so that no duplicate values is inserted. what is the best process to do.
 

 
thanks in advance

Deploy ASP.NET MVC site under existing ASP site

$
0
0
Hi All,
 
Not really sure where to post this question but I hope someone here can help.
 
We have a classic asp site deployed in IIS7 under a domain, let's call it www.classicsite.com. We've developed a site in ASP.NET MVC and need to integrate it into the first site under the same domain so it'll be access as follows: www.classicsite.com/mvc.
 
What will the IIS setup be like?
 
Thanks.
 
Ronald

asp.net dropdownlist show all list item

$
0
0
i new in asp.net i created asp.net dropdownlist , every time using mouse add click , when show all item, but focus dropdownlist show all itemlist

How to playing song in the mobil devices with my ASP

$
0
0
I used some examples but doesn't work on the computer or movil device.
 
when i run the proyect (f5) in the proyect this code works but when i go to chrome or explorer directly doesn't work. How can i do.....
 
This is the code.
 

one:
 
Dim player As New System.Media.SoundPlayer
player.SoundLocation = ("c:\sonidos\error.wav")
player.Play()
 
two:
 
Dim sp As SoundPlayer
sp = New SoundPlayer(My.Resources._error)
sp.Play()
 
Thanks a lot.

Page Cache - Panel control

$
0
0
Hi Techies
I cached a page using the directive and attribute VarByParam.It worked fine and my problem is I am having a web page with a Panel control and inside the panel two text box were used and the ID for those text box are txtTest1 and txtTest2 with the text Test1 and Test2 respectively. All my need is to partially cache this particular panel along with their child controls and its value means the two textboxes and its text. Please give me the solutions.
 
Note: User Control should not be used

cant trigger button server side event

$
0
0
Master page :
 
there is a script manager in master page. In child page i am trying to trigger button's server click event. i can call jquery click event on its click..i cant' call its server side event
 
Content page :
 
<input id="btnSignin" class="button cta btn btn-primary" name="commit" type="submit" value="Sign in" runat="server" önserverclick="btnSignup_click" />
<asp:Button ID="btnSignup" runat="server" Text="Create Account" CssClass="button cta btn btn-primary btnSignup" OnClick="btnSignup_click" />
 

protected void btnSignup_click(object sender, EventArgs e)
{
}
 
am i missing anything ?

Facebook share button is not working

$
0
0
Hi,
I have implemented facebook share button functionality in my application using below code. But that is not working in my application. can u provide some suggestion to solve this prob.
 
Snippet:
http://www.facebook.com/sharer.php?s=100&p[url]" + DomainName + "&p[images][0]=" + ImgUrlValue + "&p[title]=" + ProductDesc + "&p[summary]=" + product summary.

Facebook share using jQuery

$
0
0
How to implement facebook share functionality using jQuery ???
 
any thoughts ???
 
Thanks

Login status

$
0
0
Hi
I'm coding an application sort of a chat. but the challenge that I'm facing is. How do I allow more than one user to login in my browsers IE and Crome in my PC?

data is not getting saved to the database.

$
0
0
Hello Experts,
 
This is my very first post here. so, please take easy on me.
 
I wrote a stored proc that takes 4 parameters and inserts into the db.
 
I have tested it using SSMS and it works great but I can't get it work with my .net app.
 
No errors but just doesn't work.
 
This is supposed to go live on Tuesday and I must give a demo by Monday.
 
The insert bit is the last task and is supposed to be easy.
 
Can someone please help?
 
Code is below and thanks a lot in advance.
 
    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs)
 
        Dim questld As HiddenField = DataList1.FindControl("HiddenField2")
 
        For Each item As DataListItem In DataList1.Items
            If item.ItemType = ListItemType.Item Or item.ItemType = ListItemType.AlternatingItem Then
                Dim positionid As Integer
                Dim choiceid As Integer = 0
                Dim choicetext As String = ""'positionid = CType(item.FindControl("Label3"), Label).Text
                positionid = CType(item.FindControl("HiddenField2"), HiddenField).Value
                Dim anstype As HiddenField = item.FindControl("HiddenField1")
                Select Case anstype.Value
                    Case "S"
                        Dim rbl As RadioButtonList = item.FindControl("RadioButtonList1")
                        choiceid = rbl.SelectedValue
                        SaveVotes(positionid, choiceid, choicetext, "")
                    Case "M"
                        Dim cbl As CheckBoxList = item.FindControl("CheckBoxList1")
                        For i As Integer = 0 To cbl.Items.Count - 1
                            If cbl.Items(i).Selected Then
                                choiceid = cbl.Items(i).Value
                                SaveVotes(positionid, choiceid, "NA", "")
                            End If
                        Next
                    Case "T"
                        Dim txt As TextBox = item.FindControl("TextBox1")
                        choicetext = txt.Text
                        SaveVotes(positionid, 0, choicetext, "")
                End Select
            End If
        Next
        DataList1.Visible = False
 
    End Sub
    Private Sub SaveVotes(ByVal qid As Integer, ByVal cid As Integer, ByVal ct As String, ByVal cuser As String)
 
        Dim al As ArrayList = CType(Session("AnswerList"), ArrayList)
        'Dim s As String
 

        If al Is Nothing Then
            Response.Redirect("Thanks.aspx")
        End If
 
        Dim connStr As String = ConfigurationManager.ConnectionStrings("BallotsConnectionString").ConnectionString
        Dim conn As New SqlConnection(connStr)
        Dim cmd As New SqlCommand("InsertBallots", conn)
        cmd.CommandType = CommandType.StoredProcedure
        Dim p1 As New SqlParameter("@qid", qid)
        Dim p2 As New SqlParameter("@cid", IIf(cid = 0, DBNull.Value, cid))
        Dim p3 As New SqlParameter("@ct", IIf(ct = "", DBNull.Value, ct))
        Dim p4 As New SqlParameter("@cuser", Session("UserName"))
        cmd.Parameters.Add(p1)
        cmd.Parameters.Add(p2)
        cmd.Parameters.Add(p3)
        cmd.Parameters.Add(p4)
        conn.Open()
        cmd.ExecuteNonQuery()
        conn.Close()
 
    End Sub

youtube videos behind login page

$
0
0
Hi,
 
I trying to display Videos which are private and will be displayed only on my website or when I login to Youtube. Can anyone help me in this regard.

how to set the visibility true for tag in vb.net

$
0
0
In .ascx
===========
<divid="Divwatermark"class="watermark"visible="true"runat="server"><palign="center">Cancelled</p></div>
 
Code Behind
=================
if True then
Divwatermark.Visible = True
Else
Divwatermark.Visible = False
End If
 
Even after the IF condition evaluates to TRUE and Divwatermark.Visible = True is getting executed, Divwatermark.Visible remains FALSE. Help me how to set the visibility of Divwatermark TRUE. Thanks in advance.
Nandan Basak

How to assign role to linq queries?

$
0
0
Dear all,
 
I am writing to seek assistant, in how do I assign my queries below to specific roles. I am currently not storing my roles for any user in my db server. Is this task still plausible? Can this task by done using either using 'string array' roles (i.e. string[] userRoles = new string[] { "full", "trial" }), or using 'Group By' function in linq qeuery?
 
publicbool full(string username, string password)
        {
            //define the query : query will be an IQueryable
var query = // query
// "execute" the query
return query.FirstOrDefault() != null; 
 
        }
 

        publicbool trial(string username, string password)
        {
            //define the query : query will be an IQueryable
var query = // query
// "execute" the query
return query.FirstOrDefault() != null; 
 
        }
 
Many thanks for help and time.

DropList doesn't post back

$
0
0
I have an asp.net web page with two droplist controls. Selecting an itme in the first control causes a database query, and the 2nd droplist is populated with the query results.
 
This works fine when I'm running under the debugger on my local box.
 
However, when the site is deployed (same domain as my box and the database), it does not always populate the 2nd box. In fact, the SelectionChanged event handler for the 1st droplist doesn't get called at all. If it doesn't work, I can usually make it work after refreshing the page (with F5) a couple of times.
 
Both droplists are set with autopostback=true and viewstatemode=enabled.
 
This happens in all browsers.
 
There is currently no code being executed if IsPostBack is true.
 
This morning, it would happen every time I opened the browser and went to the page in question (and that's how I found out it wasn't even hitting the event handler). I added some debugging code, and now it seems to work fine, and I now can't get it to fail. I even deleted the three lines of debugging code, and it still works. This tells me it's not really fixed.
".45 ACP - because shooting twice is just silly" - JSOP, 2010
-----
You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
-----
When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

Redirect to web form from web service

$
0
0
I use this code to redirect aspx page :
in locahost that run open Default.aspx page
but in http://tracklocation.somee.com/LocationService.asmx
it do not any thing . Somebody help me
 
[WebMethod]
public string DataLocation(string location)
{
string url = "http://tracklocation.somee.com/Default.aspx?id=" + location

Context.Response.Redirect(url);

location = Server.UrlDecode(location);
return location;

}

Asp.net DropDownList Data Function

$
0
0
Hi, now i need to create dropdownlist calling data from sql server database.
Dropdownlist item from database
-Louis
-Louis
-William
-William
 
but i dont want to repeat the word, i need the dropdownlist like this
-Louis
-William
 
can help me the coding?Thx

Session be Null in ASP.Net Web Application

$
0
0
HI All,
 
We develop a web application and when the user loggedin I save the userID in the session["UserID"] and at the each page_load we check the session if null we log off and redirect to loginpage.
 
My problem if any exception occurred and enter to catch block the session["UserID"] being NULL and log off the user.
 
Please help me to know why the session be a null if any exception occurred. and note that all the methods and code we set them in a try-catch block and we write the code to a log file.
 
This is an error:::
" unable to evaluate expression because the code is optimized or a native frame is on top of the call stack"
 
Thank you very much.
Viewing all 3938 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>