|
Strong canvas, to hold all those programming guides you need to start reading.
|
|
|
|
|
Search Google with 'getting started asp' and there you go. All the best!
***** Programme comme si dept soutien technique. est plein de tueurs en série et ils savent adresse de votre domicile. *****
|
|
|
|
|
Learning to spell the word Career is a good start.
------------------------------------
I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave
CCC Link[ ^]
Trolls[ ^]
|
|
|
|
|
I'm currently programming on ASP.NET 3.5 and started learning about URL routing. I found an article on it here. I went through it and tried to implement it in my site but came across an issue that I can't figure out.
I'm trying to use this for a web store. Right now to see a products details the user would need to go to an address such as /Shopping/ProductDetails.aspx?productID=XXX where 'XXX' is the product GUID from the database. I wanted to make it simpler so a customer could go to /Products/Computer250 and it would bring up a specific product.
I got the routing to work where it would redirect to the correct product page. However on the product details page I have a form view with controls it is to display information like price, description, In Stock/Backordered, etc. After the products information is loaded from the database, I use the following code to set the In Stock/Backordered label:
Dim totalStock As Integer = CInt(ds.Tables(0).Rows(0).Item("TotalStock"))
Dim StockLabel As Label = DirectCast(fvProduct.FindControl("lblStock"), Label)
If totalStock > 0 Then
StockLabel.Text = "In Stock"
StockLabel.ForeColor = Drawing.Color.Green
Else
StockLabel.Text = "Backordered"
StockLabel.ForeColor = Drawing.Color.Red
End If
Now this code work's fine if the customer got to the product's details page if they clicked on a link with the products GUID. When they arrive at the product's details page because of the URL routing, the StockLabel object is nothing and this causes a error.
Why does fvProduct.FindControl return the correct label when the user follows a direct link but when the user gets to the page based on URL routing the fvProduct.FindControl returns nothing?
Any help would be greatly appreciated as I haven't been able to figure this out, or find an answer online. Thanks in advanced for any help you can provide.
|
|
|
|
|
What is fvProduct? is this control placed on current page?
Parwej Ahamad
|
|
|
|
|
It is a form view control.
|
|
|
|
|
I am not sure where is the problem existing. Can you post here code snippet of HTML and Code behind? As per my understanding we can find control only in which state we are like Edit Temple/insert template etc.
So please post Html and C#/VB code in which event you are trying to find.
Parwej Ahamad
|
|
|
|
|
In my Global.asax:
Imports System.Web.Routing
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
RegisterRoutes(RouteTable.Routes)
End Sub
Sub RegisterRoutes(ByVal routes As RouteCollection)
routes.Add("View Product", New Route("Products/{*ProductName}", New ProductRouteHandler()))
End Sub
In a class file ProductRouteHandler :
Imports System.Data.SqlClient
Imports System.Web.Routing
Public Class ProductRouteHandler
Implements IRouteHandler
#Region "Variables"
Dim connectionString As String = ConfigurationManager.ConnectionStrings("SQLMembership").ConnectionString
Dim myConnection As New SqlConnection(connectionString)
#End Region
Public Function GetHttpHandler(ByVal requestContext As System.Web.Routing.RequestContext) As System.Web.IHttpHandler Implements System.Web.Routing.IRouteHandler.GetHttpHandler
Dim productName As String = requestContext.RouteData.Values("ProductName").ToString
If String.IsNullOrEmpty(productName) Then
Return CType(System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath("~/Shopping/PageNotFound.aspx", GetType(Page)), Page)
End If
Dim selectSQL As String = "SELECT ProductID FROM Products WHERE ProductShortName='" & productName & "'"
Dim selectCommand As SqlDataAdapter = New SqlDataAdapter(selectSQL, myConnection)
Dim ds As New DataSet
selectCommand.Fill(ds)
If ds.Tables(0).Rows.Count > 0 Then
HttpContext.Current.Items("ProductID") = ds.Tables(0).Rows(0).Item("ProductID").ToString
Return CType(System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath("~/Shopping/ProductDetails.aspx", GetType(Page)), Page)
Else
Return CType(System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath("~/Shopping/PageNotFound.aspx", GetType(Page)), Page)
End If
End Function
End Class
Then the section of the web page that is having trouble is in the ProductDetails.aspx page. I have only included the full text of the form view control:
<asp:FormView ID="fvProduct" runat="server" DataKeyNames="ProductID" DataSourceID="ProductDataSource">
<ItemTemplate>
<div id="ContentHead" class="ContentHead" runat="server">
<%#Eval("ProductName")%></div>
<br />
<table style="border: 0px;">
<tr>
<td style="vertical-align: top;">
<section>
<div id="section_articleOneIdentifier">
</div>
<article id="article_one">
<div id="gallery">
<asp:PlaceHolder ID="ImageLightBox" runat="server" />
</div>
</article>
</section>
<%-- <img src=
alt=
</td>
<td style="vertical-align: top;">
<%#Eval("ProductLongDescription")%>
<br />
</td>
</tr>
</table>
<div style="padding-left: 250px; text-align: right">
Your Price: <%#Eval("ProductPrice", "{0:c}")%>
<br />
</div>
<div style="padding-left: 400px; text-align: right;">
<input type="number" id="itemCount" value="1" min="1" max="999" required="true" onblur="checkItemCount();"
onchange="revertColors();" />
<br />
<a style="border: 0 none white" onmouseover="setCursorPointer();" onmouseout="setCursorNormal();">
<img id="imgAddToCart" src="Images/AddToCart.png" runat="server" alt="Add To Cart"
style="border-width: 0" onclick="process();" /></a>
<div style="vertical-align:top;text-align:right;padding-right:10px;">
<asp:Label ID="lblStock" runat="server" Font-Size="10px" Font-Bold="true" Text="" />
</div>
<br />
<br />
</div>
</ItemTemplate>
</asp:FormView>
And in the code behind of ProductDetails.aspx that is causing the error is:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If String.IsNullOrEmpty(Request.QueryString("productID")) Then
productID = CType(HttpContext.Current.Items("ProductID"), String)
Else
productID = Request.QueryString("productID")
End If
DetermineStock()
CreateLightBox()
End Sub
Private Sub DetermineStock()
Dim selectSQL As String = "SELECT TotalStock FROM Products WHERE ProductID='" & productID & "'"
Dim selectCommand As SqlDataAdapter = New SqlDataAdapter(selectSQL, myConnection)
Dim ds As New DataSet
selectCommand.Fill(ds)
Dim totalStock As Integer = CInt(ds.Tables(0).Rows(0).Item("TotalStock"))
Dim StockLabel As Label = DirectCast(fvProduct.FindControl("lblStock"), Label)
If totalStock > 0 Then
StockLabel.Text = "In Stock"
StockLabel.ForeColor = Drawing.Color.Green
Else
StockLabel.Text = "Backordered"
StockLabel.ForeColor = Drawing.Color.Red
End If
End Sub
In the user arrives at this page using the direct link www.mywebsite.com/Shopping/ProductDetails.aspx?id=ProductID then everything works fine. However if they come to this page from the routing class by visiting a page such as www.mywebsite.com/Products/ProductName then in the DetermineStock method, the line that finds the control lblStock returns nothing and therefore I cannot set the text or color of the label. However, if they follow the direct link that has the product id (and therefore the routing class was not used) the same line that finds the control lblStock in the form view returns the correct control and I can set the text and color appropriately.
|
|
|
|
|
|
<httpModules>
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add name="QueryStringModule" type="QueryStringModule"/>
<add name="UrlRoutingModul" type="System.Web.Routing.UrlRoutingModule, System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</httpModules>
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<modules>
...
<add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</modules>
<handlers>
...
<add name="UrlRoutingHandler" preCondition="integratedMode" verb="*" path="UrlRouting.axd" type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</handlers>
</system.webServer>
|
|
|
|
|
I'm using Asp.net 3.5 on Godaddy, and I need a way for users to upload large files using Asp.net FileUpload Control, I don't want to use a third party
I've changed the value of maxRequestLength in web.config as follows:
<httpRuntime executionTimeout="1100" maxRequestLength="512000" />
but when uploding a file of about 32 MB, upload process goes well (I can see percentage for the process in the down-left corner of Chrome browser), but after a while, the process restarts !! and after going with upload for a while page crashes without errors (just telling me that page cannot be displayed)
The same happens on IE (but of course without percentage)
Please help me to solve this issue without third party
|
|
|
|
|
It may helps you
string filename = fuUploadVideo.FileName;
string path = Server.MapPath("Uploads4");
string strFinalFileName = Path.GetFileName(fuUploadVideo.FileName);
long FileLength = fuUploadVideo.PostedFile.ContentLength;
long uploadchunklimit;
int SizeLimit = (int)FileLength;
if (FileLength <= 1024)
{
uploadchunklimit = 1;
SizeLimit = (int)FileLength;
}
else if (FileLength > 1024)
{
uploadchunklimit = FileLength / 1024;
SizeLimit = 10;
}
else if (FileLength <= 10240 && FileLength > 1024)
{
uploadchunklimit = FileLength / 1024;
}
else
{
uploadchunklimit = FileLength / 1024;
}
long lngSize = (long)SizeLimit;
lngSize = 1024 * 1024;
string ext = Path.GetExtension(fuUploadVideo.PostedFile.FileName);
fuUploadVideo.PostedFile.SaveAs(Server.MapPath("~\\Uploads4\\" + filename));
|
|
|
|
|
Thank you for your reply, but I don't understand how this code helps me
|
|
|
|
|
you can use fileuploader control
|
|
|
|
|
Do you mean FileUpload control?
Have you read my original post???
|
|
|
|
|
hi, i'm loading an aspx file by XmlTextReader class and trying to change the content and saving with appropriate encoding.
but after the changes the entered arabic characters are unreadable !
i added this before "" tag but it makes an exception and prevent resuming proccess:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
this is the codebehind:
[WebMethod]
public string addCommentAndChangePageSource(string commenter, string content,string pageAddress)
{
//Server.MapPath("~/" + pageAddress)
string Path = pageAddress.Replace("http://localhost:50814/jangalwiki/",Server.MapPath("~/"));
//System.IO.StreamReader r = new System.IO.StreamReader(pageAddress,System.Text.Encoding.UTF8);
XmlTextReader txReader = new XmlTextReader(pageAddress);
XmlDocument xmlDoc = new XmlDocument();
//xmlDoc.Load(r);
xmlDoc.Load(txReader);
int newCommentIndex = xmlDoc.GetElementsByTagName("commitedcomment").Count - 1;
XmlNode commitingNode = xmlDoc.GetElementsByTagName("commitedcomment")[newCommentIndex];
XmlNode freshNode = commitingNode.CloneNode(true);
XmlNode writerLabel = xmlDoc.GetElementsByTagName("commitedcommenterName")[newCommentIndex];
XmlNode commentContentLabel = xmlDoc.GetElementsByTagName("commitedcommentContent")[newCommentIndex];
XmlNode commentDate = xmlDoc.GetElementsByTagName("commitedcommentDate")[newCommentIndex];
XmlNode commentTime = xmlDoc.GetElementsByTagName("commitedcommentTime")[newCommentIndex];
Persia.SolarDate newDate = Persia.Calendar.ConvertToPersian(DateTime.Now);
string date = newDate.ToString();
string time = DateTime.Now.ToShortTimeString();
writerLabel.InnerText = commenter;
commentContentLabel.InnerText = content;
commentDate.InnerText = date;
commentTime.InnerText = time;
XmlNode commentsBox = xmlDoc.GetElementById("postComment");
commentsBox.AppendChild(freshNode);
//XmlDeclaration xmlDec = (XmlDeclaration)xmlDoc.FirstChild;
//xmlDec.Encoding = System.Text.Encoding.UTF8.ToString();
xmlDoc.Save(Path);
return "changed";
}
what to do?
|
|
|
|
|
I'm getting the "Microsoft JScript runtime error: Object expected" error using Telerik for MVC. These are the lines causing the issue:
@Html.Telerik().ScriptRegistrar().OnDocumentReady(
@<text>
$('#checkAllMembers').click(function checkAll()
{
$("#ResultsGrid tbody input:checkbox").attr("checked", this.checked);
});
</text>)
The thing is, the checkAll function actually does work! I have the following line at the top of my view:
Layout = "~/Views/Shared/SiteLayout.cshtml";
<link href="@Url.Content("~/Content/Site.css")" rel="Stylesheet" type="text/css" />
<script src="@Url.Content("~/Scripts/jquery-1.5.1.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery-1.5.1-vsdoc.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/MicrosoftAjax.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/MicrosoftMvcAjax.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/MicrosoftMvcValidation.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery-ui-1.8.11.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery-ui-1.8.11.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.unobtrusive-ajax.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate-vsdoc.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/modernizr-1.7.min.js")" type="text/javascript"></script>
@(Html.Telerik().StyleSheetRegistrar().DefaultGroup(group => group.Add("telerik.common.css").Add("telerik.sunset.css").Combined(true).Compress(true)))
@(Html.Telerik().StyleSheetRegistrar().DefaultGroup(group => group.Add("telerik.examples.css").Add("telerik.common.css").Add("telerik.rtl.css").Combined(true).Compress(true)))
I have the following line at the bottom of my SiteLayout.cshtml:
@(Html.Telerik().ScriptRegistrar().DefaultGroup(group => group.Combined(true).Compress(true)))
Haven't been able to resolve this yet. Thanks in advance!.
|
|
|
|
|
Hi,
I'd like to know how to set the NavigateUrl of a ImageMap in Repeater
This code returns an error.
Thank you.
<asp:Repeater ID="RepeaterOthers" runat="server">
<ItemTemplate>
<asp:ImageMap ID="ImageOthersBack" Height="145px" Width="200px" HotSpotMode="Navigate" runat="server" ImageUrl='<%# String.Format("~/images/{0}.png", Container.DataItem) %>'>
<asp:RectangleHotSpot Top="96" Bottom="128" Left="28" Right="175" NavigateUrl='<%# String.Format("~/Link.aspx?Id={0}", Container.DataItem) %>' />
</asp:ImageMap>
</ItemTemplate>
</asp:Repeater>
|
|
|
|
|
Then post here error message too? because other person don't know how your are binding in code and with which column? so post full error message.
Parwej Ahamad
|
|
|
|
|
I have created a Client Server Chat application in Windows form using TCP/IP listeners.
I am trying the same thing in ASP.Net web app also but it seems that the traditional web service is applicable for this kind of application.
Or is there anyway i can use sockets in Web app and create Client server chat application.
Any article or help is appreciated.
|
|
|
|
|
|
Hi All,
Our Project is migrated form visual studio 2003 to 2005.
we are using frameset for page layout.(header,footer,content)
<script type="text/javascript" >
document.write('<frameset rows="'+ val1 + ','+ val2 + '" border="0">')
document.write('<frameset id="FrameName" cols="13%,87%" >')
document.write('<frame name="main" id="idmain" onload="LoadXml();" src="right.aspx" scrolling="no" noresize>')
document.write('<FRAME name="workarea" id="workarea" src="../main/home.aspx" scrolling="auto" noresize>')
document.write('</frameset>')
document.write('<frame src="bottom.aspx">')
document.write('</frameset>')
</script>
We want to remove this and go for other good approach.
We cannot use master page because each page i need to remove the html tag and add place holder.
So with out avoiding this is there any good way to solve this?
Will DIV solve this?
or Any third pary tool solve this?
Please Suggest?
Ramkumar
("When you build bridges you can keep crossing them. ")
http://ramkumarishere.blogspot.com
|
|
|
|
|
I want to send email on particular Date & Time. How to achieve this? I am using Sql 2005 for storing Date & time for sending emails.
|
|
|
|
|
You can create Sql job which executes in every say 5 minutes and fetch entry from database which mail to send.
To send the mail, you can use Clr Stored procedure.
Another approach is:
send mail using Windows/Other scheduler.
|
|
|
|
|
Create a windows application/service that will be sending emails at your chosen time. That way you have more control on other functionalities to add before and after sending your e-mails.
Good luck,
Morgs
|
|
|
|