Changing BizForm properties Kentico - c#

I am currently trying to have a bizform as part of my transformation as:
<cms:BizForm runat="server" ID="BizForm" FormName="YourBizFormCodeName" EnableViewState="false" FormDisplayText="Form submitted"/>
In the DocumentType/PageType I have a field that allows the user to enter whatever they want to display once the form has been submitted, so in theory I need to go about and change FormDisplayText to what has been provided.
I have tried using Eval("SubmitText") inside FormDisplayText, but it doesn't work.
Does anyone have a solution for this?
Thank you

Following code works fine for me (Kentico v8.1):
<cms:BizForm runat="server" ID="BizForm" FormName="test" EnableViewState="false"
FormDisplayText='<%# CMS.MacroEngine.MacroContext.CurrentResolver.ResolveMacros("{%CurrentDocument.SubmitText#%}") %>' />

Related

How do I display an image within the HiddenField asp.NET field?

Note: I'm just an lowly intern here, so be nice :) I've spent some time researching before asking but didn't find the answer I'm looking for.
Suppose I have a line in my .aspx file like so:
<asp:HiddenField runat="server" ID="hiddenfield" Value=??? >
What should I put for the value if I would like this hidden field to display a .png image when shown?
Sorry I can't give much more detail, I don't want to violate my company's policies. If you need any more information, let me know and I'll try to give an example.
If you want to display an image, you should use the Image control.
If you want to hide it, wrap it in a div and set the visibility to hidden. For example:
<div id="divHidden" style="visibility: hidden">
<asp:Image runat="server" AlternateText="this is an image" ImageUrl="/img/myimage.gif"/>
</div>
May be you can save image path only in hidden field using this.
<asp:HiddenField runat="server" ID="hiddenfield" Value="/img/myimage.png" >
And later retrieve that using javscript document.getElementById("hiddenfield").value , and set that path to actual img element if needed.
You probably want to use:
<asp:Image ID="myImage" ImageUrl="myimage.png" Visible="false" AlternateText="foo" />
And when you need to show it from your codeBehind:
myImage.Visible=true;

RadSpell display redlines

I have a multiline checkbox. I want to use RadSpell.
But everytime I insert text on the textbox it doesn't display red lines.
How can i do this?
here is my code.
<telerik:RadTextBox ID="textbox1" runat="server" TextMode="MultiLine" Rows="4"
Columns="51" Width="401px" Font-Size="10" Font-Names="Calibri" />
<telerik:radspell id="RadSpell1" runat="server" DictionaryLanguage="English"
controltocheck="textbox1" spellcheckprovider="PhoneticProvider"
supportedlanguages="en-US,English" ButtonType="None"/>
NOTE: No buttons needed.
I just want to show all the words that are misspelled.
That's a browser feature - inline spellchecking. All modern browsers have it. Well, IE doesn't, but why should we call it modern? ;-)
What RadSpell can do for you is a popup with suggestions and information.
EDIT: Forgot to mention you can trigger RadSpell's check programmatically: http://www.telerik.com/help/aspnet-ajax/spell-client-side-api.html. Look for the startSpellCheck() method. For example in the onblur event.

use Javascript or C# to validate a webform

Would like to validate more than one control on one button click. I would like something to validate whether a textbox has contents if a checkbox is checked or not but the checkbox doesn't necessarily have to be checked and in that case I don't want to check the textbox. I tried validation group but each button needs to control the different groups and i need this all to be under one button.
I'm open to ideas of how to do this c#,javascript...etc. Heres some code: Button3 is the save which validates whether checkbox 1 is checked and if so textbox10 cant be empty. I have about four other instances of this but are independent of each other.
<asp:Button ID="Button3" runat="server" Height="24px"
Text="Save" Visible="False" Width="67px" Font-Bold="True"
causesvalidation="true"
validationgroup="required"
runat="Server" />
<asp:CheckBox ID="CheckBox1" runat="server"
oncheckedchanged="CheckBox1_CheckedChanged" Text=" Breach Letter Sent"
ValidationGroup="required" AutoPostBack="True" Enabled="False" />
You want to use the CustomValidator control which can validate both on the server and the client. There is an example in the docs here - http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.customvalidator.aspx
I would never do form validation in JavaScript. Believe it or not, but some people actually turn off JavaScript! Use validators to validate the field content. Of course this means a round trip to the server in most cases, but you get reliable and well integrated validation.
you can use validation with Ajax (in Ajax postback occures but you will not sense)

Tie a custom savebutton to itemtemplate textbox

using Visual.Web.Developer.2010.Express;
using SQL.Server.Management.Studio.2008.R2;
using Northwind;
N00b here,
Trying to customize a asp.net gridview, and I'm stuck at this part...
In the ItemTemplate, I've got a text-box that has a class applied to it where on .keypress(Clientside JS), a asp:LinkButton appears next to it that's formatted like a Jquery UI icon. I'm stuck at this part. I know that I can "enable editing" for the gridview, but I want to make an edit button only appear on .keypress, which I’ve already achieved. The park I’m stuck at is trying to get the click of that asp:LinkButton to send an update command to the SQLserver to update that db entry accordingly . So far, I’ve got the textbox to be created dynamically for each db item in that column.
Is there a more practical way of doing this while achieving the same results? To be more specific, I'm not really looking for code, cause I'm trying to learn, but more for methods I should take a look at, or other tutorials that I missed on the web.
I would also appreciate some advice, thanks in advance: )
You can try using GridView_RowCommand event to fetch the Command event bubbled by Linkbutton.
You can use CommandName Property of the LinkButton and set it to Update.
<Columns>
<asp:TemplateField>
<EditItemTemplate>
<asp:linkbutton ID="Button1" text="TextBox1" runat="server" CommandName="Update" />
</EditItemTemplate>
</asp:TemplateField>
</Columns>

Insert and Edit Template show in Devexpress in aspxGridview

In Insert Mode I want to show one kind of Template and Edit Mode I want to show another Kind of Template in Devexpress Control in C#.NET
This can be implemented using the following approach:
You should define the EditFormTemplate so that it contains a different set of editors for the Insert and Edit functionality. Handle the HtmlRowCreated event to hide non required editors based on the ASPxGridView's IsNewRowEditing property value.
Check out the sample project on this issue which demonstrates the solution based on user controls and binding expressions. In this solution, the EditForm template contains two user controls with the Visible property bound to the ASPxGridView.IsNewRowEditing property:
[HTML]
<uc1:Edit id="Edit1" runat="server" Visible="<%# !Container.Grid.IsNewRowEditing %>"></uc1:Edit>
<uc2:Insert id="Insert1" runat="server" Visible="<%# Container.Grid.IsNewRowEditing %>"></uc2:Insert>
Btw, this issue might also be helpful. If you need more help, please contact the DevExpress support team here.
Use an ASP template field and individual item templates inside your gridview
<asp:TemplateField id="test" runat="server">
<ItemTemplate>
<ItemTemplate>
test
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox Text="test" runat="server"/>
</EditItemTemplate>
</ItemTemplate>
</asp:TemplateField>
I did the above from memory. Heres a link to an example i found as well:
http://programming.top54u.com/post/ASP-Net-GridView-Edit-ItemTemplate-Mode.aspx

Categories