 |
 |
Apologies for the shouting but this is important.
When answering a question please:
- Read the question carefully
- Understand that English isn't everyone's first language so be lenient of bad spelling and grammar
- If a question is poorly phrased then either ask for clarification, ignore it, or mark it down. Insults are not welcome
- If the question is inappropriate then click the 'vote to remove message' button
Insults, slap-downs and sarcasm aren't welcome. Let's work to help developers, not make them feel stupid.
cheers,
Chris Maunder
The Code Project Co-founder
Microsoft C++ MVP
|
|
|
|
 |
For those new to message boards please try to follow a few simple rules when posting your question.- Choose the correct forum for your message. Posting a VB.NET question in the C++ forum will end in tears.
- Be specific! Don't ask "can someone send me the code to create an application that does 'X'. Pinpoint exactly what it is you need help with.
- Keep the subject line brief, but descriptive. eg "File Serialization problem"
- Keep the question as brief as possible. If you have to include code, include the smallest snippet of code you can.
- Be careful when including code that you haven't made a typo. Typing mistakes can become the focal point instead of the actual question you asked.
- Do not remove or empty a message if others have replied. Keep the thread intact and available for others to search and read. If your problem was answered then edit your message and add "[Solved]" to the subject line of the original post, and cast an approval vote to the one or several answers that really helped you.
- If you are posting source code with your question, place it inside <pre></pre> tags. We advise you also check the "Encode "<" (and other HTML) characters when pasting" checkbox before pasting anything inside the PRE block, and make sure "Use HTML in this post" check box is checked.
- Be courteous and DON'T SHOUT. Everyone here helps because they enjoy helping others, not because it's their job.
- Please do not post links to your question into an unrelated forum such as the lounge. It will be deleted. Likewise, do not post the same question in more than one forum.
- Do not be abusive, offensive, inappropriate or harass anyone on the boards. Doing so will get you kicked off and banned. Play nice.
- If you have a school or university assignment, assume that your teacher or lecturer is also reading these forums.
- No advertising or soliciting.
- We reserve the right to move your posts to a more appropriate forum or to delete anything deemed inappropriate or illegal.
cheers,
Chris Maunder
The Code Project Co-founder
Microsoft C++ MVP
|
|
|
|
 |
Hi,
I'm trying to develop a custom scaffolder using the new Scaffolding framework in VS2013, but I'm having some problems understanding how to use the new ASPNet.Scaffolding.Core.Metadata.ModelMetadata class. Basically, I need to create a ModelMetdata instance based on a specified DataModel type, and pass it to the T4 template. Is there a special MetaDataProvider that I need to use for this? Any help would be appreciated.
Note that I'm not using the Entity Framework, so I don't have a DBContext to work with in this case. Just a C# class with DataAnnotations.
Thanks,
John P.
|
|
|
|
 |
I am increasing my row by 1 like this... is there are the better way to do this:
currentRow = currentRow + 1
|
|
|
|
 |
What are you talking about?
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
|
 |
Other way?
can you explain your scenario ? you can use following syntax
currentRow += 1;
currentRow ++;
currentRow = currentRow + 1
|
|
|
|
 |
Hi,
I have a web application running SSRS reports 2005 via rsweb:ReportViewer control
The reports are generated fine on IE 7-8 browsers. However I'm having some issues on the IE10.
When clicking on a hyperlink on the main report to load the sub report, the sub report is not generated in the rsweb:ReportViewer control. It navigates away from my application and it is generated in a new browser window. Also in the address bar of the browser. I've noticed that the URL of the report server is displayed with all the report parameters as query string. This is happening in IE 10 only.
Any idea how to resolve this issue?
Cheers
|
|
|
|
 |
Add the following code snippet in web.config file:
<system.webServer>
<httpProtocol>
<customHeaders>
<clear/>
<add name="X-UA-Compatible" value="IE=8"/>
</customHeaders>
</httpProtocol>
<system.webServer>
Look at life through the windshield, not the rear-view mirror
|
|
|
|
 |
Thanks for the reply DamithSL. I've tried your solution but it didn't resolve the issue.
Should the code be added to the config file of the web application or to the config file of the Report Server?
Thanks
|
|
|
|
 |
During the publishing of my web application using VS 2010 I get the following message,
Web deployment task failed. (There was an error reading IIS configuration schema from 'C:\WINDOWS\system32\inetsrv\config\schema\'.)
Can anyone please advice me the resolution?
regards
Sultan
|
|
|
|
|
 |
I've never used the web deployment, well maybe during VS2005 but that was almost 10 years ago.
Back in the old days, you use to be able to setup your IIS 5 / IIS 6 web server using software, that can read and write the IIS website metabase config files in the windows operating system. Very easy to read and write too using managed code or c++ on Windows XP.
Since IIS 7, the web config is now written to the web.config file in your project folder. So you just copy the project to your server, and just point IIS 7+ folder path to the web site project folder. Now you click on the bind link to test the bind to the server.
I'm pretty sure that the feature your speaking about is legacy, and I'm not really sure why it's still there. Some folks still use IIS 5 and IIS 6 to host web sites on, which is not very secure in today's world.
The Application pool is not written to the web config, so you have to program that by hand. If your having trouble programming the app pool, or setting permissions for the app pool in the website folder, That's another complex project.
I like the new system, because deployment time is much faster now.
Sample system.webServer. This sample programs the default page name, sets the maximum upload size, and sets compression for static and dynamic pages to TRUE. You can do much more, but this works for me on my projects. The rest of the settings are default settings.
<system.webServer>
<defaultDocument>
<files>
<remove value="iisstart.htm"/>
<remove value="index.html"/>
<remove value="index.htm"/>
<remove value="Default.asp"/>
<remove value="Default.htm"/>
<add value="index.aspx"/>
</files>
</defaultDocument>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="52428800"/>
</requestFiltering>
</security>
<urlCompression doStaticCompression="true" doDynamicCompression="true"/>
</system.webServer>
I don't know of too many people that use the feature in question. But you have to have the IIS 6 metabase compatibility turned on for Windows Vista, 7 and 8 in order for it to work I think.
http://www.iis.net/learn/manage/managing-your-configuration-settings/metabase-compatibility-with-iis-7-and-above[^]
|
|
|
|
 |
I have a scenario where I have to create multiple sheets in excel and bind data to those sheets and download. Now I have code for creating 1 sheet. I have creatied a HTML Table and binded it to excel. In the same way I have to create multiple sheets from Html table and download the excel file.
filename = filename + " Case Study"; Query_ValuesSelection = "Select * from case_study_information where locid="+DD_Location.SelectedValue.ToString()+" and methodid="+DD_Methods.SelectedValue; MySqlCommand command = new MySqlCommand(Query_ValuesSelection, con); datareader = command.ExecuteReader(); if (datareader.HasRows) { datareader.Read(); sb.Append("<table class='Tickets'>"); //sb.Append("<tr style='color:white'>"); //sb.Append("<td style='background-color:#3a4f63' colspan=" + datareader.FieldCount.ToString() + "><b>" + DD_Location.SelectedItem.Text.ToString() + "</b></td>"); //sb.Append("</tr>"); datareader.Read(); for (int colCount = 0; colCount < datareader.FieldCount; colCount++) { string str = datareader.GetName(colCount).ToString(); if (datareader.GetName(colCount).ToString() == "Sample Photo") { sb.Append("<tr height='150'>"); sb.Append("<td><b>" + str + "</b></td>"); string filepath = Server.MapPath("Images//Case Studies//" + DD_Location.SelectedItem.Text.ToString() + ".png"); // sb.Append("<td><img src='http://localhost:53340/Retrospective/Images/epa.jpg'/></td>"); sb.Append("<td><img src='" + filepath + "'/></td>"); } else { if (datareader.GetName(colCount).ToString() != "locid" && datareader.GetName(colCount).ToString() != "MethodId") { sb.Append("<tr>"); sb.Append("<td><b>" + str + "</b></td>"); sb.Append("<td><b>" + datareader[colCount].ToString().Trim() + "</b></td>"); } } sb.Append("</tr>"); }
sb.Append("</table>"); } else Response.Write(@"<script language='javascript'>alert('No Case Study Information for the selected location')</script>"); } System.Text.StringBuilder sb1 = new System.Text.StringBuilder(); sb1 = sb; if (datareader.HasRows) { HttpContext.Current.Response.ContentType = "Application/x-msexcel"; HttpContext.Current.Response.AddHeader("content-disposition", "attachment; filename=\"" + filename + ".xls" + "\""); HttpContext.Current.Response.Write("<html xmlns:x=\"urn:schemas-microsoft-com:office:excel\">"); HttpContext.Current.Response.Write("<head>"); HttpContext.Current.Response.Write("<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>"); HttpContext.Current.Response.Write("<!--[if gte mso 9]><xml>"); HttpContext.Current.Response.Write("<x:ExcelWorkbook>"); HttpContext.Current.Response.Write("<x:ExcelWorksheets>"); HttpContext.Current.Response.Write("<x:ExcelWorksheet>"); HttpContext.Current.Response.Write("<x:Name>" + filename + "</x:Name>"); HttpContext.Current.Response.Write("<x:WorksheetOptions>"); HttpContext.Current.Response.Write("<x:Print>"); HttpContext.Current.Response.Write("<x:ValidPrinterInfo/>"); HttpContext.Current.Response.Write("</x:Print>"); HttpContext.Current.Response.Write("</x:WorksheetOptions>"); HttpContext.Current.Response.Write("</x:ExcelWorksheet>"); HttpContext.Current.Response.Write("</x:ExcelWorksheets>"); HttpContext.Current.Response.Write("</x:ExcelWorkbook>"); HttpContext.Current.Response.Write("</xml>"); HttpContext.Current.Response.Write("<![endif]--> "); HttpContext.Current.Response.Write("</head>"); HttpContext.Current.Response.Write("<body>"); HttpContext.Current.Response.Write(sb.ToString()); //HttpContext.Current.Response.Write(sb1.ToString()); HttpContext.Current.Response.Write("</body>"); HttpContext.Current.Response.Write("</html>");
HttpContext.Current.Response.Write("<body>"); HttpContext.Current.Response.Write(sb.ToString()); //HttpContext.Current.Response.Write(sb1.ToString()); HttpContext.Current.Response.Write("</body>"); HttpContext.Current.Response.Write("</html>");
HttpContext.Current.ApplicationInstance.CompleteRequest(); }
|
|
|
|
 |
I was purchased web hosting space and after purchased web domain. That day I am hosted a website on my space. But my major problem is the gprs data logger send the data on my IP address. But I don't know how I can read the data and save my file on every 5 minutes.
please help me how I can do this
muruga
|
|
|
|
 |
I want to buy website source code, if you have interesting please send me the snapshots of the websites and your contact information to [email protected]
|
|
|
|
 |
You can just google, you will get many.
Life is a computer program and everyone is the programmer of his own life.
|
|
|
|
 |
how to run event of asp contol by javascript code?
|
|
|
|
|
 |
Hello Friends, I am newer to this site
|
|
|
|
 |
Welcome!
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
|
 |
Hi,,
I am getting error while using Report Viewer in VS 2005. earlier it was working fine. but it is giving error since when i installed VS2010.
But i am working on VS2005.
---------------------
Failed to map the path '/'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: Failed to map the path '/'.
Source Error:
[No relevant source lines]
Source File: c:\Users\RAVIN\AppData\Local\Temp\Temporary ASP.NET Files\dindi\2fc8545a\e6dba941\App_Web_z_wzhh2b.4.cs Line: 0
------------------
Note: I found one solution from Internet that if i run the VS2005 as administration then it is working fine. But i don't want to run VS as Administrator.
Please provide me any solution.. thanks in advance.
|
|
|
|
 |
Greetings Experts,
For the past two days now, I have been struggling with this code.
Our users had just finished using our online app to cast ballots and I have been trying to accomplish three things at same time.
One, display each candidate's name, his/her total vote count, and percentage of the vote s/he received.
With the code below, I am able to successfully display candidate's name and the total vote count for each candidate.
However, I have not been able to figure out how to display the percentage of each candidate's total vote count.
In the code shown below, if I run the sql portion of the code on Sql Server Management Studio, it works great.
However, when integrated with my .net portion of the code, it keeps assigning every candidate the same percentage of 100%.
I would really appreciate your expertise on this.
Thanks a in advance for your assistance.
Protected Sub DataList1_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataListItemEventArgs) Handles DataList1.ItemDataBound
If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Then
Dim questionid As Integer
questionid = CInt(CType(e.Item.FindControl("Label3"), Label).Text)
Dim cnn As New SqlConnection(ConfigurationManager.ConnectionStrings("BallotsConnectionString").ConnectionString)
Dim cmd As New SqlCommand("select CandidateId, CASE WHEN CurrentOfficeHolder='Incumbent' THEN CandidateName + ' ('+ CurrentOfficeHolder + ')' ELSE CandidateName END As CandidateName from Candidates where PositionId=@qid", cnn)
Dim p1 As New SqlParameter("@qid", questionid)
cmd.Parameters.Add(p1)
Dim da As New SqlDataAdapter
da.SelectCommand = cmd
Dim ds As New DataSet
da.Fill(ds, "choices")
cnn.Open()
For Each row As DataRow In ds.Tables("choices").Rows
Dim cmdAns As New SqlCommand("select DISTINCT " & _
"count( IsNull(er.candidateId,0)) OVER (Partition by o.orgName, p.Position, c.candidateName,p.PositionId ) " & _
"as VoteCount, " & _
"CAST(count( IsNull(er.candidateId,0)) OVER (Partition by o.orgName, p.Position, c.candidateName,p.PositionId ) *1./count( IsNull(er.candidateId,0)) OVER (Partition by p.Position)*100 as decimal(6,2)) as Percentage " & _
"from Organizations o inner join Positions p on o.OrgID = p.OrgID inner join Candidates c on p.positionId = c.positionId " & _
"inner join ElectionResults er on c.candidateId = er.candidateId " & _
"WHERE c.candidateid = @cid", cnn)
Dim pCid As New SqlParameter("@cid", row("candidateid"))
cmdAns.Parameters.Add(pCid)
Dim dr = cmdAns.ExecuteReader()
If dr.HasRows = True Then
While dr.Read
Dim count As Integer = dr(0)
Dim pct As String = dr(1)
row("CandidateName") = row("CandidateName") & " - " & count & "(" & pct & "%)"
End While
End If
dr.Close()
Next
cnn.Close()
Dim list As BulletedList = e.Item.FindControl("BulletedList1")
list.DataSource = ds
list.DataTextField = "CandidateName"
list.DataBind()
End If
End Sub
|
|
|
|
 |
That's because your not calculating anything or the percentage is wrong in the database. I don't see how you can store the percentage in the database because it's always changing.
You need to get the total count of all votes and divide each candidates total votes by it
http://www.basic-mathematics.com/formula-for-percentage.html[^]
While dr.Read
Dim count As Integer = dr(0)
Dim pct As String = dr(1)
// calculate percentage here (count / totalCount * 100) so 500/1000*100 = 50%
row("CandidateName") = row("CandidateName") & " - " & count & "(" & pct & "%)"
End While
|
|
|
|
 |