|
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.
|
|
|
|
|
Ravindra Bisen wrote: if i run the VS2005 as administration then it is working fine. But i don't want to run VS as Administrator. You need to. For it to have access to all it needs, you need to do this.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
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)
row("CandidateName") = row("CandidateName") & " - " & count & "(" & pct & "%)"
End While
|
|
|
|
|
I don't see anything on the code I posted that suggests I am storing percentages on the database.
Besides, your solution produces the same result that my produced - assigns 100% to every candidate.
|
|
|
|
|
Maybe you should post your question in the database forum, sorry but there was so much code posted, I didn't see the SQL statement.
"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 "
|
|
|
|
|
My post doesn't need to be on the database forum.
You have *not* read it either.
If you did, you would notice that I indicated that the SQL portion of the code is *not* the problem because if I run just the SQL in SSMS, it works just fine.
Integrating it with my .net code is the problem.
That's why I posted it where I did.
|
|
|
|
|
I'm in So Cal and were having that heat wave here. Guess it's getting to my brain. 3 days of 100+ weather near the coast is taking it's toll on me.
All I can suggest it running it with the debugger and a watch to pct and see if the value changes. technically, the Dim pct should create a new version in the loop, but I've never used it like that myself. Perhaps declare it earlier and ReDim pct or just use the same pct if its a number.
|
|
|
|
|
I am very very new to ASP.NET and am wondering how to use paging in a Gridview, or the equivalent, with dynamic data. I have a GridView populated with data returned from a stored procedure. The first page of data results is correct but when I try to page to the next page of results it takes me to the first 10 records in the table I am querying, with out the where clause. What am I missing? I assume I need to create the results in a certain ADO object, or other ASP.NET object, that is read and set as a table or view but I do not know what to use. I just need to be pointed in the right direction.
Thanks
Grajek
|
|
|
|
|
|
am adding the link button in the code behind as a local or member variable and tried to subscribe to click or command event and it is not breaking there.
Like say my requirement is out of 10 rows in a grid i want to know which grid i clicked onto and the value of the clicked item.
|
|
|
|
|
Can you show us your code used to create the dynamic link buttons and bind them? It can help...
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
|
Make sure that you are dynamically adding the controls in the Page_Init() event and not in Page_Load. If you do it in Page_Load then when it posts back the event is registered but the control does not exist yet and will not fire.
Beyond that, we'd have to see your code to know for sure.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
use ajax for dynamic adding link button like for commenting purpose
|
|
|
|
|
Hi,
so I have a radiobuttonlist with 2 options: look for a certain object by 2 categories of criteria.
If I change the category, I have an autopostback to change the filterexpression of an objectdatasource and do a databind on the gridview connected to the objectdatasource. However, this results into an empty list. If the user clicks on a button after the postback that does another databind, the list is filled again. I'm hoping to remove the need for the second postback just so I can view my results.
I have 3 controlparameters:
1 parameter connected to the first criteria, 2 parameters connected to the second criteria. Both criteria work just fine, it's the transition from onee category to the other one that is giving me problems as described above.
I added an eventhandler to check if the filterexpression was changed when the filtering is happening, and it had indeed changed to the new filterexpression.
Can someone help me out here? Don't want to bother the visitor with 2 postbacks for making 1 choice.
|
|
|
|
|
Could you help me generate regular expression for the following patern:
some text_11111-1214
11111- should be only 6 char
1214-only 4 char
|
|
|
|
|
|
I need regular experession for this pattern: some more text_11111-1234
I need to check for _ following 6 number
- following 4 number
Dim rgx As New System.Text.RegularExpressions.Regex("^[a-zA-Z0-9](-\d{4}){1}") ????
If (rgx.IsMatch("some text_11111-1234")) = True .....
|
|
|
|
|
Hello,
Try ([a-zA-Z\s]*)_(\d{5,6})\-(\d{4}) it matched following
some more text_11111-1234
Prasad Khandekar_435363-9353
Another Pattern_777777-8783
Regards,
Prasad P. Khandekar
Knowledge exists, man only discovers it.
|
|
|
|
|
Great. its working... thanks
|
|
|
|
|
+5
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Thanks Ryan.
Prasad P. Khandekar
Knowledge exists, man only discovers it.
|
|
|
|