Highlighting the current Step in a multi step form page - asp.net

i am using a simple form page with 4 steps in it i am not using any wizard control for this i want to highlight the current step what i have to do for achieving this functionality.

if (WhateverPanel.Visible == true) {
StepLabel.BackColor = System.Drawing.Color.WhateverYouWant;
}
Or for labels it might be
StepLabel.Styles.BackColor = ...
I have to get to work or I'd check. Regardless, put that in the Page_Load and you should be gravy.

Related

Meteor - Binding to element on initial template render throws error

I am using Meteor, FlowRouter, and Parsley for validation. When I reload the app and enter into the page with the form, I get this error and parsley is not working on the form:
You must bind Parsley on an existing element.
If I leave the page and come back, it works fine. I have the following code initializing the binding:
Template.report.onRendered ->
report = Reports.findOne(_id: FlowRouter.getParam('reportId'))
if report.status == 'finalized'
Session.set('showDistributeReport', true)
else
Session.set('showDistributeReport', false)
$('#status-js').val(report.status)
$('#report-form-js').parsley()
I have been using Parsley and haven't seen this problem on other pages. Any help would be greatly appreciate.
I figured out a fix but I'm not sure why I had to do this. If anyone has any input that would be great. I had to take the portion where I set the session variable and move it to the onCreated method. This is the code I have now.
Template.report.onCreated ->
report = Reports.findOne(_id: FlowRouter.getParam('reportId'))
if report.status == 'finalized'
Session.set('showDistributeReport', true)
else
Session.set('showDistributeReport', false)
Template.report.onRendered ->
report = Reports.findOne(_id: FlowRouter.getParam('reportId'))
$('#status-js').val(report.status)
$('#report-form-js').parsley()

Delete row button in alv grid in sap

i am using function "REUSE_ALV_GRID_DISPLAY" in order to display a grid. My problem is that not all the buttons in alv toolbar are displayed. For example, i can not see the "delete row" button.
This is my call:
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
IT_FIELDCAT = fieldcatalog
TABLES
t_outtab = lt_files_records_final
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
.
Can you please help?
IF you need the full editor functionality (including cell editors), you will have to move away from the (obsolete and unsupported) function module to the class CL_GUI_ALV_GRID. See the documentation here.
If you only need a delete button, it might be easier to add a custom button. Check the program SALV_DEMO_TABLE_FUNCTIONS for an example (and start using the ALV OM instead of the old function modules - much easier to code with).

Ask the user for number of file to upload -ASPX

I'm trying to build a website (I learning this whole subject now), and maybe the anwser is very simple.
I am devaloping in ASPX/C#, and I want that in form, there is a select field (<select>)
with option of number of files to upload, the max files to upload is 4.
I want that after I select the number of files, there will be some up;oad fields (in the number that I already chose).
My question is how can I do that? (maybe with javascript of AJAX ? I have no idea how)
Wish for help, Thanks.
I am not sure if this is what you are looking for, but give it a try
Try this:
http://jsfiddle.net/2bZwD/
`$('#select1').change(function(){
var count = $(this).val();
var uploadcount = 0;
$('.upload').each(function(){
if (count > uploadcount)
{
$(this).show('slow');
uploadcount++;
}
else
{
$(this).hide('slow');
}
});
});`
There will be two approach
1) Javascript : Using javascript you can read the max file number and add the Upload html tag on the document . As you are using ASPX , it will not work because when the form was build and viewstate was genetated these fields were not the part. If you will use ASP.NET MVC it will work and you easily using the jquery
2) If you want to use the ASP.NET webform you have to do the AutoPostback equals to true for the dropdown list and then read the value on the Selected Index change event on the server and file upload control on the server side. It has a drawback that it will require full post back. You can use the Updatepanel to do the partial post back and get the file controls in the page.

Scraping ASP.net website: Need to Page through a Gridview using Python Mechanize

I'm trying to scrape an asp.net page where I need to page through the items a list of items that are in a gridview control. I've never used asp.net but have been searching the Net for pointers but now I've hit a brick wall. The page links are of the form:
javascript:__doPostBack('ctl00$ctl00$ctl00$ContentPlaceHolderEverything$ContentPlaceHolderFullWidthContent$ContentPlaceHolderMain$gridViewItems','Page$2')
I'm currently trying to get this working using Mechanize in Python. I initially tried the following, assuming that the VIEWSTATE variables would be handled by mechanize.
br.form.set_all_readonly(False)
br['__EVENTTARGET'] = 'ctl00$ctl00$ctl00$ContentPlaceHolderEverything$ContentPlaceHolderFullWidthContent$ContentPlaceHolderMain$gridViewItems'
br['__EVENTARGUMENT'] = 'Page$2'
response = br.submit(name="ctl00$ctl00$ctl00$ContentPlaceHolderEverything$ContentPlaceHolderFullWidthContent$ContentPlaceHolderMain$itemLocator$btnItemSearch")
html = br.response().read()
Using a network monitor(Fiddler2), I noticed that two more variables were populated so I added these in too:
br.select_form(nr=0)
br.form.new_control('hidden','ctl00$ctl00$ctl00$ContentPlaceHolderEverything$ScriptManager1',attrs = dict(name='ctl00$ctl00$ctl00$ContentPlaceHolderEverything$ScriptManager1'))
br.form.new_control('hidden','hiddenInputToUpdateATBuffer_CommonToolkitScripts',attrs = dict(name='hiddenInputToUpdateATBuffer_CommonToolkitScripts'))
br.form.new_control('hidden','__ASYNCPOST',attrs = dict(name='__ASYNCPOST'))
br.form.set_all_readonly(False)
br['hiddenInputToUpdateATBuffer_CommonToolkitScripts'] = '1'
br['__ASYNCPOST'] = 'TRUE'
br['ctl00$ctl00$ctl00$ContentPlaceHolderEverything$ScriptManager1'] = 'ctl00$ctl00$ctl00$ContentPlaceHolderEverything$ContentPlaceHolderFullWidthContent$ContentPlaceHolderMain$SearchResultsUpdatePanel|ctl00$ctl00$ctl00$ContentPlaceHolderEverything$ContentPlaceHolderFullWidthContent$ContentPlaceHolderMain$gridViewItems'
br['__EVENTTARGET'] = 'ctl00$ctl00$ctl00$ContentPlaceHolderEverything$ContentPlaceHolderFullWidthContent$ContentPlaceHolderMain$gridViewItems'
br['__EVENTARGUMENT'] = 'Page$2'
response = br.submit(name="ctl00$ctl00$ctl00$ContentPlaceHolderEverything$ContentPlaceHolderFullWidthContent$ContentPlaceHolderMain$itemLocator$btnItemSearch")
html = br.response().read()
With both of these the html I get back is still for page 1 only.
I think there may be a couple of potential issues:
I'm not sure I'm doing the submit right. There are multiple submit buttons on the page so the one I'm searching for is the "search" button, which is what I previously used to get to the first page. I could see that being why the first page is displayed. If I use br.submit() without a name then it uses another submit control that takes you somewhere else.
When you click a page number in a browser, the gridview control updates without a page reload. As I'm not running Javascript, maybe I can't get that but I would at least expect to be able to get back the data from the POST and parse that.
Any help would be much appreciated!
Managed to to it by building an xmlhttprequest per the answer here:
Using Python and Mechanize to submit form data and authenticate

2 Mutually exclusive RadioButton "Lists"

I think this has to be THE most frustrating thing I've ever done in web forms. Yet one would think it would be the easiest of all things in the world to do. That is this:
I need 2 separate lists of radiobuttons on my .aspx page. One set allows a customer to select an option. The other set does also but for a different purpose. But only one set can have a selected radiobutton.
Ok I've tried this using 2 asp.net Radiobuttonlists controls on the same page. Got around the nasty bug with GroupName (asp.net assigns the control's uniqueID which prevents the groupname from ever working because now, 2 radiobuttonlists can't have the same groupname for all their radiobuttons because each radiobuttonlist has a different uniqueID thus the bug assigns the unique ID as the name attribute when the buttons are rendered. since the name sets are different, they are not mutually exclusive). Anyway, so I created that custom RadioButtonListcontrol and fixed that groupname problem.
But when ended up happening is when I went to put 2 instances of my new custom radiobuttonlist control on my .aspx page, all was swell until I noticed that every time I checked for radiobuttonlist1.SelectedValue or radiobuttonlist2.SelectedValue (did not matter which I was checking) the value always spit back string.empty and i was not able to figure out why (see http://forums.asp.net/t/1401117.aspx).
Ok onto the third try tonight and into the break of dawn (no sleep). I tried to instead just scrap trying to use 2 custom radiobuttonlists altogether because of that string.empty issue and try to spit out 2 sets of radiobuttonlists via using 2 asp.net repeaters and a standard input HTML tag inside. Got that working. Ok but the 2 lists still are not mutually exclusive. I can select a value in the first set of radiobuttons from repeater1 and same goes for repeater2. I cannot for the life of me get the "sets" to be mutually exclusive sets of radiobuttons.
As you have two groups of radio buttons that you want to function as one group of radio buttons, the solution is simple: Make it one group of radio buttons.
The only problem you have then is that the value that you get has the same name from both lists, but that can be solved by adding a prefix to the values so that you easily identify from which list the option comes.
Update: based on the new info posted as an answer. The option I proposed on my original answer corresponds to the 3. You really must consider the following:
Html radio buttons have only 1
built-in mechanism to handle the
exclusivity, which is the name.
You are explicitly requesting a no js solution, so given the above you must manipulate the Ids to achieve it. If you weren't blocking this option I am sure someone would come up with some nice jquery or js library that already supports it.
The option 3 is clearly the less invasive, as you are not forced to affect the actual data, and are not affected by future updates to it.
It's not that much code, just something extra on the List indexes, and some simple thing as:
int? list1Value = null;
int? list2Value = null;
var value = Request.Form["somegroup"];
if (value.StartsWith("List1"))
list1Value = int.Parse(value.Substring(5));
else
list2Value = int.Parse(value.Substring(5));//Assuming List2 as prefix
Original:
I saw your other question, and you just need to use the same group name. Make sure you have different values for all items regardless of the list they come from. A way to achieve this is adding something to the values, like: <%# "List1-" + Eval("ID") %> and modifying the code that reads your Request.Form["yourgroupname"].
I think you should just use RadioButtons instead of RadioButtonLists.
Here's an article that presents a solution to resolve the radiobutton naming bug.
Though this post is dated 1 year ago already, I just read it because I face the same problem.
Currently I have 1 solution using jQuery:
Client side script (you must also include jQuery)
function SetRadio(rb) {
$('input:checked').attr('checked', false);
rb.checked = true;
}
For every radiobutton (which is a listitem in a radiobuttonlist) I add the following on the serverside:
li.Attributes.Add("onclick", "javascript:SetRadio(this)");
For me this works in both IE and Firefox, with 3 radiobuttonlists, without using groupnames.
You can check each radiobuttonlist for a selecteditem/value, or you can extend the SetRadio function so it stores the selected value in a hidden field.
Regards,
M

Resources