I am trying to bind accordion control at run time. Header is loading,but the content is not loading. please correct me where i gone wrong

This is the code to load accordion Header

public DataTable EventName()
    string tablename = "Event";
    SqlCommand cmd = new SqlCommand();
    cmd.CommandType = CommandType.Text;
    cmd.CommandText = "Select EventName from EventNames order by EventName";
    return GetData(cmd, tablename).Tables[0];

In the page load event i write like this

if (!IsPostBack)
        dataacess da = new dataacess();          

        DataTable dt = da.EventName();
        Accordion1.DataSource = dt.DefaultView;


the aspx page design is like this

    <asp:Accordion runat="server" ID="Accordion1" SuppressHeaderPostbacks="true" HeaderCssClass="accordionHeader"
    HeaderSelectedCssClass="accordionHeaderSelected" ContentCssClass="accordionContent" Width="500"
        <asp:Label runat="server" ID="lblEventName" Text='<%#Eval("EventName") %>'> </asp:Label>
        <asp:HiddenField runat="server" ID="hidEventName" Value='<%#Eval("EventName") %>'>

            <asp:Repeater ID="Repeater1" runat="server">
                        <asp:Label runat="server" ID="litDate" Text='<%# DataBinder.Eval(Container.DataItem, "Description") %>'
                            Font-Size="Medium" ForeColor="Maroon" Font-Bold="True"></asp:Label><br />
                            <asp:Literal runat="server" ID="litDesc1" Text='<%# "Date: " + DataBinder.Eval(Container.DataItem, "EDate", "{0:dd/MMM/yyyy,dddd}") %>'></asp:Literal>
                        <br />
                        <asp:Literal runat="server" ID="litDesc2" Text='<%# DataBinder.Eval(Container.DataItem, "Description2") %>'></asp:Literal></p>
                    <hr />


Accordion OnItemDataBound event

protected void Accordion1_ItemDataBound(object sender, AjaxControlToolkit.AccordionItemEventArgs e)
    if (e.ItemType==AjaxControlToolkit.AccordionItemType.Content)
        Repeater Repeater1 = (Repeater)e.AccordionItem.FindControl("Repeater1");
        HiddenField hidEventName = (HiddenField)e.AccordionItem.FindControl("hidEventName");

        dataacess da = new dataacess();
        Repeater1.DataSource = da.EventHistory(pname, hidEventName.ToString());

I have the following code which is a popup window shown to the user:

<div id="popupContact">
    <a id="popupContactClose" title="Close Window">x</a>
    <h3>Add a New Message</h3>
    <div id="dvFirst" class="mainSecond">
        <div id="leftdiv3" class="leftdiv">Client: </div>
        <div id="rightdiv3" class="rightdiv" style="z-index: 100;"><asp:DropDownList ID="ddlCliNewMsg" AutoPostBack="false" ClientIDMode="Static" runat="server" CssClass="chosen-select" ></asp:DropDownList></div>
    <div id="dvSecond" class="mainSecond">
        <div id="leftdiv4" class="leftdiv">Location: </div>
        <div id="rightdiv4" class="rightdiv" style="z-index: 100;"><asp:DropDownList ID="ddlSitNewMsg" AutoPostBack="false" ClientIDMode="Static" runat="server" CssClass="chosen-select"></asp:DropDownList></div>
    <div id="dvSixth" class="mainSecond">
        <div id="leftdiv6" class="leftdiv">Specialty: </div>
        <div id="rightdiv6" class="rightdiv" style="z-index: 100;"><asp:DropDownList ID="ddlPraNewMsg" AutoPostBack="false" ClientIDMode="Static" runat="server" CssClass="chosen-select"></asp:DropDownList></div>
   <div id="dvThird" class="mainSecond">
        <div id="leftdiv5" class="leftdiv">Provider: </div>
        <div id="rightdiv5" class="rightdiv" style="z-index: 100;"><asp:DropDownList ID="ddlProNewMsg" AutoPostBack="false" ClientIDMode="Static" runat="server" CssClass="chosen-select"></asp:DropDownList></div>
    <div id="dvFourth" class="mainFirst">
        <div id="leftdiv1" class="leftdivspec"><sup style="color: #FF0000; font-weight: bold;">*</sup>Message: </div>
        <div id="rightdiv1" class="rightdivspec"><asp:TextBox ID="tbMessage" ClientIDMode="Static" runat="server" TextMode="MultiLine" Columns="30" Rows="5"></asp:TextBox></div>
    <div id="dvFifth" class="mainSecond">
        <div id="leftdiv2" class="leftdiv">Active?</div>
        <div id="rightdiv2" class="rightdiv"><asp:CheckBox ID="cbIsActive" ClientIDMode="Static" runat="server" /></div>
    <div style="width: 96%; text-align: right; padding: 2%;">
        <asp:UpdatePanel runat="server" ID="upSubmit" ClientIDMode="Static" UpdateMode="Conditional">
                <asp:Button ID="btnSubmit" runat="server" Text="Submit" CssClass="btnSubmit" ClientIDMode="Static" UseSubmitBehavior="false" OnClick="SubmitAdminMessage" />

The CSS:

    width: 95%;
    margin: auto;
    padding: 1%;
    height: 90px;
    border-bottom: 1px dotted #808080;
    width: 95%;
    margin: auto;
    padding: 1%;
    height: 30px;
    border-bottom: 1px dotted #808080;
    overflow: hidden;
    width: 35%;
    height: 30px;
    float: left;
    font-weight: bold;
    width: 65%;
    height: 30px;
    float: left;

Originally when the popup window loads, it is displayed like this:

enter image description here

Whenever I select something from the dropdownlist, it goes under the DIV below it:

enter image description here

How can I modify the CSS so that each DropDownList will appear outside of the container so it will display the options?

I have 2 UpdatePanel in an .aspx page, everything but the first postback works fine, it send me to th top of the page and ignores my last action (or reload the page).

The triggers are a checkboxlist and a radiobuttonlist the first is inside a UpdatePanel. I'm trying to understand why that first postback reload the page.

Update Panel 1.

<asp:UpdatePanel ID="updPainelCheckBox" runat="server" UpdateMode="Conditional">
                    <asp:AsyncPostBackTrigger ControlID="chkFeatures" EventName="SelectedIndexChanged" />
                    <asp:AsyncPostBackTrigger ControlID="rblTipo" EventName="SelectedIndexChanged" />
                                <asp:Label ID="lblPrecoTotal" runat="server" Text="Valor da consulta, R$ 00,00" Font-Bold="true" Font-Size="9"></asp:Label>                         

Upadte Panel 2.

<asp:UpdatePanel ID="updPainelRadioBox" runat="server" UpdateMode="Conditional">
        <fieldset style="border-style: dashed; border-width: thin;">
            <legend style="text-align: left; font-size: 12px;">Extras</legend>
            <div id="ftFeatures" class="chkBoxList" runat="server">
                <asp:CheckBoxList ID="chkFeatures" runat="server" RepeatColumns="3" 
                    RepeatDirection="Horizontal" Width="810px" RepeatLayout="Table" 
                    AutoPostBack="true" OnSelectedIndexChanged="chkFeatures_SelectedIndexChanged"
        <asp:AsyncPostBackTrigger ControlID="rblTipo" EventName="SelectedIndexChanged" />

The trigger outside a UpdatePanel.

<asp:RadioButtonList runat="server" ID="rblTipo" RepeatDirection="Horizontal" 
                AutoPostBack="true" onselectedindexchanged="rblTipo_SelectedIndexChanged"
                <asp:ListItem Text="CPF" Value="0"></asp:ListItem>
                <asp:ListItem Text="CNPJ" Value="1"></asp:ListItem>

Trigger events.

protected void chkFeatures_SelectedIndexChanged(object sender, EventArgs e)
    ValorFeature = 0;
    TBL_FEATURESControl FeaturesControl = new TBL_FEATURESControl();
    List<TBL_FEATURESFields> FeaturesInfo = FeaturesControl.GetByCLI_FEATURES(CodigoID, Sessao.Acesso.ID_CLIENTE);

    foreach (ListItem item in chkFeatures.Items)
        foreach (TBL_FEATURESFields ft in FeaturesInfo)
            if ((item.Selected) && (Convert.ToInt32(item.Value) == ft.ID_FEATURES))
                ValorFeature += ft.VALOR_BASE;
    lblPrecoTotal.Text = "Preço da consulta, R$" + Valor.ToString().Replace('.', ',');

protected void rblTipo_SelectedIndexChanged(object sender, EventArgs e)

Method that fills my checkboxlist.

public void getCheckBoxItems(string mFeatures)
    ValorFeature = 0;
    string[] listFeatures = mFeatures.Split('|');
    string[] itemFeature;

    TBL_FEATURESControl FeaturesControl = new TBL_FEATURESControl();
    List<TBL_FEATURESFields> FeaturesInfo = FeaturesControl.GetByCLI_FEATURES(CodigoID, Sessao.Acesso.ID_CLIENTE);
    Features.ENUM.Features featuresENUM = new Features.ENUM.Features();
    Enum temp = featuresENUM.getFeature(CodigoID, Convert.ToInt32(rblTipo.SelectedValue == "" ? "0" : rblTipo.SelectedValue));

    foreach (TBL_FEATURESFields ft in FeaturesInfo)
        if ((ft.ATIVO == true) && (ft.VALOR_BASE < 100) && (Enum.IsDefined(temp.GetType(), ft.ID_FEATURES)))
            ListItem item = new ListItem(specialCase(ft.ID_FEATURES, ft.LABEL), ft.ID_FEATURES.ToString());
            for (int i = 0; i < listFeatures.Length; i++)
                itemFeature = listFeatures[i].Split(':');
                if (itemFeature[0] == ft.ID_FEATURES.ToString())
                    item.Selected = itemFeature[1] == "0" ? false : true;
            if (item.Selected)
                ValorFeature += ft.VALOR_BASE;
    lblPrecoTotal.Text = "Preço da consulta, R$" + Valor.ToString().Replace('.', ',');

I have issue with the radio button is not displaying. This is when the I edit the applicant and it is not populated the radio button value from the server. The issue here I think it is at the UI as I am able to see all the values in from the controller.

<div class="radio-group">
    <div data-bind="source:applicantTypeItems" data-template="DoctoralLevelId"></div>
    <script id="DoctoralLevelId" type="text/x-kendo-template">
            <input type="radio" name="DoctoralLevelId" data-bind="attr:{value:value},     
                  checked:DoctoralLevelId" />
            <label data-bind="text:caption"></label>
$(document).ready(function () {
    var applicantVm =kendo.observable($.extend({
        updated: false,
        PersonId: self.personId,
        Id: self.selectedId,

        DoctoralLevelId: 1,
        name: "DoctoralLevelId",
        applicantTypeItems: [
            { caption: "Pre-doc", value: 1},
            { caption: "Post-doc", value: 2 },
        // call controller and update user input
        updateApplicant : function() {
            var self = this;
            var updateData ={
                PersonId: self.personId,
                Id: self.selectedId,  
                DoctoralLevelId: self.DoctoralLevelId,

                url: '@Url.Content("~/Applicant/UpdateNewPredoc")',
                data: JSON.stringify(updateData),
                contentType: "application/json, charset=utf-8",
                type: "POST",
                datatype: "json",

                error: function () {
                    toastr.error('Update failed!');
                success: function (value) {
                    window.console && console.log(self);
                    window.console && console.log(value);
                    toastr.success('Update succeed!');
                complete: function () {
                    window.console && console.log("completed");
    window.console && console.log(applicantVm);
    kendo.bind($("#applicant-info-view"), applicantVm);

I'm working on an ASP.Net application. For one part of this, I have particular models stored in their own folder:


I have a reference to my Models/Default/ folder in one of my CustomControls: using Project.Models.Default; However, when I try to make a reference in my CustomControl YearsOfService to my default Model of Years_Of_Service, Visual Studio (2013) is not picking up either my Years_Of_Service or Years_Of_Service_Data model with my Models/Default/ folder:


Anyone have any ideas why this is happening?

I am using visual studio 2008 and I want to display a SSRS report on web page using ReportViewer control. The report is not deployed on reporting server. Is it possible to display report using its physical path.

Thanks in advance.

I have myself a datetime variable of


and I want to convert that date to display as

7th Novemeber 2014

What format do I used? I have tried ToLongDateString but it misses the suffix of the day date.

I'm using VB.NET MVC 5.1 in VS2013 using Razor

siq.Price is a Decimal?

I'm trying to check if siq.Price has a value, and if so print it as a currency. I recieve this error when trying to access the .Value property for elements where true they returned true for .HasValue:

Nullable object must have a value.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: Nullable object must have a value.

I tried both of these lines of code, believing they should work without issue, yet recieved the error above:

@IIf(siq.Price.HasValue, siq.Price.Value, "N/A")
@IIf(siq.Price.HasValue, siq.Price.Value.ToString("C"), "N/A")

As soon as I remove the .Value from the TruePart then it started working:

@IIf(siq.Price.HasValue, siq.Price, "N/A")
@IIf(siq.Price.HasValue, String.Format("{0:C}", siq.Price), "N/A")

Can anyone explain why this is happening?! I'm rather perplexed.

NOTE: This piece of code works on it's own if the Price has a value, but not in the IIf():


I have Kendo Grid with MVC razor syntax and added custom button, when clicked on this it should download an attachment by calling a Javascript method.

        .HtmlAttributes(new { style = "width: 90%;" })
        .Columns(columns =>
            columns.Bound(p => p.CustomerId);
            columns.Template(@<text>@item.LastName  @item.FirstName</text>).ClientTemplate("#=LastName# #=FirstName#").Title("Name");
            columns.Bound(p => p.DOB);
            columns.Bound(p => p.HomeAddress);
            columns.Bound(p => p.HomeCity);
            columns.Command(command => command.Custom("Download Attachment").Click("DownloadFile"));             

<script type="text/javascript"> 
function DownloadFile(e) {
    console.log("Download file");
    //file download code here..

My javascript function is not being fired and when I see the ViewSource of the button the href is pointing to the same page

< a class="k-button k-button-icontext k-grid-Accounts" href="/Customers?CustomerId=1">< span>< /span >Download File< /a>

Do I need add any .JS file to make this work.. or am I missing anything.

Any help is highly appreciated.

The model:

public class oPage
    public int PageId { get; set; }
    public List<oContent> Contents { get; set; }

The oContent object have properties: Id and Text.

The view: (Razor)

@for (int i = 0; i <= Model.Agrees.Count; i++)
   @Html.TextAreaFor(m => Model.Agrees[i].Text)

I want to let to user to add another content from the client.

I found some solutions that I don't like:

  1. Write the html markup manually. I don't like it because maybe in one day the rendering's structure will change and my code will not word. (Like here:

  2. Get the structure from the server. I don't like this because.. well I'm always prefer not use the server unless I have to. (Like here: How to add items to MVC model in javascript?)

I'm looking for a better and smarter solution.

I am trying to create an UI for internal employees. I would like to perform select statements based on user input (id, value) and display the query, so the researcher can check the query as well as sample output, before using the info for further processes.

This is what I have in the code block:

var db = Database.Open("database");
switch (input)
case "1":
        Query2 = "select ... from table where value = @1;
case "2":
        Query2 = "select ... from table where value = @1;

var Query1 = "select ... from table where id = @0";
var Query2 = "select ... from table where value = @1";

In the html page, I call the var by


Question 1: Assume the user chooses 1 for id and 100 for value I see on the webpage:

"select ... from table where id = @0" and "select ... from table where value = @1"

instead of

"select ... from table where id = 1" and "select ... from table where value = 100"

What should I have done differently?

Question 2: db.query(SQL) does not like empty string or null value. What can I set SQL to before user chooses any input? I would not like to show anything on the webpage without selection - not even the default query.

Thanks for your help...

I've packaged up some library's that I wish to reuse in other projects, these implement the IOC principals and I use AutoFAQ for this.

Everything works when I created these library's in my original project - even after re-factoring into a new library my unit tests all complete successfully.

The problem comes when I add these library's to a test project to see if the Nugetpackage is working, I added my package and also AutoFAQ - I wired autoFAQ up to inject the dependency's that my package has - same as I did in the original project where these where created.

AutoFAQ plumbing / registering components

        var builder = new ContainerBuilder();

                                        .Where(t => t.Name.EndsWith("Service"))

                                        .Where(t => t.Name.EndsWith("Model"));

                                        .Where(t => t.Name.EndsWith("Model"))



        var container = builder.Build();

        DependencyResolver.SetResolver(new AutofacDependencyResolver(container));

When I attempt to run this I get the following error.

one of the constructors found with 'Autofac.Core.Activators.Reflection.DefaultConstructorFinder'      
on type 'Boxharry.Inquire.Services.DatabaseService' can be invoked with the available services and parameters:
Cannot resolve parameter 'Boxharry.Inquire.Models.InquireEntities entities' of constructor 
'Void .ctor(System.Collections.Generic.IList`1[Boxharry.Inquire.ViewModels.QuestionViewModel],      
boxharry.Inquire.Models.inquire_user_activity_link, Boxharry.Inquire.Models.InquireEntities)'.

Example of library use

    public HomeController(IDatabaseService databaseService)
        _databaseService = databaseService;

    // GET: /Home/
    public ActionResult Index()
        var test = _activityService.GetChildActivities(290);
        //other stuff

I'm unsure of how to proceed, I am thinking of toying with the AutoFAQ registers components to see if the way I have done it has to be changed.

If this does not work I may have to strip IOC out of my library's and not unit test them, this does not really appeal to me.

I am new to CakePHP, i am creating simple form to add/edit/delete post as it is explain on its official website, my issue, while adding post to database it is not saving data,it is creating blank entries to database

Here is Code for Postscontroller.php

    class PostsController extends AppController {
    public $helpers = array('Html', 'Form');
    public $components = array('Session');

    public function add() {
     if ($this->request->is('post')) {
        if ($this->Post->save($this->request->data)) {
            $this->Session->setFlash(__('Your post has been saved.'));

            return $this->redirect(array('action' => 'index'));
        $this->Session->setFlash(__('Unable to add your post.'));


Here is Code for Model Post.php :


class Post extends AppModel {

 public $validate = array(
    'title' => array(
        'rule' => 'notEmpty'
    'body' => array(
        'rule' => 'notEmpty'

Here is code for View add.ctp :

<h1>Add Post</h1>
echo $this->Form->create('post');
echo $this->Form->input('title');
echo $this->Form->input('body');
echo $this->Form->end('Save Post');

can anyone suggest me what is causing blank entries to database ?

We have seen many of the examples explaining how to call Web API from JavaScript and from code behind.

However, one thing we would like to ask that can we call Web API without Http in code behind like we do in JavaScript/JSON.

In JS we call it Like. var uri = 'api/products';

Is this possible ?

Thanks !


I'm trying to send some data from my android application to an aspx page using a HttpClient in android. I will be sending my username and password to be validated inside an aspx page. this is what I did on the android side:

//android side

httpclient = new DefaultHttpClient();
httppost = new HttpPost("");
nameValuePairs = new ArrayList<NameValuePair>(2);
nameValuePairs.add(new BasicNameValuePair("username",username.getText().toString().trim()));
nameValuePairs.add(new BasicNameValuePair("password",password.getText().toString().trim()));
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
Log.d("extraData", "running");
ResponseHandler<String> responseHandler = new BasicResponseHandler();
final String response = httpclient.execute(httppost, responseHandler);
System.out.println("Response : " + response); 

The reason I am doing this is because I have to check that the data I passed from android will be read by the aspx page code behind.

How can I use the character sent from Android to the Aspx Page?

This is what I did on the aspx page:

// .aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="LoginRemoteWeb.aspx.cs" Inherits="LoginRemoteWeb" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

<html xmlns="" >
<head runat="server">
    <title>Untitled Page</title>
    <form id="form1" runat="server">


and the code behind(the page load part):

//code behind

protected void Page_Load(object sender, EventArgs e) {

//Request.Form to be sent by values from android
int loop1;
coll = Request.Form;
String[] arr1 = coll.AllKeys;
for (loop1 = 0; loop1 < arr1.Length; loop1++)
Response.Write("Form: " + arr1[loop1] + "<br>");


Is what I'm doing correct? Will I be able to get the postdata using Request.Form from android? If it is, will it throw back the response I wrote back to Android?

I am going to write a web form via Visual Studio 2013 with Devexpress v14.1.

The web form is required to change the language with CheckedChanged event.

I have read some of the articles from Google, but it seems that it required to set all of the controls one by one.

For example, if there are 30 labels in my web page, it is necessary to add 30 lines:

Label1.Text = ...;

Label2.Text = ...;


Label30.Text = ...;

What is the best approach to make multi-language web page ?

Please help!!!

I had a requirement of reading a XML document from the server on which the application is running. I am able to do it by simply accessing a file by passing string url as the parameter.

XmlDocument doc = new XmlDocument();
doc.Load(fullPath);  //fullPath is a string. for e.x. c:\myfolder\myxml.xml

Now the requirement changes to access the file from a different server so for that I am simply modifying my fullPath as


But it fails to read the file. Is there some other way to access files placed on a different server.

P.S.: If I use the same URL and paste it in URL, I am able to access the file.

I have some configurable logic, but format is very dynamic, so I think best way how to write this is using .json format.

What is the best way to use this config similarly to Web.config? What I mean is:

  • .json file is read to memory every time it changes. I do not want to read and deserialize it for every request.
  • I also want some kind of global way to access this config (in memory). Maybe a static class?

I had to place one div to the right of a centered one, and now I have a problem with my textboxes. They are one seperate lines, not the same anymore.

This is what it looks like:

This is the code that I have:

            <!-- Logo -->
                <asp:Image ID="img_logo" runat="server" ImageAlign="Middle" Width="200px" Height="200px"/>

            <!-- Search Textboxes -->
            <div style="display: inline-block; margin-top: 1%">
                <asp:TextBox ID="tb_what" runat="server" CssClass="Textbox" style="margin-left: 1%"></asp:TextBox>
                <asp:TextBox ID="tb_where" runat="server" CssClass="Textbox"></asp:TextBox>

            <!-- Search Button -->
            <div style="display: inline-block; position: relative; width: 0; height: 0; vertical-align: top;">
                <div style="background: black; display: inline-block; position: absolute;">
                    <asp:ImageButton ID="btn_search" runat="server" style="margin-top: 1%" ImageUrl="" CssClass="Button" Width="40px" Height="40px"/>

            <!-- Login & Register -->
                <asp:LinkButton ID="lb_login" runat="server" Font-Names="Segoe UI" Font-Underline="false" style="margin-right: 1%">Login</asp:LinkButton>
                <asp:LinkButton ID="lb_registrer" runat="server" Font-Names="Segoe UI" Font-Underline="false">Registrer</asp:LinkButton>

I appreciate your help and time!

Best regards Marcus

I am experienced in and it's tools, i always use gridview to fill it with data from database, i usually edit it in .aspx code and rarely in .cs code but i am newbie to windows forms gridview, how it is different from's gridview. It doesn't have behind code, can it only be edited from wizard and properties etc or any other way ?

Can we customized the field templates in dynamic data according to the business logic,

for example we have a field, the calculation of which is dependent on another like say we have to calculate a weight of a metal depending of metal type, shape diameter and length.

So we will select metal type and shape from the drop down and provide shape and length in text box field and the weight will be calculated after inputting the above values.

So can we create a field template of weight type (computed field), the value of which will depend on selection of another control in dynamic data website.