I want to display the report using Crystal Report, but Its displaying me the blank Page during execution. I want Crystal report Extension or some browser plugins to display Crystal Report.Please help me

<script type="text/javascript">
window.onload = function () {//var canvas = document.getElementById('0');

 canvg(document.getElementById('0'), 'Upload/Temp/4.svg')

 //load a svg snippet in the canvas with id = 'drawingArea'
  canvg(document.getElementById('drawingArea'), '<svg>...</svg>')
  canvg(document.getElementById('0'), 'file.svg', { 
  ignoreMouse: true, ignoreAnimation: true })
 //ignore mouse events and animation
  canvg(document.getElementById('0'), 'file.svg',           
  </script>

please tell me how to do svg image as background image for canvas i have used css and and canvg() for setting background image for canvas but its not coming please tell me how to set svg image as background for canvas thanq in advance

I also used anther code canvas { /background-image: url(http://www.w3school.com.cn/svg/rect4.svg);/ background-image:url(rect1.svg); } function load() { //Also, you could try this method

        //var can = document.getElementById("canvas1");
        //can.style.backgroundImage = "url(http://www.w3school.com.cn/svg/rect4.svg)";
        //can.style.backgroundImage = "url(rect1.svg)";
    }
</script>
 </head>
<body onload="load()">
    <canvas width="800" height="300" id="canvas1"></canvas>
</body>

i have also used css like this but for svg image its not coming

I'm trying to populate a dropdown/select tag in cakephp,fortunately I was able to populate it with the values coming from my database, however it displays ALL. How can I limit the population to a specific ID?

To make things clear here's what I want to achieve:

Apples:
form start
dropdown-contains only values that are associated with apples from the DB
button
form end

Currently here's how it looks like

Apples:
form start
dropdown-contains all fruits values from the DB
button
form end

Here's my current code tnx any help/suggestions is very much appreciated

Controller:

$fruits = $this->Model1->Model2->find('list', 
array('fields' => 
array('id', 
'fruit_name',
//'conditions' => array(''=>'')
)));
$this->set('fruitsList', $fruits);

View:

echo $this->Form->input('Model1.salad_fruits_id', 
array('type' => 'select', 
'options' => $fruitsList,
));

I am getting a response that is a xml output and i am saving it into an arraylist. Here parishList is my arraylist that i have declared as an arraylist.

Public void getParish(@ModelAttribute  ParishInputDataType parishCreatedRequest, String countryjqxWidget, Model model)      {
                model.addAttribute("parishCreatedRequest", new ObjectFactory().createParishInputDataType());
                parishCreatedRequest.setCountyname(countryjqxWidget);       
                ParishResponseType parishCreatedResponse = new ObjectFactory().createParishResponseType();
                parishCreatedResponse = (ParishResponseType) ((JAXBElement<?>) rdwebServiceTemplate.marshalSendAndReceive(parishCreatedRequest)).getValue();        
                model.addAttribute("parishCreatedResponse", parishCreatedResponse);
                parishList.clear();
                parishList.add( parishCreatedResponse );        
                model.addAttribute("parishList", parishList);
            }

and my xml output is like that

<?xml version="1.0"  standalone="no"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tns="http://www.lands.nsw.gov.au/webgov/referencedata" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<tns:getParishDataResponse>
<tns:status>0</tns:status>
<tns:charge>0</tns:charge>
<tns:noofrecords>50</tns:noofrecords>
<tns:parishes>
<tns:parish>
<tns:code>ARGYL007</tns:code>
<tns:name>BANNABY</tns:name>
</tns:parish>
<tns:parish>
<tns:code>ARGYL001</tns:code>
<tns:name>BAW BAW</tns:name>
</tns:parish>
<tns:parish>
<tns:code>ARGYL002</tns:code>
<tns:name>BILLYRAMBIJA</tns:name>
</tns:parish>
<tns:parish>
<tns:code>ARGYL003</tns:code>
<tns:name>BORO</tns:name>
</tns:parish>
<tns:parish>
<tns:code>ARGYL004</tns:code>
<tns:name>BOURKE</tns:name>
</tns:parish>
<tns:parish>
<tns:code>ARGYL005</tns:code>
<tns:name>BREADALBANE</tns:name>
</tns:parish>
<tns:parish>
<tns:code>ARGYL006</tns:code>
<tns:name>BUNGONIA</tns:name>
</tns:parish>
<tns:parish>
<tns:code>ARGYL008</tns:code>
<tns:name>COLLECTOR</tns:name>
</tns:parish>
<tns:parish>
<tns:code>ARGYL009</tns:code>
<tns:name>COOKBUNDOON</tns:name>
</tns:parish>
<tns:parish>
<tns:code>ARGYL010</tns:code>
<tns:name>COVAN</tns:name>
</tns:parish>
<tns:parish>
<tns:code>ARGYL011</tns:code>
<tns:name>CULLULLA</tns:name>
</tns:parish>
<tns:parish>
<tns:code>ARGYL012</tns:code>
<tns:name>CURRAWANG</tns:name>
</tns:parish>
<tns:parish>
<tns:code>ARGYL013</tns:code>
<tns:name>EDEN FOREST</tns:name>
</tns:parish>
<tns:parish>
<tns:code>ARGYL014</tns:code>
<tns:name>GOULBURN</tns:name>
</tns:parish>
<tns:parish>
<tns:code>ARGYL015</tns:code>
<tns:name>GUINEACOR</tns:name>
</tns:parish>
<tns:parish>
<tns:code>ARGYL016</tns:code>
<tns:name>GUNDARY</tns:name>
</tns:parish>
<tns:parish>
<tns:code>ARGYL017</tns:code>
<tns:name>GURRUNDAH</tns:name>
</tns:parish>
<tns:parish>
<tns:code>ARGYL018</tns:code>
<tns:name>INVERARY</tns:name>
</tns:parish>
<tns:parish>
<tns:code>ARGYL019</tns:code>
<tns:name>JERRALONG</tns:name>
</tns:parish>
<tns:parish>
<tns:code>ARGYL020</tns:code>
<tns:name>JERRARA</tns:name>
</tns:parish>
<tns:parish>
<tns:code>ARGYL021</tns:code>
<tns:name>KERRAWARY</tns:name>
</tns:parish>
<tns:parish>
<tns:code>ARGYL022</tns:code>
<tns:name>MANGAMORE</tns:name>
</tns:parish>
<tns:parish>
<tns:code>ARGYL023</tns:code>
<tns:name>MARULAN</tns:name>
</tns:parish>
<tns:parish>
<tns:code>ARGYL024</tns:code>
<tns:name>MILBANG</tns:name>
</tns:parish>
<tns:parish>
<tns:code>ARGYL025</tns:code>
<tns:name>MULLENGULLENGA</tns:name>
</tns:parish>
<tns:parish>
<tns:code>ARGYL026</tns:code>
<tns:name>MULWAREE</tns:name>
</tns:parish>
<tns:parish>
<tns:code>ARGYL027</tns:code>
<tns:name>MUMMEL</tns:name>
</tns:parish>
<tns:parish>
<tns:code>ARGYL028</tns:code>
<tns:name>MUTMUTBILLY</tns:name>
</tns:parish>
<tns:parish>
<tns:code>ARGYL029</tns:code>
<tns:name>NADGIGOMAR</tns:name>
</tns:parish>
<tns:parish>
<tns:code>ARGYL030</tns:code>
<tns:name>NARRANGARRIL</tns:name>
</tns:parish>
<tns:parish>
<tns:code>ARGYL031</tns:code>
<tns:name>NATTERY</tns:name>
</tns:parish>
<tns:parish>
<tns:code>ARGYL032</tns:code>
<tns:name>NERRIMUNGA</tns:name>
</tns:parish>
<tns:parish>
<tns:code>ARGYL033</tns:code>
<tns:name>NORRONG</tns:name>
</tns:parish>
<tns:parish>
<tns:code>ARGYL034</tns:code>
<tns:name>OALLEN</tns:name>
</tns:parish>
<tns:parish>
<tns:code>ARGYL035</tns:code>
<tns:name>PEJAR</tns:name>
</tns:parish>
<tns:parish>
<tns:code>ARGYL036</tns:code>
<tns:name>POMEROY</tns:name>
</tns:parish>
<tns:parish>
<tns:code>ARGYL037</tns:code>
<tns:name>QUIALIGO</tns:name>
</tns:parish>
<tns:parish>
<tns:code>ARGYL038</tns:code>
<tns:name>RHYANA</tns:name>
</tns:parish>
<tns:parish>
<tns:code>ARGYL039</tns:code>
<tns:name>STRATHAIRD</tns:name>
</tns:parish>
<tns:parish>
<tns:code>ARGYL040</tns:code>
<tns:name>TARAGO</tns:name>
</tns:parish>
<tns:parish>
<tns:code>ARGYL041</tns:code>
<tns:name>TARLO</tns:name>
</tns:parish>
<tns:parish>
<tns:code>ARGYL042</tns:code>
<tns:name>TERRANNA</tns:name>
</tns:parish>
<tns:parish>
<tns:code>ARGYL043</tns:code>
<tns:name>TOWRANG</tns:name>
</tns:parish>
<tns:parish>
<tns:code>ARGYL044</tns:code>
<tns:name>TURRALLO</tns:name>
</tns:parish>
<tns:parish>
<tns:code>ARGYL045</tns:code>
<tns:name>UPPER TARLO</tns:name>
</tns:parish>
<tns:parish>
<tns:code>ARGYL046</tns:code>
<tns:name>URINGALLA</tns:name>
</tns:parish>
<tns:parish>
<tns:code>ARGYL047</tns:code>
<tns:name>WAYO</tns:name>
</tns:parish>
<tns:parish>
<tns:code>ARGYL048</tns:code>
<tns:name>WILLEROO</tns:name>
</tns:parish>
<tns:parish>
<tns:code>ARGYL049</tns:code>
<tns:name>WOLOGORONG</tns:name>
</tns:parish>
<tns:parish>
<tns:code>ARGYL050</tns:code>
<tns:name>YARRALAW</tns:name>
</tns:parish>
</tns:parishes>
</tns:getParishDataResponse>
</soapenv:Body>
</soapenv:Envelope>

Now instead of storing the value into an arraylist i want to store the response into a hashmap so that i can access the code,name pair from the hashmap. I need that bcoz I have another arraylist name interestlist that contains only the code but not the name.How can i do that?

The values entered are strings but it says cannot convert type int to string. Im getting the issue with SlotTime from the dropdown "app_time". In the debugger it shows as a string. In the Database Slot_Time is a time datatype.

  SlotDate = Request.Form["app_date"];
  SlotTime = Request.Form["app_time"];

  var db = Database.Open("SQL");
  SlotID = db.QueryValue("Select Slot_ID from Slot Where Slot_Date = @0 AND Slot_Time=@1  AND Practice_Name = @1", SlotDate,SlotTime, PracticeName);

HTML:

            <div id="field4-container" class="field f_50">
              <label for="field4">Time</label>
                <select name="app_time" id="field4">
                    <option value ="10:30:00">10:30:00<option>
                    <option value ="10:45:00">10:45:00<option>

                </select>
            </div>

I have one property named Description in my class. I am having value in it some thing like this

Object.Description = "<b>Hello</b>";

Now I am showing this in view page using Html.EditorFor

@Html.EditorFor(x => x.Object.Description);

This is showing text as "<b>Hello</b>" instead of showing "Hello" in bold. i.e. it is not rendering HTML tags.

I know that I can render HTML tags like this

@Html.Raw(HttpUtility.HtmlDecode(Object.Description));

But how to use it with EditorFor HTML helper so that I can show all rendered content in textarea ?

Note: I am using http://jqueryte.com/ for showing editor for textarea.

So I am following the example at http://holsson.wordpress.com/2011/08/24/microsoft-dynamics-crm-2011-online-integration-getting-started-late-bound/ to try and create an MVC 5 site that uses CRM as the backing data. I created a CRMAccount Controller (Could't make one called Account as it was used by the Identity system).

I am able to successfully query the CRM System but when i try to use the Razor Code below in my view, I get the name, but nothing under the accountid is displayed. The item returned by accountid is a GUID, If I try to set it to a string, the DisplayFor complains that it can't render that.

@model IEnumerable<Microsoft.Xrm.Sdk.Entity>

@{
    ViewBag.Title = "Index";
}

<h2>Index</h2>

<table>
    <tr>
        <th>ID</th>
        <th>Name</th>
    </tr>

@foreach (var item in Model)
{
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item["accountid"])
        </td>
        <td>
            @Html.DisplayFor(modelItem => item["name"])
        </td>
    </tr>
}
</table>

I am only doing this right now for Proof Of Concept. Eventually, I want to put the two together as a drop down box, but if I can't get the GUID to pull correctly, I'm going to have problems.

I am creating a website in visual studio. I want retrieve and display image (of datatype image from sql server database) in webpage. I have a .cshtml page and got the following code to display some of the fields of the table. I am able to display everything except the image datatype column. I am using razor syntax.

MY code

@{
var db1 = Database.Open("database1");
var selectQueryString = "SELECT * FROM Recipes ORDER BY date";
}
<div class="left-content">
<h5>Recent Posts</h5>
 <table>
    <tbody>
    @foreach(var row in db1.Query(selectQueryString))
    {         
    <tr>
        <td>@row.image</td>
        <td>@row.title</td>
        <td>@row.description</td>
    </tr>
    }
    </tbody>
</table>

This is my output in the webpage:

Recent Posts
System.Byte[]   testaspform     ufegewu
System.Byte[]   testone     qfeyqo
System.Byte[]   testtwo     oadiufh

As you could see the first column show System.Byte[] instead of the image.

I would like to share among views the logic for creating an img tag from a mediaPart. I have already created the following razor helper method:

@helper CreateImgFromMediaPart(dynamic mediaPart, int width = 150)
{
    var imgSrc = mediaPart != null ? mediaPart.MediaUrl : string.Empty;
    var imgAlt = mediaPart != null ? mediaPart.AlternateText : string.Empty;
    <img alt="@imgAlt" src="@imgSrc" />
}

I have tried this by creating an App_Code folder, putting into it a MyHelpers.cshtml file, and putting in that file the above helper method. Unfortunately, we receive the following error:

The name 'MyHelpers' does not exist in the current context.

I have an AD server, a DB server (SQL Server 2012), and an IIS/webapp server.

I have set up delegation as follows: For the IIS computer in the domain, I have trusted it to use any authentication protocol for http on the iis computer. servicePrincipalName values are HOST/iishostname, HOST/iishostname.domain, http/iishostname, http/iishostname.domain. The IIS application is running under an application pool with a domain account as the identity. I set up delegation for the application pool service account as follows: I have trusted it to use any authentication protocol for MSSQLSvc on the db server for ports 1433 and 2053. The only servicePrincipalName value is http/iishostname.domain. The various SQL server services are running under domain service accounts with servicePrincipalName values of MSSQLSvc/dbhostname.domain:1433, MSSQLSvc/dbhostname.domain:2053, and MSSQLSvc/dbhostname.domain:INSTANCENAME.

In IIS I have enabled Active Directory Client Certificate Authentication and ASP.NET Impersonation and for the website I have only enabled ASP.NET Impersonation. In SSL settings I require SSL + require cert.

In SQL Server I created a login/role for the AD users group.

This setup works on a fresh install of Windows Web Server 2008 sp2, but fails for Windows Server 2008 Enterprise, Windows Server 2008 R2 Standard/Enterprise, and Windows Web Server 2008 R2 with a NT AUTHORITY/ANONYMOUS LOGON error.

Is there some difference I'm not aware of between Windows Web Server 2008 and the rest of these OS's, or is my AD/IIS configured incorrectly?

i active my Wildcard with add an A record with a * in my domain.when i enter an arbitrary subdomain,browser open this page(use this http://a.khabareani.ir/ if don't have image).windows server pic load and when click on it,redirect to iis.net.(my domain is khabareani.ir)

i need a url rewriting(i'm not sure.i think)for redirect this page into my main page.plz help me for this url rewriting.i want use wildcard.

When trying to run my ASP.NET program i am getting this error message below:

Compiler Error Message: CS1061: 'ASP.about_aspx' does not contain a definition for 'btnRunReports_Click' and no extension method 'btnRunReports_Click' accepting a first argument of type 'ASP.about_aspx' could be found (are you missing a using directive or an assembly reference?)

Line 18 below seems to be the problem but i have no idea why.

Line 16:        </p>

Line 17:

Line 18: <asp:Button ID="btnRunReports" runat="server" Text="Run Reports" onclick="btnRunReports_Click" />
Line 19:

Line 20: <p><asp:Button ID="IdSort" runat="server" Text="Sort" onclick="IdSort_Click" />

On the run reports button i have this following code:

 protected void btnRunReports_Click(object sender, EventArgs e)
   {
       RunReport();
   }

and then

 public void RunReport()
   {
       Application.Lock();
      // lb1 = (SaleList)Application["SaleList"];
       TextReportGenerator trg = new TextReportGenerator(saleList);
       trg.GenerateAllReport("report.txt");
       Application.UnLock();
   }

i have no idea how to fix this error, i have no errors in the .cs just on that line 18, some guidance would be much appreciated.

This is the About.aspx.cs

`using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Web;
 using System.Web.UI;
 using System.Web.UI.WebControls;
 using System.IO;
 using Antiques;
 using AntiqueSale;


 namespace Antiques

 {
public partial class About : System.Web.UI.Page, ISaleManagerUI
{
    SaleList saleList;

    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            if (!ReferenceEquals(null, Session["ID"]))
            {
                Sale sale = new Sale((string)Session["ID"], (DateTime)Session["Date"], (string)Session["Location"], (double)Session["Picth Cost"], (int)Session["Num Pitches"],
                    (bool)Session["Charity"], (string)Session["Charity Name"], (bool)Session["Catering"]);

                saleList = (SaleList)Application["SaleList"];

                saleList.addSale(sale);

                Application["SaleList"] = saleList;

                UpdateListbox();
            }
        }
        catch (DuplicateIdException)
        {
           UpdateListbox();
        }
        lblerror.Text = null;
    }


    public void LoadData()
    {
        try
        {
            Application.Lock();
            SerializeFileHandler sr = new SerializeFileHandler();
            Application["Antiques Sale"] = sr.ReadSaleListFromFile("data.dat");
            UpdateListbox();
            Application.UnLock();
        }
        catch (FileNotFoundException)
        {
            lblerror.Text = "Error: Not found, must save first";
        }
    }

    protected void Load_Click(object sender, EventArgs e)
    {
        LoadData();
    }

    public void AddData()
    {
        var response = base.Response;

        response.Redirect("Default.aspx", true);
    }

    protected void btnAddBox_Click(object sender, EventArgs e)
    {
        AddData();
    }

    public void getSale()
    {

    }

    public void UpdateListbox()
    {
        Application.Lock();
        lb1.Items.Clear();
        saleList = (SaleList)Application["SaleList"];    
        for (int i = 0; i < saleList.Count(); i++)
        {
           // ListItem lst1 = new ListItem(lb1.saleList(i).ToString(), i.ToString());
           // lst1.Items.Add(lb1);
        }
        Application.UnLock();
   }

    protected void lb1_Init(object sender, EventArgs e)
    {
        UpdateListbox();
    }


    protected void Delete_Click(object sender, EventArgs e)
    {
        while (lb1.SelectedIndex != -1)
        {
            ListItem mySelectedItem = (from ListItem li in lb1.Items where li.Selected == true select li).First();
            lb1.Items.Remove(mySelectedItem);
        }
    }

    protected void lb1_SelectedIndexChanged(object sender, EventArgs e)
    {

    }

    public void SaveData()
    {
        saleList = (SaleList)Application["SaleList"];
        if (saleList.Count() != 0)
        {
            Application.Lock();
            SerializeFileHandler sr = new SerializeFileHandler();
            sr.WriteSaleListToFile((SaleList)Application["SaleList"], "data.dat");
            Application.UnLock();
        }
        else
        {
            lblerror.Text = "Error: You need to enter data into the list";
        }
    }

    protected void Save_Click(object sender, EventArgs e)
    {
        SaveData();
    }

    protected void IdSort_Click(object sender, EventArgs e)
    {
        SortData();
    }


   public void SortData()
    {
       // var item = lb1.getItem(0);
       // var index = item.get_index();
       // lb1.reorderItem(item, index - 1);
    }

   public void RunReport()
   {
       Application.Lock();
      // lb1 = (SaleList)Application["SaleList"];
       TextReportGenerator trg = new TextReportGenerator(saleList);
       trg.GenerateAllReport("report.txt");
       Application.UnLock();
   }


   protected void btnRunReports_Click(object sender, EventArgs e)
   {
       RunReport();
   }




}

} `

enter image description here

Here is my Asp.net code:

<asp:UpdatePanel runat="server" ClientIDMode="Static" ID="TasksUpdatePanel" UpdateMode="Conditional">
    <ContentTemplate>
        <table class="taskGridView">
            <tr>
                <td>
                    <asp:DropDownList ID="ddlTaskName" CssClass="chosen-select" DataSourceID="dsPopulateTaskName" AutoPostBack="true" DataValueField="Task Name" runat="server" Width="100%" Font-Size="11px" AppendDataBoundItems="true" OnSelectedIndexChanged="ddlTaskName_onSelectIndexChanged">
                        <asp:ListItem Text="All" Value="%"></asp:ListItem>
                    </asp:DropDownList>
                    <asp:SqlDataSource ID="dsPopulateTaskName" runat="server" ConnectionString="<%$ ConnectionStrings:gvConnString %>" SelectCommand="SELECT DISTINCT [ATTR2739] 'Task Name' FROM HSI.RMOBJECTINSTANCE1224 CT INNER JOIN HSI.RMOBJECTINSTANCE1232 S ON CT.ATTR2846 = S.ATTR2821 INNER JOIN HSI.USERACCOUNT UA ON S.FK2852 = (UA.USERNUM * -1) LEFT JOIN HSI.RMOBJECTINSTANCE1251 PXC ON PXC.FK2924 = CT.OBJECTID LEFT JOIN HSI.RMOBJECTINSTANCE1249 P ON PXC.FK2923 = P.OBJECTID LEFT JOIN HSI.RMOBJECTINSTANCE1248 PRXC ON PRXC.FK2912 = CT.OBJECTID LEFT JOIN HSI.RMOBJECTINSTANCE1230 PR ON PR.OBJECTID = PRXC.FK2911 LEFT JOIN HSI.RMOBJECTINSTANCE1247 SXC ON SXC.FK2908 = CT.OBJECTID LEFT JOIN HSI.RMOBJECTINSTANCE1229 SI ON SI.OBJECTID = SXC.FK2907 INNER JOIN HSI.RMOBJECTINSTANCE1231 C ON CT.FK2927 = C.OBJECTID WHERE CT.ACTIVESTATUS = 0"></asp:SqlDataSource>
                </td>
                <td>
                    <asp:DropDownList ID="ddlService" CssClass="chosen-select" DataSourceID="dsPopulateService" AutoPostBack="true" DataValueField="Service" runat="server" Width="100%" Font-Size="11px" AppendDataBoundItems="true" OnSelectedIndexChanged="ddlService_onSelectIndexChanged">
                        <asp:ListItem Text="All" Value="%"></asp:ListItem>
                    </asp:DropDownList>
                    <asp:SqlDataSource ID="dsPopulateService" runat="server" ConnectionString="<%$ ConnectionStrings:gvConnString %>" SelectCommand="SELECT DISTINCT [ATTR2846] 'Service' FROM HSI.RMOBJECTINSTANCE1224 CT INNER JOIN HSI.RMOBJECTINSTANCE1232 S ON CT.ATTR2846 = S.ATTR2821 INNER JOIN HSI.USERACCOUNT UA ON S.FK2852 = (UA.USERNUM * -1) LEFT JOIN HSI.RMOBJECTINSTANCE1251 PXC ON PXC.FK2924 = CT.OBJECTID LEFT JOIN HSI.RMOBJECTINSTANCE1249 P ON PXC.FK2923 = P.OBJECTID LEFT JOIN HSI.RMOBJECTINSTANCE1248 PRXC ON PRXC.FK2912 = CT.OBJECTID LEFT JOIN HSI.RMOBJECTINSTANCE1230 PR ON PR.OBJECTID = PRXC.FK2911 LEFT JOIN HSI.RMOBJECTINSTANCE1247 SXC ON SXC.FK2908 = CT.OBJECTID LEFT JOIN HSI.RMOBJECTINSTANCE1229 SI ON SI.OBJECTID = SXC.FK2907 INNER JOIN HSI.RMOBJECTINSTANCE1231 C ON CT.FK2927 = C.OBJECTID WHERE CT.ACTIVESTATUS = 0"></asp:SqlDataSource>
                </td>
                <td>
                    <asp:DropDownList ID="ddlStatus" CssClass="chosen-select" DataSourceID="dsPopulateStatus" AutoPostBack="true" DataValueField="Status" runat="server" Width="100%" Font-Size="11px" AppendDataBoundItems="true" OnSelectedIndexChanged="ddlStatus_onSelectIndexChanged">
                        <asp:ListItem Text="All" Value="%"></asp:ListItem>
                    </asp:DropDownList>
                    <asp:SqlDataSource ID="dsPopulateStatus" runat="server" ConnectionString="<%$ ConnectionStrings:gvConnString %>" SelectCommand="SELECT DISTINCT [ATTR2812] 'Status' FROM HSI.RMOBJECTINSTANCE1224 CT INNER JOIN HSI.RMOBJECTINSTANCE1232 S ON CT.ATTR2846 = S.ATTR2821 INNER JOIN HSI.USERACCOUNT UA ON S.FK2852 = (UA.USERNUM * -1) LEFT JOIN HSI.RMOBJECTINSTANCE1251 PXC ON PXC.FK2924 = CT.OBJECTID LEFT JOIN HSI.RMOBJECTINSTANCE1249 P ON PXC.FK2923 = P.OBJECTID LEFT JOIN HSI.RMOBJECTINSTANCE1248 PRXC ON PRXC.FK2912 = CT.OBJECTID LEFT JOIN HSI.RMOBJECTINSTANCE1230 PR ON PR.OBJECTID = PRXC.FK2911 LEFT JOIN HSI.RMOBJECTINSTANCE1247 SXC ON SXC.FK2908 = CT.OBJECTID LEFT JOIN HSI.RMOBJECTINSTANCE1229 SI ON SI.OBJECTID = SXC.FK2907 INNER JOIN HSI.RMOBJECTINSTANCE1231 C ON CT.FK2927 = C.OBJECTID WHERE CT.ACTIVESTATUS = 0"></asp:SqlDataSource>
                </td>
                <td>
                    <asp:DropDownList ID="ddlDueDate" CssClass="chosen-select" DataSourceID="dsPopulateDueDate" AutoPostBack="true" DataValueField="Due Date" runat="server" Width="100%" Font-Size="11px" AppendDataBoundItems="true" OnSelectedIndexChanged="ddlDueDate_onSelectIndexChanged">
                        <asp:ListItem Text="All" Value="%"></asp:ListItem>
                    </asp:DropDownList>
                    <asp:SqlDataSource ID="dsPopulateDueDate" runat="server" ConnectionString="<%$ ConnectionStrings:gvConnString %>" SelectCommand="SELECT DISTINCT CONVERT(VARCHAR(14), [ATTR2752], 110) 'Due Date' FROM HSI.RMOBJECTINSTANCE1224 CT INNER JOIN HSI.RMOBJECTINSTANCE1232 S ON CT.ATTR2846 = S.ATTR2821 INNER JOIN HSI.USERACCOUNT UA ON S.FK2852 = (UA.USERNUM * -1) LEFT JOIN HSI.RMOBJECTINSTANCE1251 PXC ON PXC.FK2924 = CT.OBJECTID LEFT JOIN HSI.RMOBJECTINSTANCE1249 P ON PXC.FK2923 = P.OBJECTID LEFT JOIN HSI.RMOBJECTINSTANCE1248 PRXC ON PRXC.FK2912 = CT.OBJECTID LEFT JOIN HSI.RMOBJECTINSTANCE1230 PR ON PR.OBJECTID = PRXC.FK2911 LEFT JOIN HSI.RMOBJECTINSTANCE1247 SXC ON SXC.FK2908 = CT.OBJECTID LEFT JOIN HSI.RMOBJECTINSTANCE1229 SI ON SI.OBJECTID = SXC.FK2907 INNER JOIN HSI.RMOBJECTINSTANCE1231 C ON CT.FK2927 = C.OBJECTID WHERE CT.ACTIVESTATUS = 0"></asp:SqlDataSource>
                </td>
                <td>
                    <asp:DropDownList ID="ddlOwner" CssClass="chosen-select" DataSourceID="dsPopulateOwner" AutoPostBack="true" DataValueField="Owner" runat="server" Width="100%" Font-Size="11px" AppendDataBoundItems="true" OnSelectedIndexChanged="ddlOwner_onSelectIndexChanged">
                        <asp:ListItem Text="All" Value="%"></asp:ListItem>
                    </asp:DropDownList>
                    <asp:SqlDataSource ID="dsPopulateOwner" runat="server" ConnectionString="<%$ ConnectionStrings:gvConnString %>" SelectCommand="SELECT DISTINCT [REALNAME] 'Owner' FROM HSI.RMOBJECTINSTANCE1224 CT INNER JOIN HSI.RMOBJECTINSTANCE1232 S ON CT.ATTR2846 = S.ATTR2821 INNER JOIN HSI.USERACCOUNT UA ON S.FK2852 = (UA.USERNUM * -1) LEFT JOIN HSI.RMOBJECTINSTANCE1251 PXC ON PXC.FK2924 = CT.OBJECTID LEFT JOIN HSI.RMOBJECTINSTANCE1249 P ON PXC.FK2923 = P.OBJECTID LEFT JOIN HSI.RMOBJECTINSTANCE1248 PRXC ON PRXC.FK2912 = CT.OBJECTID LEFT JOIN HSI.RMOBJECTINSTANCE1230 PR ON PR.OBJECTID = PRXC.FK2911 LEFT JOIN HSI.RMOBJECTINSTANCE1247 SXC ON SXC.FK2908 = CT.OBJECTID LEFT JOIN HSI.RMOBJECTINSTANCE1229 SI ON SI.OBJECTID = SXC.FK2907 INNER JOIN HSI.RMOBJECTINSTANCE1231 C ON CT.FK2927 = C.OBJECTID WHERE CT.ACTIVESTATUS = 0"></asp:SqlDataSource>
                </td>
                <td>
                    <asp:DropDownList ID="ddlClient" CssClass="chosen-select" DataSourceID="dsPopulateClient" AutoPostBack="true" DataValueField="Client" runat="server" Width="100%" Font-Size="11px" AppendDataBoundItems="true" OnSelectedIndexChanged="ddlClient_onSelectIndexChanged">
                        <asp:ListItem Text="All" Value="%"></asp:ListItem>
                    </asp:DropDownList>
                    <asp:SqlDataSource ID="dsPopulateClient" runat="server" ConnectionString="<%$ ConnectionStrings:gvConnString %>" SelectCommand="SELECT DISTINCT [ATTR2815] 'Client' FROM HSI.RMOBJECTINSTANCE1224 CT INNER JOIN HSI.RMOBJECTINSTANCE1232 S ON CT.ATTR2846 = S.ATTR2821 INNER JOIN HSI.USERACCOUNT UA ON S.FK2852 = (UA.USERNUM * -1) LEFT JOIN HSI.RMOBJECTINSTANCE1251 PXC ON PXC.FK2924 = CT.OBJECTID LEFT JOIN HSI.RMOBJECTINSTANCE1249 P ON PXC.FK2923 = P.OBJECTID LEFT JOIN HSI.RMOBJECTINSTANCE1248 PRXC ON PRXC.FK2912 = CT.OBJECTID LEFT JOIN HSI.RMOBJECTINSTANCE1230 PR ON PR.OBJECTID = PRXC.FK2911 LEFT JOIN HSI.RMOBJECTINSTANCE1247 SXC ON SXC.FK2908 = CT.OBJECTID LEFT JOIN HSI.RMOBJECTINSTANCE1229 SI ON SI.OBJECTID = SXC.FK2907 INNER JOIN HSI.RMOBJECTINSTANCE1231 C ON CT.FK2927 = C.OBJECTID WHERE CT.ACTIVESTATUS = 0"></asp:SqlDataSource>
                </td>
                <td>
                    <asp:DropDownList ID="ddlSite" CssClass="chosen-select" DataSourceID="dsPopulateSite" AutoPostBack="true" DataValueField="Site" runat="server" Width="100%" Font-Size="11px" AppendDataBoundItems="true" OnSelectedIndexChanged="ddlSite_onSelectIndexChanged">
                        <asp:ListItem Text="All" Value="%"></asp:ListItem>
                    </asp:DropDownList>
                    <asp:SqlDataSource ID="dsPopulateSite" runat="server" ConnectionString="<%$ ConnectionStrings:gvConnString %>" SelectCommand="SELECT DISTINCT [ATTR2819] 'Site' FROM HSI.RMOBJECTINSTANCE1224 CT INNER JOIN HSI.RMOBJECTINSTANCE1232 S ON CT.ATTR2846 = S.ATTR2821 INNER JOIN HSI.USERACCOUNT UA ON S.FK2852 = (UA.USERNUM * -1) LEFT JOIN HSI.RMOBJECTINSTANCE1251 PXC ON PXC.FK2924 = CT.OBJECTID LEFT JOIN HSI.RMOBJECTINSTANCE1249 P ON PXC.FK2923 = P.OBJECTID LEFT JOIN HSI.RMOBJECTINSTANCE1248 PRXC ON PRXC.FK2912 = CT.OBJECTID LEFT JOIN HSI.RMOBJECTINSTANCE1230 PR ON PR.OBJECTID = PRXC.FK2911 LEFT JOIN HSI.RMOBJECTINSTANCE1247 SXC ON SXC.FK2908 = CT.OBJECTID LEFT JOIN HSI.RMOBJECTINSTANCE1229 SI ON SI.OBJECTID = SXC.FK2907 INNER JOIN HSI.RMOBJECTINSTANCE1231 C ON CT.FK2927 = C.OBJECTID WHERE CT.ACTIVESTATUS = 0"></asp:SqlDataSource>
                </td>
                <td>
                    <asp:DropDownList ID="ddlPractice" CssClass="chosen-select" DataSourceID="dsPopulatePractice" AutoPostBack="true" DataValueField="Practice" runat="server" Width="100%" Font-Size="11px" AppendDataBoundItems="true" OnSelectedIndexChanged="ddlPractice_onSelectIndexChanged">
                        <asp:ListItem Text="All" Value="%"></asp:ListItem>
                    </asp:DropDownList>
                    <asp:SqlDataSource ID="dsPopulatePractice" runat="server" ConnectionString="<%$ ConnectionStrings:gvConnString %>" SelectCommand="SELECT DISTINCT [ATTR2817] 'Practice' FROM HSI.RMOBJECTINSTANCE1224 CT INNER JOIN HSI.RMOBJECTINSTANCE1232 S ON CT.ATTR2846 = S.ATTR2821 INNER JOIN HSI.USERACCOUNT UA ON S.FK2852 = (UA.USERNUM * -1) LEFT JOIN HSI.RMOBJECTINSTANCE1251 PXC ON PXC.FK2924 = CT.OBJECTID LEFT JOIN HSI.RMOBJECTINSTANCE1249 P ON PXC.FK2923 = P.OBJECTID LEFT JOIN HSI.RMOBJECTINSTANCE1248 PRXC ON PRXC.FK2912 = CT.OBJECTID LEFT JOIN HSI.RMOBJECTINSTANCE1230 PR ON PR.OBJECTID = PRXC.FK2911 LEFT JOIN HSI.RMOBJECTINSTANCE1247 SXC ON SXC.FK2908 = CT.OBJECTID LEFT JOIN HSI.RMOBJECTINSTANCE1229 SI ON SI.OBJECTID = SXC.FK2907 INNER JOIN HSI.RMOBJECTINSTANCE1231 C ON CT.FK2927 = C.OBJECTID WHERE CT.ACTIVESTATUS = 0"></asp:SqlDataSource>
                </td>
                <td>
                    <asp:DropDownList ID="ddlProvider" CssClass="chosen-select" DataSourceID="dsPopulateProvider" AutoPostBack="true" DataValueField="Provider" runat="server" Width="100%" Font-Size="11px" AppendDataBoundItems="true" OnSelectedIndexChanged="ddlProvider_onSelectIndexChanged">
                        <asp:ListItem Text="All" Value="%"></asp:ListItem>
                    </asp:DropDownList>
                    <asp:SqlDataSource ID="dsPopulateProvider" runat="server" ConnectionString="<%$ ConnectionStrings:gvConnString %>" SelectCommand="SELECT DISTINCT [ATTR2919] 'Provider' FROM HSI.RMOBJECTINSTANCE1224 CT INNER JOIN HSI.RMOBJECTINSTANCE1232 S ON CT.ATTR2846 = S.ATTR2821 INNER JOIN HSI.USERACCOUNT UA ON S.FK2852 = (UA.USERNUM * -1) LEFT JOIN HSI.RMOBJECTINSTANCE1251 PXC ON PXC.FK2924 = CT.OBJECTID LEFT JOIN HSI.RMOBJECTINSTANCE1249 P ON PXC.FK2923 = P.OBJECTID LEFT JOIN HSI.RMOBJECTINSTANCE1248 PRXC ON PRXC.FK2912 = CT.OBJECTID LEFT JOIN HSI.RMOBJECTINSTANCE1230 PR ON PR.OBJECTID = PRXC.FK2911 LEFT JOIN HSI.RMOBJECTINSTANCE1247 SXC ON SXC.FK2908 = CT.OBJECTID LEFT JOIN HSI.RMOBJECTINSTANCE1229 SI ON SI.OBJECTID = SXC.FK2907 INNER JOIN HSI.RMOBJECTINSTANCE1231 C ON CT.FK2927 = C.OBJECTID WHERE CT.ACTIVESTATUS = 0"></asp:SqlDataSource>
                </td>
            </tr>
        </table>
        <asp:GridView ShowHeaderWhenEmpty="false" AlternatingRowStyle-BackColor="#EBE9E9" AutoGenerateColumns="false" OnSorting="yourTasksGV_Sorting" AllowSorting="true" ID="yourTasksGV" runat="server" ClientIDMode="Static" EmptyDataText="There is no data to display" OnRowDataBound="yourTasksGV_RowDataBound" OnRowCreated="yourTasksGV_RowCreated">
            <Columns>
                <asp:HyperLinkField Target="_blank" DataNavigateUrlFields="Task Detail" DataTextField="Task Name" DataNavigateUrlFormatString="" HeaderText="Task Detail" SortExpression="Task Name" ItemStyle-CssClass="taskTableColumn" />
                <asp:BoundField DataField="Service" HeaderText="Service" SortExpression="Service" ItemStyle-CssClass="taskTableColumn" />
                <asp:BoundField DataField="Status" HeaderText="Status" SortExpression="Status" ItemStyle-CssClass="taskTableColumn" />
                <asp:BoundField DataField="Due Date" HeaderText="Due" SortExpression="Due Date" ItemStyle-CssClass="taskTableColumn" />
                <asp:BoundField DataField="Owner" HeaderText="Owner" SortExpression="Owner" ItemStyle-CssClass="taskTableColumn" />
                <asp:BoundField DataField="Client" HeaderText="Client" SortExpression="Client" ItemStyle-CssClass="taskTableColumn" />
                <asp:BoundField DataField="Site" HeaderText="Site" SortExpression="Site" ItemStyle-CssClass="taskTableColumn" />
                <asp:BoundField DataField="Practice" HeaderText="Practice" SortExpression="Practice" ItemStyle-CssClass="taskTableColumn" />
                <asp:BoundField DataField="Provider" HeaderText="Provider" SortExpression="Provider" ItemStyle-CssClass="taskTableColumn" />
            </Columns>
        </asp:GridView>
    </ContentTemplate>
</asp:UpdatePanel>

My code-behind:

protected void Page_Load(object sender, EventArgs e)
{

    strMainQuery = @"SELECT
               CT.OBJECTID,
               'http://checkthis.com/d=' + CAST(CT.OBJECTID AS VARCHAR) + '&classid=1224' 'Task Detail'
               ,LTRIM(RTRIM(CT.ATTR2846)) 'Service'
               ,LTRIM(RTRIM(CT.ATTR2812)) 'Status'
               ,CONVERT(VARCHAR(14), CT.ATTR2752, 110) 'Due Date'
               ,LTRIM(RTRIM(CT.ATTR2739)) 'Task Name'
               ,LTRIM(RTRIM(UA.REALNAME)) 'Owner'
               ,LTRIM(RTRIM(C.ATTR2815)) 'Client'
               ,RTRIM(SI.ATTR2819) 'Site'
               ,RTRIM(PR.ATTR2817) 'Practice'
               ,RTRIM(P.ATTR2919) 'Provider'
        FROM HSI.RMOBJECTINSTANCE1224 CT 
               INNER JOIN HSI.RMOBJECTINSTANCE1232 S ON CT.ATTR2846 = S.ATTR2821 
               INNER JOIN HSI.USERACCOUNT UA ON S.FK2852 = (UA.USERNUM * -1)
               LEFT JOIN HSI.RMOBJECTINSTANCE1251 PXC ON PXC.FK2924 = CT.OBJECTID
               LEFT JOIN HSI.RMOBJECTINSTANCE1249 P ON PXC.FK2923 = P.OBJECTID
               LEFT JOIN HSI.RMOBJECTINSTANCE1248 PRXC ON PRXC.FK2912 = CT.OBJECTID
               LEFT JOIN HSI.RMOBJECTINSTANCE1230 PR ON PR.OBJECTID = PRXC.FK2911
               LEFT JOIN HSI.RMOBJECTINSTANCE1247 SXC ON SXC.FK2908 = CT.OBJECTID
               LEFT JOIN HSI.RMOBJECTINSTANCE1229 SI ON SI.OBJECTID = SXC.FK2907
                INNER JOIN HSI.RMOBJECTINSTANCE1231 C ON CT.FK2927 = C.OBJECTID";

    if (!Page.IsPostBack)
    {
        ViewState["sortOrder"] = "Asc";
        ViewState["sortExp"] = "Due Date";
        PullData("Due Date", "Asc"); //ASC: A (top) to Z (bottom) || # (low to high) || Date (oldest to newest)
    }
}
public void PullData(string sortExp, string sortDir)
{
    query = "";
    DataTable taskData = new DataTable();
    connString = @""; //connectionstring
    if (ddlTaskName.SelectedIndex > 0)
    {
        strClause += " AND CT.ATTR2739 = '" + ddlTaskName.SelectedItem.Text + "'";
    }
    else
    {
        strClause += " AND CT.ATTR2739 LIKE '%'";
    }
    if (ddlService.SelectedIndex > 0)
    {
        strClause += " AND CT.ATTR2846 = '" + ddlService.SelectedItem.Text + "'";
    }
    else
    {
        strClause += " AND CT.ATTR2846 LIKE '%'";
    }
    if (ddlStatus.SelectedIndex > 0)
    {
        strClause += " AND CT.ATTR2812 = '" + ddlStatus.SelectedItem.Text + "'";
    }
    else
    {
        strClause += " AND CT.ATTR2812 LIKE '%'";
    }
    if (ddlDueDate.SelectedIndex > 0)
    {
        strClause += " AND CONVERT(VARCHAR(14), CT.ATTR2752, 110) = '" + ddlDueDate.SelectedItem.Text + "'";
    }
    else
    {
        strClause += " AND CONVERT(VARCHAR(14), CT.ATTR2752, 110) LIKE '%'";
    }
    if (ddlOwner.SelectedIndex > 0)
    {
        strClause += " AND UA.REALNAME = '" + ddlOwner.SelectedItem.Text + "'";
    }
    else
    {
        strClause += " AND UA.REALNAME LIKE '%'";
    }
    if (ddlClient.SelectedIndex > 0)
    {
        strClause += " AND C.ATTR2815 = '" + ddlClient.SelectedItem.Text + "'";
    }
    else
    {
        strClause += " AND C.ATTR2815 LIKE '%'";
    }
    if (ddlSite.SelectedIndex > 0)
    {
        strClause += " AND SI.ATTR2819 = '" + ddlSite.SelectedItem.Text + "'";
    }
    else
    {
        strClause += " AND SI.ATTR2819 LIKE '%'";
    }
    if (ddlPractice.SelectedIndex > 0)
    {
        strClause += " AND PR.ATTR2817 = '" + ddlPractice.SelectedItem.Text + "'";
    }
    else
    {
        strClause += " AND PR.ATTR2817 LIKE '%'";
    }
    if (ddlProvider.SelectedIndex > 0)
    {
        strClause += " AND P.ATTR2919 = '" + ddlProvider.SelectedItem.Text + "'";
    }
    else
    {
        strClause += " AND P.ATTR2919 LIKE '%'";
    }


    if (ddlTaskName.SelectedIndex == 0 && ddlService.SelectedIndex == 0 && ddlStatus.SelectedIndex == 0 && ddlDueDate.SelectedIndex == 0 && ddlOwner.SelectedIndex == 0 && ddlClient.SelectedIndex == 0 && ddlSite.SelectedIndex == 0 && ddlPractice.SelectedIndex == 0 && ddlProvider.SelectedIndex == 0)
    {
        query = strMainQuery + " WHERE CT.ACTIVESTATUS = 0";
    }
    else
    {
        query = strMainQuery + " WHERE CT.ACTIVESTATUS = 0" + strClause;
    }

    using (SqlConnection conn = new SqlConnection(connString))
    {
        try
        {
            SqlCommand cmd = new SqlCommand(query, conn);

            // create data adapter
            SqlDataAdapter da = new SqlDataAdapter(query, conn);
            // this will query your database and return the result to your datatable

            DataSet myDataSet = new DataSet();
            da.Fill(myDataSet);

            myDataView = new DataView();
            myDataView = myDataSet.Tables[0].DefaultView;

            if (sortExp != string.Empty)
            {
                //MessageBox.Show(sortExp);
                //MessageBox.Show(sortDir);
                myDataView.Sort = string.Format("{0} {1}", sortExp, sortDir);
            }

            yourTasksGV.DataSource = myDataView;
            yourTasksGV.DataBind();

            TasksUpdatePanel.Update();

            conn.Close();
        }
        catch (Exception ex)
        {
            string error = ex.Message;
        }
    }
}
protected void ddlTaskName_onSelectIndexChanged(object sender, EventArgs e)
{
    PullData(ViewState["sortExp"].ToString(), ViewState["sortOrder"].ToString());
}
protected void ddlOwner_onSelectIndexChanged(object sender, EventArgs e)
{
    PullData(ViewState["sortExp"].ToString(), ViewState["sortOrder"].ToString());
}
protected void ddlService_onSelectIndexChanged(object sender, EventArgs e)
{
    PullData(ViewState["sortExp"].ToString(), ViewState["sortOrder"].ToString());
}
protected void ddlStatus_onSelectIndexChanged(object sender, EventArgs e)
{
    PullData(ViewState["sortExp"].ToString(), ViewState["sortOrder"].ToString());
}
protected void ddlDueDate_onSelectIndexChanged(object sender, EventArgs e)
{
    PullData(ViewState["sortExp"].ToString(), ViewState["sortOrder"].ToString());
}
protected void ddlClient_onSelectIndexChanged(object sender, EventArgs e)
{
    PullData(ViewState["sortExp"].ToString(), ViewState["sortOrder"].ToString());
}
protected void ddlSite_onSelectIndexChanged(object sender, EventArgs e)
{
    PullData(ViewState["sortExp"].ToString(), ViewState["sortOrder"].ToString());
}
protected void ddlPractice_onSelectIndexChanged(object sender, EventArgs e)
{
    PullData(ViewState["sortExp"].ToString(), ViewState["sortOrder"].ToString());
}
protected void ddlProvider_onSelectIndexChanged(object sender, EventArgs e)
{
    PullData(ViewState["sortExp"].ToString(), ViewState["sortOrder"].ToString());
}

public string sortOrder
{
    get
    {
        if (ViewState["sortOrder"].ToString() == "Desc")
        {
            ViewState["sortOrder"] = "Asc";
        }
        else
        {
            ViewState["sortOrder"] = "Desc";
        }

        return ViewState["sortOrder"].ToString();
    }
    set
    {
        ViewState["sortOrder"] = value;
    }
}

How can I achieve the Dynamic DropDownList from the filtered GridView?

Thanks in advance.

I need help with this form:

enter image description here

I have a textbox tha doesn't preserve the data on postback, the problem here is that when you postback the other fields in which data is maintained except in the texbox "txtTituloNoticia", I'm using windows server 2012.

Here is my .aspx code:

 <%@ Page Title="" Language="C#" MasterPageFile="~/Admin.master" AutoEventWireup="true" CodeFile="AltaNoticia.aspx.cs" Inherits="Apartados_Administrar_Noticias_AltaNoticia" %>
    <%@ Register TagPrefix="cc" Namespace="Winthusiasm.HtmlEditor" Assembly="Winthusiasm.HtmlEditor" %>
    <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>

                            <li>

                                <asp:UpdatePanel runat="server" ID="tituloN"><ContentTemplate>
                                <label for="<%=txtTituloNoticia.ClientID%>">* Titulo de la noticia:</label>
                                <asp:TextBox ID="txtTituloNoticia" runat="server" CssClass="text  large"></asp:TextBox>

                                    </ContentTemplate></asp:UpdatePanel>
                            </li>

        <br />
        <asp:Button ID="btnVolver" runat="server" Text="Volver" CssClass="submitBtn" onclick="btnVolver_Click"/>
    </asp:Content>

and my code behind:

   protected void btnGuardar_Click(object sender, EventArgs e)
    {
        try
        {

            using (SqlConnection Conn = conexionAdmin.Conecta())
            {
                using (SqlCommand cmdNoticia = new SqlCommand())
                {
                    cmdNoticia.Connection = Conn;
                    string user = HttpContext.Current.User.Identity.Name; // Usuario logueado
                    MembershipUser u = Membership.GetUser(user);
                    string idUser = u.ProviderUserKey.ToString(); // Se obtiene el id del usuario pero en formato string
                    Guid userId = new Guid(idUser); // Se convierte a GUID el idUser
                    string strTiNo = txtTituloNoticia.Text.Trim();
                    string strReNo = txtResumenNoticia.Text.Trim();
                    string strDesc = Descripcion.Text.Trim();

                    cmdNoticia.CommandType = CommandType.StoredProcedure;
                    cmdNoticia.Parameters.Add("@IDDEPTO", SqlDbType.Int).Value = ddlDepartamento.SelectedValue;
                    cmdNoticia.Parameters.Add("@TITULO", SqlDbType.NVarChar, 250).Value = txtTituloNoticia.Text.Trim();
                    cmdNoticia.Parameters.Add("@CONTENIDO", SqlDbType.NVarChar).Value = Descripcion.Text.Trim();
                    cmdNoticia.Parameters.Add("@RESUMEN", SqlDbType.NVarChar, 500).Value = txtResumenNoticia.Text.Trim();

                    if (((txtTituloNoticia.Text.Trim() != "") && ((txtResumenNoticia.Text.Trim() != "") && (Descripcion.Text.Trim() != "") && ddlDepartamento.SelectedValue != "")))
                    {

                        // Falta validar que se agregan los textos
                        if (!Regex.IsMatch(strTiNo, Utilidades.ValidaTextoGeneral))
                        {
                            lblMensaje.Text = Alertas.alertaError("Titulo de la noticia", "No puede contener caractéres especiales");
                            return;
                        }

                        if (IDNoticia == 0)
                        {
                            //Insertion                     
                            SqlParameter prmIDNoticia = cmdNoticia.Parameters.Add("@IDNOTICIA", SqlDbType.Int);
                            prmIDNoticia.Direction = ParameterDirection.Output;
                            cmdNoticia.CommandText = "InsNoticia";
                            Conn.Open();
                            cmdNoticia.ExecuteNonQuery();
                            Conn.Close();
                            IDNoticia = Convert.ToInt32(prmIDNoticia.Value);
                            lblMensaje.Text = Alertas.alertaExito("", "La noticia se cre&oacute; correctamente");
                           // Response.Redirect("AltaNoticia.aspx?Key=" + IDNoticia);

                        }
                        else
                        {
                            //Edition
                            cmdNoticia.Parameters.Add("@IDNOTICIA", SqlDbType.Int).Value = IDNoticia;
                            cmdNoticia.CommandText = "UpdNoticia";
                            Conn.Open();
                            cmdNoticia.ExecuteNonQuery();
                            Conn.Close();

                            lblMensaje.Text = Alertas.alertaExito("", "La noticia se actualiz&oacute; correctamente");
                        }
                    }
                    else
                    {
                        lblMensaje.Text = Alertas.alertaError("", "Los campos con * son obligatorios");
                    }
                }
            }

            //lblMensaje.Text = Alertas.alertaExito("","Actualización realizada satisfactoriamente");
        }
        catch (Exception)
        {

            throw;
        }
    } 

I'm very new to ASP.NET WebForms applications. I have an application using a DataGrid which has a DataBinding to a List of objects. When the page loaded completely, I want to add further information to each row in the DataGrid.

The process which determines the additional information for each row must run on the server side and takes about 2s per row (network access etc.). Therefore I would like my DataGrid to refresh after every row has been processed.

This means, that I want an asynchronous mechanism that loads the data while the web page is completely accessible for the user and updates the UI as soon as a row is processed on the server side.

Technically that means that I need to send a HTTP response after processing each row to the client. The client will then read the HTTP response and update the UI.

I already tried using a UpdatePanel with a ScriptManager according to this article.

The problem with this solution is, that the UI updates when the last row has been processed. This is too late. We need an UI update after each row.

I'm used to work with WPF desktop applications. In a WPF desktop application I would just use a background worker. In the ProgressReported-EventHandler I would update the Grid with the new information and invoke an IPropertyChanged notification.

How can I achieve that in ASP.NET (.NET 4.0)? Any help and web resources are highly appreciated.

I've perused the forums for a couple weeks now trying out different solutions, but nothing seems to be helping. Here's my problem:

I have created an ASP.NET Web Application for displaying dashboard-style metrics in a Service Desk setting. The client has large screens in the service desk room that display specific pages of my web app.

Some pages use UpdatePanel, others use $.ajax to make calls to code behind every 15 seconds (I have various [WebMethod]'s set up for the ajax calls).

These dashboards work fantastic for about a day, maybe 2, then they stop refreshing, and the above error message can be found in the console. Bug checking for the ajax methods show they hit the 'error:' portion of the ajax call.

Below are solutions I have tried to no avail:

Added EnableSessionState="False" to the <%@ Page %> header.

Added validateRequest="false" to the <%@ Page %> header.

Added enableEventValidation="false" to the <%@ Page %> header.

Added try-catch statements to my web methods to catch the error.

Added Global.asax and overrode the Application_Error. Made it write to an application event log. Example below.

Exception exc = Server.GetLastError().GetBaseException();
        if (!EventLog.SourceExists("Dashboards"))
        {
            EventLog.CreateEventSource("Dashboards", "Dashboard");
        }

        EventLog log = new EventLog();
        log.Source = "Dashboards";
        log.WriteEntry(exc.ToString());

        Server.ClearError();

This Global.asax exception is never called (as far as I can tell) and I never have any exceptions logged.

I can't think of any other troubleshooting to do with this.

If I had to guess, I would say it's the every 15 second ajax/updatepanel calls that is causing the issue. The app is running on IIS v8 on Server 2012. Perhaps IIS thinks it's getting DDOS'd or something similar? Another possibility is that I have various threads running in the code behind (aspx.cs) updating information that the ajax call then pulls from. Maybe the thread is getting killed somehow?

I am currently out of ideas. Any help with troubleshooting would be appreciated. I'm more than happy to upload more code as example as well.

Thank you to anyone who can assist with this.

Suppose a repeater created 10 instances of the template below. Then the user clicked on thebtnRemove control in the 3rd instance.

How would I be able to access that item set specifically in the repeater?

<asp:Repeater ID="rptItems" runat="server" >
        <ItemTemplate>
            <div class="lightShadowBox gradientGray">
                <label class="labelSmallInline">Description: </label>
                <%# DataBinder.Eval(Container.DataItem, "Description") %>
                <label>Path:</label>
                <%# DataBinder.Eval(Container.DataItem, "Path") %>
                <asp:Button runat="server" ID="btnRemove" OnClick="click" Text="Remove" CssClass="standardButton"/> 
            </div>
    </ItemTemplate>
</asp:Repeater>

I am using MVC and WebApi in same project, not using Session in WebApi.

In MVC BaseController I have something along these line

protected const string HOME = "HOME";

protected SessionDataStore SessionDataStore
{
    get
    {
        if ((Session[HOME] != null) && (Session[HOME] is SessionDataStore))
        {
            return (SessionDataStore)Session[HOME];
        }
    }
    set
    {
        Session[HOME] = value;
    }
}


public class SessionDataStore
    {
        public Request CurrentRequest { get; set; }
        public Customer CurrentCustomer { get; set; }
        public List<Salutation> Salutations { get; set; }
        public WebServiceConfiguration CurrentConfiguration { get; set; }
        public List<int> CurrentConfigurationIds { get; set; }
        public List<int> CurrentAttributeIds { get; set; }

public SessionDataStore()
        {
            CurrentRequest = new Request();
            CurrentCustomer = new Customer();
            Salutations = new List<Salutation>()
                              {
                                  new Salutation() { Id = 1, Name = "Mr", },
                                  new Salutation() { Id = 2, Name = "Mrs", },
                                  new Salutation() { Id = 3, Name = "Miss", },
                                  new Salutation() { Id = 4, Name = "Ms", },
                                  new Salutation() { Id = 5, Name = "Dr", },
                                  new Salutation() { Id = 6, Name = "Prof", },
                                  new Salutation() { Id = 7, Name = "Other", }
                              };
            CurrentConfiguration = new WebServiceConfiguration();
            CurrentConfigurationIds= new List<int>();
            CurrentAttributeIds = new List<int>();
        }
    }

In my MVC project, I call the web API and update the Session object like this.

I initialise SessionDataStore in the index page to a new object

var client = new HttpClient(_handler);
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
HttpResponseMessage response = client.GetAsync(string.Concat(GetBaseUrl().AbsoluteUri + "api/request/", requestId)).Result;  

SessionDataStore.CurrentRequest = response.IsSuccessStatusCode ? response.Content.ReadAsAsync().Result : null;

The status code is Success but then I am losing the session. Not sure why this is happening. I am using inProc session

I have a Reports Menu in an ASP.NET MVC5 application. On the Reports Menu, I have an Html.DropDownList showing a list of programs. I want the user to select a program, and then click "Run" and post to something like: Reports/ClassList/14. In other words I want new {id=???} to contain the selected dropdownlist id.

<table class="table">
    <tr>
        <td>Choose a Program:</td>
        <td>@Html.DropDownList("ProgramId", String.Empty)</td>
        <td></td>
    </tr>
    <tr>
        <td>Class List</td>
        <td></td>
        <td>@Html.ActionLink("Run", "ClassList", "Reports", new { id = ???})</td>
    </tr>
</table>

How do I "insert" the selected ProgramId from the dropdown into the link parameters when the page posts?

Do I need to use JavaScript for it?

Thanks,

Sanjeev

I am new on MVC. i m working on system in which i have to add functionality for change password of logged in admin. i did not know how to check which user is logged in. plzz help me through some code snippets. here i adding admin's class

public partial class Admin
    {
        public System.Guid User_Id { get; set; }
        [Required]
        [StringLength(50, MinimumLength = 3)]
        [Display(Name = "Admin Name")]
        public string User_Name { get; set; }
        [Required]
        [StringLength(150, MinimumLength = 4)]
        [DataType(DataType.Password)]
        [Display(Name = "Password")]
        public string Password { get; set; }
        public string Password_Salt { get; set; }
    }

I am trying to pass a query string parameter from one controller to another through RedirectToAction method.

However, my parameter name is something like "abc.Key" but I am not being able specify such a value to RedirectToaction as it gives me error.

My RedirectToAction currently looks like this:

return RedirectToAction("Pending", "SimpleController", 
    new { area = "Area1", Activities.ActivityGroupKey=qstring });

I searched a lot to figure out how it can be done but to no fruits.