Portal Engine Questions on portal engine and web parts.
Version 7.x > Portal Engine > Opening Blizform in visual studio View modes: 
User avatar
Member
Member
dinethnipuna-gmail - 11/24/2013 10:02:02 PM
   
Opening Blizform in visual studio
Hi,
I have created a blizform in kentico CMS. Now I want to do implement some custom code on that form. So I have tried to open it on Visual studio under CMSModules->Blizforms, but I couldn't see the form.
Can someone please help me.
Thanks.

User avatar
Certified Developer 10
Certified Developer 10
josha-bpstudios - 11/24/2013 10:48:09 PM
   
RE:Opening Blizform in visual studio
The bizform that you created is a series of form controls that end up saving data to the database. You won't have a physical file for the actual form, just the controls that make up the form. If you want to do custom saving, you have to create your own form controls or customize the kentico built in controls. The developers guide will show you an example.

User avatar
Member
Member
dinethnipuna-gmail - 11/24/2013 11:35:24 PM
   
RE:Opening Blizform in visual studio
Hi Josha,
I want to create a form with a drop down and when the user select the values I want o display different prices according to the selection. Those prices will come form custom table.
Can you please tell me how to do this.
Thank you very much.

User avatar
Kentico Support
Kentico Support
kentico_filipl - 11/24/2013 11:52:33 PM
   
RE:Opening Blizform in visual studio
Hi,

In that case developing a custom form control as Joshua suggested would be a way to go. You can then use the newly created form control for one of the form fields.

More information can be found in Developer's Guide - Developing form controls.

Best regards,
Filip Ligac

User avatar
Certified Developer 10
Certified Developer 10
josha-bpstudios - 11/25/2013 11:13:37 AM
   
RE:Opening Blizform in visual studio
Another option could be to go to your document type, assuming that you have created the custom table with the prices and items, and use a uniselector control to point to your custom table object and return the price column. The only thing I am not sure about is if you can access a custom table object in the uniselector. Is this a possible option?

User avatar
Member
Member
dinethnipuna-gmail - 11/26/2013 2:58:26 AM
   
RE:Opening Blizform in visual studio
Hi Filip,
Thank you for your mail. Could you please tell me how can I display
Relevant values on a text box according to the he drop down list.
Eg- I can develop a form control for drop down list that is reading data from custom table.
So my next requirement is to display values in a text box according to the drop down list selection.
Custom list - exam , price
Exam column links to drop down list, when user select drop down item I want to display
Relevant price on a text box.
Could you please explain this
Thank you very much

User avatar
Kentico Support
Kentico Support
kentico_filipl - 11/29/2013 2:09:47 AM
   
RE:Opening Blizform in visual studio
Hi,

I think that the example in Developer's Guide shows you nicely how you can work with built-in controls when developing a custom form control.

So if you need to display a price in a TextBox according to a drop-down selection, you can use a code like this:
if (dropdown.SelectedValue == "my product")
{
myTextBox.Text = myProduct.price;
}
...

As for getting data from custom tables, there are API examples in Developer's Guide - Managing custom table data.

Best regards,
Filip Ligac

User avatar
Member
Member
dinethnipuna-gmail - 12/2/2013 12:43:30 AM
   
RE:Opening Blizform in visual studio
Hi Filip,

I have done this as you mentioned. Please check the following code. Now dropdown picking up the required values from custom table. The issue is when the dropdown selection changed its not fires , I have put auto post back true . Also On "DropDownList1_SelectedIndexChanged" I want to get the selected item and get the relevant exam fee for selected item. Can you please tell me how can I put a where condition on GetItems function with selected item.
<asp:DropDownList ID="DropDownList1" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged"   runat="server" AutoPostBack="True"></asp:DropDownList>

<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>


if (DropDownList1.Items.Count == 0)
{
// Create new Custom table item provider

CMS.SiteProvider.CustomTableItemProvider customTableProvider = new CMS.SiteProvider.CustomTableItemProvider(CMSContext.CurrentUser);

string customTableClassName = "customtable.ExamFees";

// Check if Custom table 'customtable.ExamFees' exists

CMS.SettingsProvider.DataClassInfo customTable = CMS.SettingsProvider.DataClassInfoProvider.GetDataClass(customTableClassName);

if (customTable != null)
{
DataSet dataSet = customTableProvider.GetItems("customtable.ExamFees", null, null);

int count = dataSet.Tables[0].Rows.Count;

if (!CMS.GlobalHelper.DataHelper.DataSourceIsEmpty(dataSet))
{
for (int i = 0; i < count; i++)
{

DropDownList1.Items.Add(new ListItem(dataSet.Tables[0].Rows["Exam"].ToString()));
}

}


}
}
}

protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
string v = DropDownList1.SelectedItem.ToString();
TextBox1.Text = v;
}

User avatar
Certified Developer 10
Certified Developer 10
josha-bpstudios - 12/3/2013 8:36:28 AM
   
RE:Opening Blizform in visual studio
You could try to wrap your control in an update panel

<asp:UpdatePanel runat="server" ID="pnlUpdate"><ContentTemplate>

//Your ascx control code goes here

</ContentTemplate></asp:UpdatePanel>

User avatar
Member
Member
dinethnipuna-gmail - 12/3/2013 8:50:46 PM
   
RE:Opening Blizform in visual studio
HI Josha,
Thank you fro your reply.
Still No luck.

Thanks.

User avatar
Kentico Support
Kentico Support
kentico_filipl - 12/9/2013 7:28:23 AM
   
RE:Opening Blizform in visual studio
Hi,

You can create a WHERE condition like this:
string selectedItem = DropDownList1.SelectedItem.ToString();

...

string whereCondition = "Exam LIKE '" + selectedItem + "'";

and then use it in GetItems() method like this:
DataSet dataSet = customTableProvider.GetItems("customtable.ExamFees", whereCondition, null);

Best regards,
Filip Ligac