Conditional Ajax.Actionlink in Telerik MVC Grid - asp.net-mvc-2

I have a Telerik ASP.NET MVC 2.0 Grid on a partialview . Here in this Grid there is column say " Status" having values as " active " & " inactive". I want to show a delete link in only those rows having Status Column Value as " Active ".
I am rendering this partialview on my main View having a ViewModel and my partialview is rendered using a descriptor .
I tried to use a ClientTemplate / Template but I am not able to put a condtional check before displaying a delete Link . How to achieve this using C# 4.0 ASP.NET4.0 code . I need some sample code . Its very urgent so your help is deeply appreciated .Thanks in advance for going through my problem

Basically, you will most likely need to wrap a conditional block inside the template definition which to determine whether the delete link should be output or not. Check the general templates definitions from the demos below and try this out to see how it goes:
http://demos.telerik.com/aspnet-mvc/razor/grid/templatesclientside
http://demos.telerik.com/aspnet-mvc/razor/grid/templatesserverside

Related

Microsoft Access Where Condition doesn't works in a subform

I built a form called: "clientlist":
I put a macro with where condition on click:
="IDclient_logindata=" & [Maschere]![clientlist]![IDclient]
this means that when I click on an id client, access will open another form with the respective IDclient. For example if I click on IDclient 3:
it open another form called "client_logindata" filter to IDclient_logindata 3.
Then, I built a navigational form:
using clientlist as subform. But when I click a record, any record, it open every time the client_logindata form with IDclient_logindata form = 1, why it doesn' works in a subform?
Design View of "Navigation Form":
Solved in this way: ="IDclient_logindata=" & [IDclient]
When using a subform, references to controls need to be relative to the main form where the subform is treated as a child control.
Consider adjusting the conditional to the following structure. Do note this is the English version:
="IDclient_logindata=" & Forms!myMainForm!mySubform.Form!mySubformControl
Or specifically tailored to yours (be sure to get exact spelling of all objects):
="IDclient_logindata=" & Forms!NavigationForm!clientlist.Form!IDclient
The OP has found a working solution which is much simpler than what follows. However, I was still interested to see if we could get something on the original model to work, and I'd guess that for users attempting to achieve the same thing using VBA rather than embedded macro's the following may still be useful.
The issue with the code in the original question is that the relevant form isn't open at the 'top level' but as a subform.
Form "normal" subforms, you'd refer to the control on the subform like this:
Forms!navform!clientlist.form!IDclient
Where navform is the name of the outer form. Or in the generalised case, like this:
Forms!Mainform!Subform1.Form!ControlName
However, the "Navigation Form" Wizard, when dragging subforms onto the Add New tab in Layout view doesn't name the subforms nicely. So I had to code it this way:
Forms![Navigation Form]!NavigationSubform.Form!ControlName
To my surprise this code continued to work when I added further forms within the Navigation Forms tabs and had controls named the same as one in question. I guess NavigationSubform automatically points to the tab with the current focus.

can we add form on activeadmin index page in rails 4

I'm rendering a partial in my index page
index do
.
.
div id: "overlay-select-period" do
render partial: "select_period", locals: { period: GoalCalender.legend_name_year, record: UsersGoalCalender.new }
end
.
.
end
and in this partial (.html.erb) under app/views/admin/users_goal_calendars, I'm having rails form helper form_for used
but when I run the app, it doesn't show the form tag on the view <form></form>
can anyone tell me whether we can add such form in activeadmin index page?
P.S. I've tried all other ways to add form (formtastic, simple form
and form_tag), and writing the form directly inside index do...end
(without rendering a partial) with no luck
I know this is an old question but I just discovered myself that AA somehow removes your form tag if batch actions are enabled.
This is because enabling batch actions wraps most of the page in a form and nested forms are not fun.
The mention something about it here if you scroll all the down: https://activeadmin.info/9-batch-actions.html
I tried disabling batch actions and the form tag comes back.

using Ajax , dropdownlist and page validation

using Ajax I filled Country, State and city dropdownlist. On land change state is filled and on state change city is filled properly.
Then when I try to save page I face this :Invalid postback or callback argument.
Searched and found out that this is due to change in ddl.selectedvalu change from initial value that is assigned by asp.net.
Now my question is that how can I let asp.net know that the new ddl value is valid?
Thank you.
In many pages it is recommended to use EnableEventValidation="false", but I prefer not to use it.
Some say that use Render and add value to notify .Net like this:
protected override void Render(System.Web.UI.HtmlTextWriter writer)
{
ClientScript.RegisterForEventValidation("ddlLanguages ", "English");
ClientScript.RegisterForEventValidation("ddlLanguages ", "Tamil");
ClientScript.RegisterForEventValidation("ddlLanguages ", "Hindi");
base.Render(writer);
}
but how to use it? where to put it?
for a better understanding I put here a sample code including Database script :
hesab20.com/DownLoad/Ajax.zip
in this sample Javascript is used to fill drop-down list . But when click button is executed and a post back occur, error happen.
Please help if you have experience with this.
Regards.
Please run the sample code and change the drop down lists , automatically the other is filled , meaning that list item text and value is completely changed. finally click button for a post back.
you must see that error happens:
Invalid postback or callback argument. Event validation ....
and note : EnableEventValidation="true"
Thanks

Line breaks in Zend Navigation Menu labels

I have a need to create a <br/> tag in the display label for a menu item generated using Zend_navigation, but don't seem to be able to find a way to do so.
My navigation item is defined in the XML config as:
<registermachine>
<label>Register your Slitter Rewinder</label>
<controller>service</controller>
<action>register</action>
<route>default</route>
</registermachine>
I want to force a tag in the output HTML between 'your' and 'slitter', such that it appears on two line as below:
Register your
Slitter Rewinder
However, I can't seem to do it. obviously using in the XML breaks parsing, and using html entities means that the lable is displayed as:
Register your <br/>Slitter Rewinder
Has anyone had experience of this that can offer advice?
Thanks in advance!
there is no such option built-in you have to use a partial
$partial = array('menu.phtml', 'default');
$this->navigation()->menu()->setPartial($partial);
echo $this->navigation()->menu()->render();
http://framework.zend.com/manual/en/zend.view.helpers.html#zend.view.helpers.initial.navigation.menu
you may also try a hack with <label><![CDATA[Menu label<br/>Second line]]></label>
I found a (hacky) solution:
I updated my navigation.xml to use {br} tokens wherever a <br/> tag is required, and then amended the base Zend/View/Helper/Navigation/Menu.php file as follows:
within htmlify function, changed
$this->view->escape($label)
to
str_replace("{br}", "<br/>", $label)
I could (and probably will) override the Zend Library Menu View Helper with my own at some point, but this at least cover it for now.
there is a escapeLabels boolean used to convert html tags and it's true by default.
You can set your navigation like this
$this->navigation()
->menu()
->escapeLabels(false)
->...
http://framework.zend.com/apidoc/2.0/classes/Zend.View.Helper.Navigation.Menu.html#escapeLabels

How to change the SSRS input parameters position in report

My SSRS report contains 7 input parameters and while running my report the size of the parameter(i.e. length) is increasing.
One of my input parameter(drop down list) may contain 100 characters so the size is not constant but i want to place all parameters in 2 lines or 3 lines(in a row).
Now it is coming 2 parameters per a row
Please advice
As gbn indicates, it's not easy to change the built in report server method of presenting the parameters. SSRS likes to always use two parameters per line, presented in the order that they exist in the report (which must match the dependency order.)
So the alternatives that gbn mentions: Both involve building a "Wrapper" application: some custom code or a web page that you can code however you like to get the parameters. Then you call Reporting Services, either in code or by passing a formatted URL with your parameters. The report can be displayed in a frame, new window, or passed as a stream to where ever you'd like.
The URL access is pretty straightforward and reliable: I often use it either by hand (to create "favorites") or in code.
http://msdn.microsoft.com/en-us/library/ms153586.aspx
For what you are looking for, these might be more work than you expected, but they will be extremely flexible for your interface.
Jamie
You can certainly do that, just right click on the RDL file in the solution explorer and select view code. then move the XML tags named <ReportParameter Name="Nameofparameter"> under <ReportParameters> according to where ever you want to position. And then save it. thats it!!!
The report parameters are kind of floating in values of 2, so if u have 4 report parameters then it will be shown as 1,2 next line 3,4. Best of luck!!
Use ASP.NET for the paramaters and a ReportViewer control or URL access to render. Seriously.
I don't know of any option to present parameters any way other then the default
I believe you could try using jQuery. The report parameters are rendered in a table under a div tag with class sqlrv-ParameterContainer. Write a jQuery or JavaScript function that will extract the full innerHTML from this div ie. the table content and then extract the table row information like the <label> or <input> tags.
Create your desired table structure with <table><tr><td>{extracted sections}</td><td></td></tr></table> or leave it to your requirement...
Then just append this new HTML structure in place of the original default structure.
In jQuery it will be like
$(".sqlrv-ParameterContainer").html();
which will give you the entire table structure that comes inside the parameter. Use XML parsing and get the input controls and all. Extract these controls as-is, don't change anything.
$(".sqlrv-ParameterContainer table").remove(); // it will remove the SSRS rendered default table from DOM
$(".sqlrv-ParameterContainer table").appendChild('<table><tr>......</tr></table>'); // Append your custom html structure here....
This was something that came to my mind quickly... I would suggest you test it... :)
This doesn't help the OP with SSRS-2008 but in case it helps others - Microsoft have improved this in SSRS 2016 - parameters can now be easily managed via the GUI in Report Builder / Visual studio:
https://www.intertech.com/ssrs-parameters-2016-update/