|
It depends on your program design first.
You can issue a postback to the server, and reload the page, while sending the file down to the browser, if the user clicks ok on the download, or you can do it on the client side using javascript, in which the page stays intact, and javascript intializes the download.
I use the javascript method now. I see no reason to issue a postback, even if it's async.
Javascript
window.open(url to file);
|
|
|
|
|
Hi friends,
i am having AJAX call in common.js , like
data type: Json and URl : sample.aspx, i have registered the user control in the aspx page(sample.ascx)... where i am registering the webservice call in Onprerender.. and binding the result into user control in onpreRenderComplete...
and getting back the result in the form of JSON in javascipt...
As i want to assign this result in to Enum... is it possible to get the response result in user control?.. or any other way to assign the result into enum in js ?
thanks and regards,
Dayakar.dn
|
|
|
|
|
Hi,
Please see the below code snippet to use the enums in javascript.
var Days = {"sunday" : 0, "monday" : 1, "tuesday" : 3, "wednesday" : 4, "thursday" : 5, "friday" : 6, "saturday" : 7};
document.write("<b>Day Names Enumerator=</b> " + Days.friday + "<br />");
Output:
Day Names Enumerator= 6
Assign the json values to the enum in the javascript.
Hope this helps.
-Manognya
__________________________________________________
$ God gives what is best.Not what all you wish
|
|
|
|
|
Yes,
You make a empty container like a panel control "<div id="container"></div>" on your webform or user control, assign an ID to the container, then the server renders the page and sends the HTML to the users browser.
You then write Javascript or JQuery to wait for the DOM to be ready. Now make the call to the web service, parse the JSON response, and use JQuery to populate the container with JQuery written HTML tags, and your JSON data.
You just need a container to populate rendered by the server, and on the client side, fill the container, but the DOM has to be ready. While the container is waiting to be populated, and progress indicator can be displayed until the web service is done.
|
|
|
|
|
Hello,
I have 2 closely related questions, would you please help.
1. In my ASP.NET MVC application, I am encapsulating the Logged In User Name within a static property in a class as
public static string LoggedInUserName
{
get
{
return HttpContext.Current.User.Identity.Name;
}
}
Now, I am wondering, as the property is static, will that value be cached so that if a new user visit the website, the last returned user's user name will be returned by the Property ? I am expecting that, every call to the property 'LoggedInUserName' the fresh new Identity value will be returned. Am not I right ?
2. If I want to cache a value within the application life cycle, I know I can use a static field. But, is it required that the static field be public ? Or any private static field is also cached within the application life cycle as well ?
Regards.
|
|
|
|
|
To the best of my knowledge, none of the code you write or compiled is cached.
You seem to have the term cache confused with the session state of the http server (web server)and the relationship of the http context that is created for each browser that connects to the http server.
|
|
|
|
|
Hi,
Thank you so much for your reply, actually I meant cache not by the Http Cache. I meant, I can keep the data live in the Memory as long as the Application is live (Web.Config is not modified or application is not restarted).
So, do you think, my Public static get accessor will return the same data for every time just because it is static ? I know if I used a static field inside the get accessor than, the value is not lost from memory.
|
|
|
|
|
No,
The data lives in the web servers session context, your just writing code that talks to the web server if the data exist. So you also need to make sure that the data exist before you ask for the data, or else the code will bomb with an object not found.
Once the session expires, usually 20 minutes, that's it, the handle to the web servers session context is deleted, and your data is cleared. You can't store session data forever, it's has a short ( finite ) lifespan.
If you want to store temporary data, then you write to the database on the server side, or write a cookie on the client side. And ask the browser for the cookie if it exist thus - Request.Cookie
3rd edit:
Don't worry about the code, or whether it is public or private. Technically, the object should already be global, in which you can access the data on another web page using the same code.
If your using the code to remember who the user is, on many pages after they sign in, then your alright. Just make sure to check the identity when needed.
modified 6-Jan-12 17:21pm.
|
|
|
|
|
Hi how are you? please send me few information about the development of online shoping syatem.
I am looking to form a system in which my standing will be like middle man/services provider.
For example I have a stockist with me in business having medicines range and if any my cutomer need to buy few items online. I will able to recieve the request and the proceed it to stockist.
At other hand for example I decided to take commision fron the stockist side I need to maintain accounts as well.
At all game of Inventory, Request, procceded request (Request Status), Dlivery, after successful deal 1% shuold automatically transfer to my account.
Thats all dear now you guide me which tools will be used for it as well, I have windows XP plateform.
Infact after long time I came to develop a system first time as my university project as I am with DataBases development back ground and regarding web development begginer level.
I will appreciate the codings, design, DFDs every thing any one share so that I can study deeply. More for online books send me a website link.
Regards,
Adnan
|
|
|
|
|
A good place to start would be some of the tutorials on the ASP.NET[^] web site.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
Well what you want to do has nothing to do with an online shopping system.
It's a transfer of money from 1 checking account to another checking account. You can't pay yourself a commission or simply take money from someone, the world is not setup that way.
I suggest you start with business models first, study some economics, and learn how to frame out your business model without a website ( lets say mail order ) and fine tune your process. Then you will learn the complexities of being responsible for money, fraud, theft, marketing, payroll and so forth.
|
|
|
|
|
I'm developing an Asp.Net image placeholder control. When the user hovers the mouse over the image, a toolbar fades in at the top and give the user the option to: upload a different image, change the comments for the image, or revert back to the default avatar.
I've based the upload control on Uploadify. Everything about this control is working great except one problem.
Explanation: When the image is first loaded on the page, the embedded toolbar's css sets the display to: none. Once the user hovers over the image, the toolbar containing the Uploadify control is faded in using jQuery: '.fadeIn()'. After the upload, on the onAllComplete event, the toolbar is faded out using jQuery: 'fadeOut()',
Problem: Uploadify does not perform uploads after the first initial upload "when the .fadeOut() method is called on the the toolbar!
If the container remains visible, uploads execute just fine. By the way, the .fadeIn(), .fadeOut() methods can be called "before" any uploads, and there is no error. The culprit seems to be the "post upload" .fadeOut() method.
Can anyone help with this issue? I can simply embed the toolbar as a permanent fixture to the image placeholder, but it has a much more professional appeal with the fade effects.
Here some bare bones code that will re-create the problem:
//------------ HTML Header Code -----------------------------
<script src="jquery-1.6.2.js" type="text/javascript"></script>
<script src="jquery.uploadify.v2.1.4.min.js" type="text/javascript"></script>
<script src="swfobject.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#file_upload').uploadify({
'uploader': '/uploadify.swf',
'script': '/Handler1.ashx',
'folder': '/uploads',
'onAllComplete': function() {
if (window.frozenImageEditorToolBar) {
$(window.frozenImageEditorToolBar).removeAttr('freeze'); $(window.frozenImageEditorToolBar).fadeOut();
window.frozenImageEditorToolBar = false;
}
}
});
$('#container').mouseenter(function() {
$('#toolbar').fadeIn();
});
$('#container').mouseleave(function() {
if (!$('#toolbar').hasAttr('freeze'))
$('#toolbar').fadeOut();
});
$('#toolbar').mousedown(function(e) {
$(this).attr('freeze', '1');
window.frozenToolBar = $(this);
});
});
(function($) {
$.fn.hasAttr = function(attribute) {
var attr = this.attr(attribute);
return (typeof attr !== 'undefined' && attr !== false);
}
})(jQuery);
</script>
//-------- HTML Body Code --------
<div id="container" style="height: 150px; width: 250px; background-color: #6699FF;">
<div id="toolbar" style="background-color: #C0C0C0; display: none;">
<input id="file_upload" type="file" />
</div>
</div>
|
|
|
|
|
Looks like a programming mistake
the attr freeze is used to indicate activity, on 1 line, the attr is completely removed, so you can't set the freeze again because it's gone.
// Freeze is set to 1
$(this).attr('freeze', '1');
// The attr is deleted
if (window.frozenImageEditorToolBar) {
$(window.frozenImageEditorToolBar).removeAttr('freeze'); $(window.frozenImageEditorToolBar).fadeOut();
window.frozenImageEditorToolBar = false;
}
}
});
Freeze should be set to 0
|
|
|
|
|
Hi, could anyone give me example on how to maintain TabControl in ASP.Net?
Here's the problem :
- I have TabControl with many of Tabs
- Each of Tab contain various kins of object, i.e DataGrid.
- Each of DataGrid containing data from database with request query comes from textBox (say it txtCari).
- When I click SEARCH button,the value on txtCari become parameter for querying database.
- The reslt keept in DataGRid on each tab (each datagrid contain difeerent data)
- But guess what?. It's need more than 6 seconds to load..
Can anyone give me the way how to makeitfaster?'
With xample please..
Tq
|
|
|
|
|
Hi,
Few tips to maintain the tabcontrol performance:
1.Do not drag drop many objects on to each tab.Instead used the user control and gives instances on each tab.
2.Check if you are loading data in all tabs each time a tab is clicked.(Page Posting back?).
3.Which tab control are you using ? asp.net or ajax? (put the tab control in ajax update panel to reduce the post backs)
Hope this helps to figure out where it is taking more time to load.
-Manognya
__________________________________________________
$ God gives what is best.Not what all you wish
|
|
|
|
|
pls i want to transfer data from one content page to another, i use c# and asp.net 4.0
thanks alot
|
|
|
|
|
|
you can do that by using session or by sending data as paramter in the request
1-in first page
Session["Name"]=<any variable>;
Session["ID"]=<any variable>;
2- in other page
string x=Session["Name"].ToString();
other Soluation
1- in first page
Response.redirect("Default2.aspx?Name="+<any Variable>+"&id="+<anyVarible>);
2-in last Page
request.Get("Name");
request.Get("ID");
|
|
|
|
|
passing values in query string is a wrong practice as it will be exposed to other users .try delegates and events.you will find lots of article regarding thin in google
|
|
|
|
|
Hi,
another method is here to send data on page to another page though cookies.
Response.Cookies["UserName"].Value = "Erhan";
Response.Cookies["UserName"].Expires = DateTime.Now.AddDays(7);
string username = string.Empty;
if(Request.Cookies["UserName"] != null)
{
username = Server.HtmlEncode(Request.Cookies["UserName"].Value);
}
|
|
|
|
|
Hi,
As this is my first project, I really do not have much idea to debug this. I have a listview. I am writing code manually to populate listview. As the listview is very large, I have a search button where user enters a search string. I am trying to build a sql string from here and populate the listview. Everything works fine but when I click on next page, it does not include the search string. I think it is just populating the 2nd page without the search criteria. If I remove the data pager control, it works fine. I am not able to put proper code datapger_PagePropertiesChanging. I appreciate if someone can help me with this.
Here is my list view markup:
<div class="topcontent">
<asp:TextBox ID="txtSearch" runat="server" cssClass="txt"></asp:TextBox>
<cc1:TextBoxWatermarkExtender ID="tbwatermarkSearch" runat="server" TargetControlID="txtSearch" WatermarkText="Search Contractor..">
</cc1:TextBoxWatermarkExtender>
<asp:Button ID="btnSearch" runat="server" cssClass="btn" onClick="btnSearch_Click" Text="Search" />
</div>
<asp:ListView ID="lvContractors" runat="server" OnPagePropertiesChanging="lvContractors_PagePropertiesChanging">
<LayoutTemplate>
<div class="ListViewGrid">
<table class="tblpadding">
<tr>
<th class="HeaderStyle">
Contractor Number
</th>
<th class="HeaderStyle">
First Name
</th>
<th class="HeaderStyle">
Last Name
</th>
<th class="HeaderStyle">
View
</th>
<th class="HeaderStyle">
Edit
</th>
</tr>
<tbody><asp:PlaceHolder runat="server" ID="itemPlaceholder" /></tbody>
</table>
</div>
</LayoutTemplate>
<ItemSeparatorTemplate> <td> <hr /> </td>
</ItemSeparatorTemplate>
<ItemTemplate>
<div >
<tr>
<td class="RowStyle"><%#Eval("ContractorNumber")%></td>
<td class="RowStyle"><%#Eval("FirstName")%></td>
<td class="RowStyle"><%#Eval("LastName")%></td>
<td class="RowStyle">
<asp:HyperLink ID="lnkView" runat="server" CssClass="link"
NavigateUrl='<%# "ContractorEdit.aspx?ID=" + Eval("ContractorNumber") + "&Mode=" + "CV" %>'
Target="_blank" Text="View" />
</td>
<td class="RowStyle">
<asp:HyperLink ID="lnkEdit" runat="server" CssClass="link"
NavigateUrl= '<%# "ContractorEdit.aspx?ID=" + Eval("ContractorNumber") + "&Mode=" + "CE" %>'
Text="Edit"> </asp:HyperLink>
</tr>
</div>
</ItemTemplate>
<AlternatingItemTemplate>
<div>
<tr>
<td class="AlternatingRowStyle"><%#Eval("ContractorNumber")%></td>
<td class="AlternatingRowStyle"><%#Eval("FirstName")%></td>
<td class="AlternatingRowStyle"><%#Eval("LastName")%></td>
<td class="AlternatingRowStyle">
<asp:HyperLink ID="lnkView" runat="server" CssClass="link"
NavigateUrl='<%# "Contractor.aspx?ID=" + Eval("ContractorNumber")%>'
Target="_blank" Text="View" />
</td>
<td class="AlternatingRowStyle">
<asp:HyperLink ID="lnkEdit" runat="server" CssClass="link"
NavigateUrl= '<%# "ContractorEdit.aspx?ID=" + Eval("ContractorNumber") + "&Mode=" + "CE" %>'
Text="Edit"> </asp:HyperLink>
</tr>
</div>
</AlternatingItemTemplate>
<ItemSeparatorTemplate>
<tr>
<td colspan="5" class="itemseparator"></td>
</tr>
</ItemSeparatorTemplate>
</asp:ListView>
<div class="pager">
<asp:DataPager PageSize="20" ID="DataPagerContractor" runat="server" PagedControlID="lvContractors"
NextPreviousButtonCssClass="PrevNext"
CurrentPageLabelCssClass="CurrentPage"
NumericButtonCssClass="PageNumber">
<fields>
<asp:NumericPagerField
PreviousPageText="< Prev"
NextPageText="Next >"
ButtonCount="10"
NextPreviousButtonCssClass="PrevNext"
CurrentPageLabelCssClass="CurrentPage"
NumericButtonCssClass="PageNumber" />
</fields>
</asp:DataPager>
</div>
</div> Code behind this: Partial Class Contractor
Inherits System.Web.UI.Page
Private txtKeywordSearchWhereClause As String = ""
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
Session("Clicked") = "Contractor"
End If
If Not DBNull.Value.Equals(txtKeywordSearchWhereClause) Then
LoadContractors(txtKeywordSearchWhereClause)
Else
LoadContractors("")
End If
End Sub
Private Sub LoadContractors(ByVal strSearch As String)
Dim strConn As SqlConnection = New SqlConnection(ConfigurationManager.ConnectionStrings("Conn").ConnectionString)
strConn.Open()
Dim sql As String = "SELECT * FROM tblContractor1"
If Not strSearch = "" Then
sql = sql & strSearch
sql = sql & " ORDER BY LastName"
End If
Dim da As SqlDataAdapter = New SqlDataAdapter(sql, strConn)
Dim dt As DataTable = New DataTable()
da.Fill(dt)
lvContractors.DataSource = dt
lvContractors.DataBind()
End Sub
Protected Sub buttonAdd_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles buttonAdd.Click
Response.Redirect("ContractorEdit.aspx", False)
End Sub
Protected Sub btnSearch_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSearch.Click
' Keyword Search
Dim txtKeywordSearch As String = txtSearch.Text
Dim txtWhereClause As String = ""
If txtKeywordSearch.Trim() <> "" Then
txtWhereClause = " WHERE FirstName LIKE '%" + txtKeywordSearch + "%'"
txtWhereClause = txtWhereClause + " OR LastName LIKE '%" + txtKeywordSearch + "%'"
txtWhereClause = txtWhereClause + " OR ContractorNumber LIKE '%" + txtKeywordSearch + "%'"
txtKeywordSearchWhereClause = txtWhereClause
End If
LoadContractors(txtKeywordSearchWhereClause)
End Sub
Protected Sub lvContractors_PagePropertiesChanging(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.PagePropertiesChangingEventArgs) Handles lvContractors.PagePropertiesChanging
DataPagerContractor.SetPageProperties(e.StartRowIndex, e.MaximumRows, False)
'rebind List View
If Not DBNull.Value.Equals(txtKeywordSearchWhereClause) Then
LoadContractors(txtKeywordSearchWhereClause)
Else
LoadContractors("")
End If
End Sub
End Class
|
|
|
|
|
hi all,
Ajax calendar extender not working in .Please suggest me better way to show calendar in black berry phone.
Regards,
Vishnu.
|
|
|
|
|
hi friends
i need to create a mergetag which combines the fields which i specifiy instead of the email if of the person
so how to use the mergetag...
can anyone help me with an example..
K.Gayathri
|
|
|
|
|
Hello everyone,
Im having a problem regarding in adding item in a listbox
when im invoking a delegate. this code is in an ascx file.
this is my codes:
Public Delegate Sub addLstBoxDel(ByVal fileFound As String)
Public Sub addLstBox(ByVal fileFound As String)
lstResult.Items.Add(fileFound)
End Sub
Dim ALBDelegate As me.addLstBoxDel
ALBDelegate = AddressOf Me.addLstBox
ALBDelegate.Invoke(file)
Thanks in advance,
jyn
|
|
|
|
|
init the delegate using 'New'
|
|
|
|
|