|
|
|
|
|
im trying to create a class and thrugh the context call im calling this procedure in to this class..and creating the instance of that class im calling all these methods on controller class..
|
|
|
|
|
|
I've been learning the MS Chart Control. I'm building an asp.net app that will allow our users to design and save charts and have been gradually working my way through the all of the chart elements and properties.
I serialize the chart to an XML file.
Chrt.Serializer.IsResetWhenLoading = False
Chrt.Serializer.Content = SerializationContents.All
Currently I'm stuck on the MapAreas collection. I can create custom MapAreas and have noticed that the MapArea.Coordinates and MapArea.Name properties are not persisted to the XML file when saved using:
Chrt.Serializer.Content = SerializationContents.All
Chrt.Serializer.Save(strPrpPath)
I've searched the net and can't find any posts of this. It seems all MapArea properties except Coordinates and Name are serializable. I'd like to know if these properties are serializable and if so, how to get the Coordinates and Name properties to persist.
|
|
|
|
|
If I have to many pages what method shall I use to control routing to make it reusable one method for each and every url.??
|
|
|
|
|
Personally I use my own url-rewriting routine - like many things, I find writing my own solution easier than trying to get to grips with the out of the box solutions.
If you have "too many url's" I presume your site is database-driven, so store a "friendly url" along with each page's data in the database. The you can capture the incoming request in the Application_BeginRequest method within a global_asax class using Request.Url.ToString and parse that to retrieve the friendly URL from the database then a simple Context.RewritePath([Friendly URL]) does the trick.
[edit] - sorry! That's back to front! You capture the users "friendly url" request and parse that to retrieve the "real" address and then Context.RewritePath([actual URL])
|
|
|
|
|
I would use AppStart/RouteConfig.cs. I assume that you are using MVC.
The following article might give you more ideas.
Routing Basics in ASP.NET MVC[^]
|
|
|
|
|
Can someone please give me a helping hand on this?
We currently have an app that displays name of candidates running for various positions from President, Vice President, Secretary, Treasurer.
The one thing I have been unable to add to it is the radio option for Write In candidate.
The reason the code we use here doesn't allow that option is because it is completely database driven.
The code is too complex and might be confusing to post here but I will be happy to post it if any brave heart wishes to take a look at it.
I was wondering if anyone would be willing to assist with something more manageable.
The code should have the ability to display those positions including write in candidate and hopefully, I will be able to spit a report showing the results in raw number with percentage in parenthesis.
Again, the current report we have does all of these things.
Only thing missing is the ability to display write in candidate information.
Thanks a lot in advance.
|
|
|
|
|
What are you asking us?
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
I have a code that displays candidates' positions and names in radio buttons for elections.
For instance:
For President:
Canditate 1
Candidate 2
Candidate 3
Same with vice president, secretary, treasurer, etc
These are generated dynamically from the database. That's how it was originally designed.
What we would like to add is another option on the radio button called Write In candidate.
This way, if voters don't like any of the candidates listed for a particular position, they can check the Write In radio option and write in the candidate of their choice.
Because these radio buttons are dynamically generated, it has made it extremely difficult to add the Write In option.
My question is whether anyone can help with a more manageable code that includes Write In candidate radio option.
If my code is needed, I can post them here but I will be the first to admit that it is messy and confusing.
Hope this clarifies this and thanks.
|
|
|
|
|
samflex wrote: My question is whether anyone can help with a more manageable code that includes Write In candidate radio option. Yes. There are at least 10,000 of us that can and you'll get 10,000 different options.
Where are you stuck?
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
<asp:RadioButtonList ID="MyRadioList" runat="server" AppendDataBoundItems="true">
<asp:ListItem Value="" Text="Other" />
</asp:RadioButtonList>
|
|
|
|
|
Thank you for your response.
It looks like I am not doing a good job of explaining the problem - sorry.
In our app, we are dynamically generating from the database the candidates names via radio button controls.
For instance, there is a table called Positions.
This table defines what position a candidate is running for.
For example, President, vice president, treasurer, etc.
On this same table is a field called choiceType.
This fieldname represents what choice a voter is presented with.
In our case, the choice is S for single choice or Radio button choice.
If there are 5 people running for president, on the db, each candidate would have the position of President and choiceType of S or Radio button as shown simply below:
Position choiceType
President S
On the markup
Five candidate names would be listed and radio button besides each name so user can check his/her favorite candidate.
So, my issue is that because these are dynamically generated from the db, though it gives us the chance to list another candidate called the Write In Candidate for each position that needs it, the issue is that when a user clicks Write In Candidate, we would like to make a textbox appear which allows the voter to write the candidate of his or her choice.
I think the reason I am having problem with this is because the original coder used DataList to display the candidates information and I can't figure out how to manipulate the code to display a textbox control when a user clicks on the Write In Candidate radio button.
Hope this is clearer.
Thanks again.
modified 24-Apr-16 19:37pm.
|
|
|
|
|
<asp:RadioButtonList ID="MyRadioList" runat="server" AppendDataBoundItems="true">
<asp:ListItem Value="-" Text="Other" />
</asp:RadioButtonList>
<asp:TextBox ID="txtOther" runat="server" />
<script type="text/javascript">
var txtOther = $("#<%=txtOther.ClientID %>");
txtOther.hide();
$(document).ready(function () {
$("input[type='radio'][name='MyRadioList'][value='-']").click(function () {
txtOther.show();
});
$("input[type='radio'][name='MyRadioList'][value!='-']").click(function () {
txtOther.hide();
});
});
</script>
|
|
|
|
|
Is there a way to upload screenshot here?
That's the best way to explain what is going on.
First, the textbox is supposed to display only on the Presidential section.
Instead, it displays on ALL positions.
I don't know if this is happening because we used DataList to display the positions.
Second, I just keep getting the following error:
Quote: Compiler Error Message: BC30451: 'writeIn' is not declared. It may be inaccessible due to its protection level.
and is pointing to this line:
var txtWriteIn = $("#<%=writeIn.ClientID %>");
Here is the code I am using after integrating your code:
<asp:RadioButtonList ID="RadioButtonList1" runat="server" AppendDataBoundItems="true" align="center" style="width:20px;height:20px;zoom:120%; white-space:nowrap;">
</asp:RadioButtonList></div>
<asp:TextBox ID="writeIn" runat="server"></asp:TextBox>
<script type="text/javascript">
var txtWriteIn = $("#<%=writeIn.ClientID %>");
txtWriteIn.hide();
$(document).ready(function () {
$("input[type='radio'][name='RadioButtonList1'][value='27']").click(function () {
txtWriteIn.show();
});
$("input[type='radio'][name='RadioButtonList1'][value!='27']").click(function () {
txtWriteIn.hide();
});
});
</script>
Thanks again for your help.
|
|
|
|
|
You shouldn't be getting that error, check the designer.cs file for the aspx page and see how writeIn is defined, it should be "protected". If it's not try amending it directly in the cs file, or deleting the control then re-adding it.
|
|
|
|
|
I don't have designer.cs because I am using website not web application.
It is wither .aspx or .aspx.vb and I don't have writeIn defined anywhere on codebehind.
This error is on markup specifically, the on the js file.
|
|
|
|
|
Not sure how you'd do this with a website I'm afraid, websites are seriously old technology you shouldn't be using.
|
|
|
|
|
samflex wrote: we used DataList to display the positions
So writeIn is defined within the ItemTemplate of a DataList ?
In that case, there won't be a field in the code-behind to represent it, because there could be any number of instances of the control.
Your name='RadioButtonList1' also won't work, as there will be multiple instances of that control as well, and each one will have a different name.
Use the Visible property on the TextBox to hide it on irrelevant sections:
<TextBox ID="writeIn" runat="server"
Visible='<%# ShowWiteInOnSection(Eval("SectionID")) %>'
/>
Move the script outside of the list, and change it to something like:
$(document).ready(function () {
$("input:radio[name$='RadioButtonList1']").click(function(){
$(this).closest("table").parent().find("input[name$='writeIn']").toggle(this.value === '27');
});
});
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hi Richard,
Sorry I don't know what this below means:
visible='<%# ShowWiteInOnSection(Eval("SectionID")) %>'/>
As always, thanks much for your help sir.
|
|
|
|
|
It's a data-binding expression to set the Visible property of the TextBox depending on which section it's in. Replace the ShowWiteInOnSection(Eval("SectionID")) part with whatever code you need to determine whether the current item is the "presidential" section.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Sorry Richard, I spent so much time thinking about this and I am still confused as to what to do with
ShowWiteInOnSection .
For instance, I used this:
Protected Function GetMessageType(ByVal obj As Object) As String
Dim retVal As String = String.Empty
If obj IsNot Nothing AndAlso Not String.IsNullOrEmpty(obj.ToString()) Then
If obj.ToString() = "Charity - May 19 2016 " Then
retVal = "(Choose three members only)"
ElseIf obj.ToString() = "Board Election - Jun 5 2016 " Then
retVal = "(Choose only one candidate)"
ElseIf obj.ToString() = "Grievance Committee - May 12 2016 " Then
retVal = "(Choose two members only)"
End If
End If
Return retVal
End Function
to display what time of election is going on.
I know you said is a data binding to set visibility property of the Textbox depending on which section it is on but what I would like to accomplish if at all possible are two fold.
One, reflect the textbox only the section that has write In associated with the position and two, to display it only when the write in radio button is clicked.
And PositionID is what defines what position a candidate is competing for.
For instance, President is PositionID of 1; VP, 2; secretary 3; treasurer 4, etc.
These positions are on table called Positions
And then there is another table called Candidates that has candidateID, CandidateName, PositionId as FK to PositionID in Positions table.
So, this is where their names and their positions are joined.
I am stumped on how to code this function
ShowWiteInOnSection
|
|
|
|