So I have a project that requires me to have a third party integration with a commenting service. In the controller I am using a factory that gets the JSON feed for the articles. I have the 3rd party JavaScript code as part of the init() function of the controller, so when each story detail view loads, the comments section refreshes for that story. I am using Routing and Views by reusing the index.html page. So there is a template that is called for article details. That template relies on this controller for which I show code below.

The third party code asks for a unique id for each story passed as part of a "params" options. I am using $routeParams.itemId to supply that unique id + a custom string to identify the section and avoid the same ID being duplicated for another story (as we have 3 feeds), so "Art" for articles, "Vid" for videos etc. What I really want to pass into this unique id option is a value that exists inside my JSON feed which is PostID.

So the JSON would be stories.articles.postId for the current article being viewed. Is there a way to supply that JSON value at this stage? We need to use PostID because we need to maintain the comments in the web site and the comments in this angular app in sync for each article and PostID is a field that can identify them uniquely and is shared between both environments. The Controller code follows:

(function() {

 var DetailsController = function($scope, $http, $routeParams, $sce, dataFactory) {
 storyId = $routeParams.itemId;
 uniqueId = "Art" + $routeParams.itemId;
 nextItem = $routeParams.itemId++;
 $scope.stories = [];

function init() {
  dataFactory.getStories().success(function(stories) {
    $scope.stories = stories.articles;
    $scope.whichItem = storyId; 
    $scope.nextArticle  = nextItem;
    $scope.totalList = stories.articles.length;

      $scope.SkipValidation = function(value) {
          return $sce.trustAsHtml(value);
  .error(function(data, status, headers, config) {
      $log.log(data.error + ' ' + status);

  $scope.todaysDate = new Date();   

  var params ={
    categoryID: 'Articles',
    streamID: uniqueId,
    version: 2,
    containerID: 'commentsDiv',


 DetailsController.$inject = ['$scope', '$http', '$routeParams', '$sce', 'dataFactory'];

   .controller('DetailsController', DetailsController);


I am trying to understand Server sent events in HTML 5

Question 1

Can anybody explain how exactly Server event works. Doest it do polling in the background or like WebSocket its based on Push technology.

Question 2

I have created MVC Action method as follows

public ActionResult Message()
                var result = string.Empty;
                var sb = new StringBuilder();
                sb.AppendFormat("data: {0}\n\n", DateTime.Now.ToString());
                return Content(sb.ToString(), "text/event-stream");


and wrote a javascript code like this

  var o = new EventSource("MyController/Message");
     o.onmessage = function (e) {               

I found that Message action method was executing automatically for every 3 seconds. How to control that time duration

Question 3 How it is different from Web Socket

Question 4 can anybody provide a working example where server is created using Web API

Thanks in advance

I need some help getting the value of a submit button. The code below fires off my controller function, but I am unable to get the value of the 'Invite' button. var_dump states 'bool(false)' and a 0 for Educator_Id is inserted into my final query to the database.

Thanks for any help you can give!

My submit button:

<?php foreach($educators as $educator): ?>
    <button type="submit" id="Invite" name="Invite" value="<?php echo $educator->Educator_Id; ?>">Invite</button>
<?php endforeach; ?>

My jQuery function:

$("#Invite").click(function() {
    var form_data = $('#validation-form').serialize();

        url: "<?php echo site_url('schedule/send_invite'); ?>",
        type: 'POST',
        data: form_data

    return false;

My controller:

function send_invite() {
    $email = $this->input->post('Educator_Email');
    $Opportunity_Id = $this->input->post('Opportunity_Id');
    $Educator_Id = $this->input->post('Invite');
    $Class_Numbers = $this->input->post('Class_Numbers');

    foreach($Class_Numbers as $Class_Number):
        $this->ion_auth_model->update_class_educator($Opportunity_Id, $Class_Number, $Educator_Id);

My model:

function update_class_educator($Opportunity_Id, $Educator_Class, $Educator_Id) {
    $Class = array(
        'Educator_Id' => $Educator_Id

    $this->db->where('Opportunity_Id', $Opportunity_Id);
    $this->db->where('Class_Number', $Educator_Class);
    $this->db->update('Classes', $Class);

I don't understand how to pass this selectListitem in the controller, how to send that to the view ? With return view("MyView", listItems ) ? But it says that listItems doesn't exist in the current context ! Have you an idea ? Thanks

   List<SelectListItem> listItems= new List<SelectListItem>();
   listItems.Add(new SelectListItem
          Text = "Exemplo1",
          Value = "Exemplo1"
   listItems.Add(new SelectListItem
            Text = "Exemplo2",
            Value = "Exemplo2",
            Selected = true
   listItems.Add(new SelectListItem
            Text = "Exemplo3",
            Value = "Exemplo3"

@Html.DropDownListFor(model => model.tipo, listItems, "-- Select Status --")

I'm not proficient in ASP or DNN, but it was assigned to me at work, so I'm pushing through it.

I duplicated a skin on the site and chose it as the active skin, then tore out some of it's "guts" and simply wanted one content block. It was working until I changed the content, now when I try to login as host, it comes back with Login Failed. Please remember that passwords are case sensitive.

Is it possible that I ripped something out that was necessary for it to function? The AJAX call seems to be fine.

Update: I added the login/register links back, and when I clicked on the login link to bring up the form in a modal, logging in from there worked. Weird.

Update 2: I looked at the two AJAX calls, the one from the modal window included


whereas the form from Login.aspx did not.

I have a website which uses Windows Authentication and is working fine on the live and test servers which are using IIS 7.5 on Windows Server 2008 R2. It is also working fine on my development machine when running with IIS Express.

I want to set the website up using IIS 8.5 on my development machine. My problem is, I cannot seem to authenticate with the website. I have double checked the username I use is the same as that displayed when using IIS Express and have played around with a combination of usernames/passwords.

My respective web.config configuration is:

<authentication mode="Windows" />
    <deny users="?" />

i working in a website ( and i am using a template that contain datatable and this the code of the initialisation on this table :

 if ($('body').data('page') == 'products') {

    var opt = {};

     // Tools: export to Excel, CSV, PDF & Print
    opt.sDom = "<'row m-t-10'<'col-md-6'f><'col-md-6'T>r>t<'row'<'col-md-6'><'col-md-6 align-right'p>>",
    opt.oLanguage = { "sSearch": "" } ,
    opt.iDisplayLength = 15,

    opt.oTableTools = {
        "sSwfPath": "assets/plugins/datatables/swf/copy_csv_xls_pdf.swf",
        "aButtons": ["csv", "xls", "pdf", "print"]
    opt.aoColumnDefs = [
          { 'bSortable': false, 'aTargets': [6, 7, 8, 9] }


    var oTable = $('#products-table').dataTable(opt);


    /* Add a placeholder to searh input */
    $('.dataTables_filter input').attr("placeholder", "Search a product...");

    /* Delete a product */
    $('#products-table a.delete').on('click', function (e) {
        if (confirm("Are you sure to delete this product ?") == false) {
        var nRow = $(this).parents('tr')[0];
        // alert("Deleted! Do not forget to do some ajax to sync with backend :)");


i want to add a filter type select (drop down box)for a specicfic column. any help?

I am trying to write a simple relative tables webpage in, which should show records from first table (achieved already) and after clicking on one of them, user is to be redirected to another page, showing him content of second table related to record he chose.

I want to know these things:

  • Is it possible to send information from cshtml to another cshtml without using php (highly prefered)
  • Is it possible to join php and cshtml?
  • If neither of those are, do you perhaps know a way to create a table in php and fill it with SQL Server's database data (similary to cshtml's "@foreach(var row in db.Query(QueryString)")?

I am grateful in advance for any response.

I have a HTMLEditorExtender on my page and when I try to access the .Text of the textbox that it references on button click (postback) it comes back blank.

For some strange reason it clears the textbox on postback.

<asp:TextBox runat="server" ID="txtDescription" Width="1000px" Height="600px" 
                                TextMode="MultiLine" Rows="100" ReadOnly="true"></asp:TextBox>
                            <ajax:HtmlEditorExtender runat="server" ID="hexDetails" TargetControlID="txtDescription" EnableSanitization="false"></ajax:HtmlEditorExtender>

In code behind:

protected void btnSubmit_Click(object sender, EventArgs e)
            string stringIWant= HttpUtility.HtmlDecode(txtDescription.Text);

So stringIwant is always ""

Any idea what's going down? The textbox is in UpdatePanel if that makes any difference.

I'm new to (Visual Studio 2010, .NET 3.5) and I would like to do the following:

I am using OperationContracts to provide webservice data as JSON. A mobile app written in angularJS is consuming these JSON responses.

I would like each OperationContract response to be the relevant data object wrapped by a standard response object.


  error: false,
  error_detail: '',
  authenticated: false,
  data: { }

Within the data variable will be whatever is required of each individual request type.

The mobile app checks the relevant variables and if all is OK, passes on the data to whatever requested it (this part is working and ready).

I know it's often frowned upon, but I had hoped to basically return an anonymous object because I can easily construct an anonymous object and stuff in whatever data I require, but it seems I am forcefully denied the ability to do this. Ideally I do not want to add another layer of de-serialization or something on the mobile app side, I want to do as little processing as possible client side.

I was very easily able to get this working as required with my own test Web API project (see example controller below), but unfortunately I am adding to an existing project, not starting a new one.

Can anyone offer any advice?

Example Web API Code

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;

namespace tut3.Controllers
    public class ValuesController : ApiController

         * Take the provided dataResponse object and embed it into
         * the data variable of the default response object
        private object Response(object dataResponse)
            return new
                success = false,
                error = "",
                error_detail = "",
                authenticated = false,
                token = "",
                token_expiry = 0,
                data = dataResponse

         * This could be a normal web service that uses the Knadel database etc etc, the only difference is
         * the return is sent through the Response() function
        public object Get()

            object[] local = new[] { 
                new { cat = "cat", dog = "dog" }, 
                new { cat = "cat", dog = "dog" }, 
                new { cat = "cat", dog = "dog" }, 
                new { cat = "cat", dog = "dog" }, 
                new { cat = "cat", dog = "dog" }

             * Pass local to Response(), embed it in data and then return the whole thing
            return Response(local);



I have made an application that successfully display the files in folder in a asp:GridView and allows the user to download.

Here is my code behind:

string[] filePaths = Directory.GetFiles(Server.MapPath(strDirectory));
List<ListItem> files = new List<ListItem>();
foreach (string filePath in filePaths)
    files.Add(new ListItem(Path.GetFileName(filePath), filePath));
GridView1.DataSource = files;

Here is my GridView

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false" 
EmptyDataText = "No files uploaded" CssClass="mGrid" PageSize="20" 
AllowPaging="True" AlternatingRowStyle-CssClass="alt"
OnPageIndexChanging="GridView1_PageIndexChanging" PagerStyle-CssClass="pgr">
    <asp:BoundField DataField="Text" HeaderText="File Name" />
            <asp:LinkButton ID="lnkDownload" Text = "Download" 
            CommandArgument = '<%# Eval("Value") %>' runat="server" 
            OnClick = "DownloadFile"></asp:LinkButton>

What I want to do now is add the date modified in a gridview column so that my users will have an easier time finding the correct documents customers call about. How do I go about this?

I am using windows From application as client and MVC as a server Now i want to send some data from windows application to MVC application using SignalR what should I do, currently i am using this code -

          var connection = new HubConnection("http://localhost:56628");
           //Make proxy to hub based on hub name on server
            var myHub = connection.CreateHubProxy("realTimeJTableDemoHub");
            //Start connection
            connection.Start().ContinueWith(task =>
                if (task.IsFaulted)


myHub.Invoke<string>("ReSend", "HELLO World").ContinueWith(task =>
                if (task.IsFaulted)
                    MessageBox.Show("Successfully Connected");

From some reason the RequiredFieldValidation doesn't work with asp:DetailsView:

<asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False"
        CellPadding="4" DataKeyNames="Id" DataSourceID="EntityDataSource1"
        DefaultMode="Insert" ForeColor="#333333" GridLines="None"
        Height="50px" Width="125px" OnItemInserted="DetailsView1_ItemInserted">
        <AlternatingRowStyle BackColor="White" />
        <CommandRowStyle BackColor="#D1DDF1" Font-Bold="True" />
        <EditRowStyle BackColor="#2461BF" />
        <FieldHeaderStyle BackColor="#DEE8F5" Font-Bold="True" />
            <asp:BoundField DataField="Id" InsertVisible="false" HeaderText="Id" ReadOnly="True" SortExpression="Id" />
            <asp:BoundField DataField="First_Name" HeaderText="Name" SortExpression="First_Name" />
            <asp:BoundField DataField="LastName" InsertVisible="false" HeaderText="LastName" SortExpression="LastName" />
            <asp:BoundField DataField="Gender" HeaderText="Gender" SortExpression="Gender" />
            <asp:TemplateField HeaderText="Salary" SortExpression="Salary">
                    <asp:TextBox ID="salaryTB" runat="server" Text='<%# Bind("Salary") %>' ValidationGroup="DetailsViewValidation"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="rfvSalary" runat="server" ControlToValidate="salaryTB"
                        InitialValue="0" Display="Dynamic" ErrorMessage="ss" SetFocusOnError="true" ValidationGroup="DetailsViewValidation"></asp:RequiredFieldValidator>
            <asp:BoundField DataField="JobTitle" InsertVisible="false" HeaderText="JobTitle" SortExpression="JobTitle" />
            <asp:CommandField ShowInsertButton="True" />
        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
        <RowStyle BackColor="#EFF3FB" />

I tried everything I could think of, and, naturally, I searched it online. When I click on Insert, the value (0) is simply inserted, no questions asked.

How to display crystal report on web page??? I am using MVC4 razor view and wanted to display crystal report inside the div tag. And I am using visual studio 2010.

Thanks in advance.

I had a razor view with inline javascript which with time has become messy, and now I am moving all js (except some minimal initialization code) to external typescript file. It would be nice to make the js code reusable, but it is very much specific to this particular view. The js code depends heavily on many html elements. What I have is something like this:

module MyModule{

export class SomeClass{

    private $counter: any;
    private $answers: any;
    private $pager: any;
    private $anotherSelector1:any;
    private $anotherSelector2:any;
    private $anotherSelector3:any;
    private $anotherSelector4:any;
    private someId: number;

    constructor(public options: any) {



    private init(options) {
        //setup objects, callbacks, other init code

and I call it from my cshtml file like this:

 $(document).ready(function () {

        var instance = new MyModule.SomeClass({
            $counter: $('#something'),
            $answers: $('#something'),
            $pager: $('#something'),
            //code omitted for brevity
            someId: "@Model.SomeId",



It seems to me that even though this approach will result in a more clean razor view, the typescript file will still have many dependencies to the html DOM. Am I doing it right? Should I consider refactoring the html in the view as well? Also, should I move the init code in the cshtml file to the ts file as well or should I leave it like it is? I am kind of looking for best practices when doing refactorings like this.

I am using ASP.Net Web form in my MVC 5 application.

I want to use my Razor view layout in the ASP.Net web form. How can i do that?

How to save chosen value in dropdownlist after submit. So the value that you choose in dropdownlist stays after user click on submit.

In my controller I did this:

List<SelectListItem> uraList = new List<SelectListItem>();

for (int i = 1; i < 7; i++)
    uraList.Add(new SelectListItem
        Value = i + ":00",
        Text = i + ":00"

ViewBag.IzberiUro = uraList;
ViewBag.IzbranaUra = model.Ura; 

In my Model (I think that here is mistake):

public string Ura { get; set; }

And in View I have:

@Html.DropDownList("Ura", ((IEnumerable<SelectListItem>)ViewBag.IzberiUro).Select(t => new SelectListItem() {Text = t.Text, Value = t.Text,Selected = (t.Text == ViewBag.IzbranaUra)}), new {@class = "css"})

The result is, in view I have dropdownlist with values from 1:00 to 6:00 (whitch is correct, and first choosen value is 1:00), but, when I choose e.g. 4:00 and click on submit, the value in dropdown returns to 1:00.

Realy thanks for help.

I want to know some opinion to take below decision.

Going to create new application which has following functionality:

  • Add, edit , delete for master screen
  • Future, there can be functionality like - export to excel, show charts (as like Microsoft chart controls), Crystal Reports.

Can any one suggest me what should I choose - Plain ASP.NET Web application or ASP.NET MVC 4 framework ?

Will it be any limitation to have same functionality of chart control of to have in MVC.

IN same view page, I may need to have chart control to show.

Please guide me.


I am displaying 2 images side by side in my webpage. I am trying to keep a space in between the 2 images but i am unable to do it. I have used css to display the images side by side.

Here is my Html Code :

 <div id="divCenter">

       <img src="Company Logo.jpg" alt="Company Logo" style="width:150px;height:150px" id="divIDOne"/>

          <%-- Code for the motion image --%>

      <object type="application/x-shockwave-flash" data="animation.swf" width="719" height="174" id="divIDTwo">
      <param name="movie" value="animation.swf" />


Here is my css code :

 #divCenter {
    text-align: center;

 #divIDOne {
     margin-right: 200px;

 #divIDTwo {
     margin-left: 300px;

Here is what it displays :

enter image description here

Ask you can see there is no space between the 2 images. How do i solve this problem?

Thank you for your time

I was trying to attach an elapsed time to every post of my comments that are displayed on my gridview control. This is a part of my comment section page that I'm working right now.

So I came up with using ajax timer control and I coded and test my Timer_Tick() event handler in a dummy page to create a running clock so I can get the values of the elapsed time like "just a few seconds ago", "8 minutes ago", "2 hrs ago", "Yesterday at 10:00 A.M." and so on. I guess you figure out now what I mean just like posting at Facebook you will see the time elapsed from each post. I only use one timer control when I was testing on the dummy page and was working fine I was able to get those time elapsed values and the clock is running fine. Now, when I embedded the timer control in my gridview where all my comments resides the problem I encounter is it's only the top row will have the time elapsed value displayed but the previous rows are empty. So everytime you enter a new comment its only the last comment will display the elapsed time running and the rest are empty. Any suggestions on how to do this properly?... Thanks

Here's the source code of my gridview:

<asp:GridView ID="gvParentGrid" runat="server" Width="395px" 
AutoGenerateColumns="False"  GridLines="None" BorderStyle="Solid" BorderWidth="0px" OnRowCommand="gvParentGrid_RowCommand"
            BorderColor="White" DataKeyNames="ID" onrowdatabound="gvParentGrid_RowDataBound"  EnableModelValidation="True"  >

<asp:TemplateField >

      <td id ="comment" onmouseover="highlightBG(this, '#CCCCFF');highlightNext(this, 'black')" onmouseout="highlightClear(this, 'white')" class ="highlightab" style ="border-bottom :2px solid gray;border-bottom-color :#C0C0C0; border-left :0px; border-left-color :White; border-right :0px; border-right-color :White; border-top :0px; border-top-color :White;background-color :White;border-bottom :2px solid gray; border-left :0px; border-left-color :White; border-right :0px; border-right-color :White; border-top :0px; border-top-color :#C0C0C0;background-color :White; height :100px; width :405px; margin-top:-5px; margin-bottom :0px">              
           <div id ="Closebtn" class ="Close" style="width:500px; display :none;"><asp:Button ID="Button3" runat="server" Text="X" style =" cursor:pointer; margin-left :470px; border:0px; background-color :White; color :blue; font-weight :bold; " ToolTip="Delete" /></div>

        <div style="width:435px">
            <asp:Timer ID="Timer1" runat="server" OnTick="Timer1_Tick" Interval="1000"></asp:Timer>   <asp:Label ID="Label10" runat="server" Text="Time Elapsed/Date" CssClass="date" Font-Size="Smaller" Font-Names="Verdana"></asp:Label></div>

          <asp:Image ID="Image1" runat="server" style="  margin-right :5px; background-image :url('Image/blankpeople.png');"  ImageAlign ="Left" Height ="60px" Width="60px" />
            <asp:Label ID ="ComID" runat ="server" style="display :none" Text =' <%#Eval("ID") %>' />
           <asp:Label ID="name" runat="server" style="font-weight :bolder; color :Blue; "  Text='<%# Eval("Name")%>' ></asp:Label>
        <p id ="content" class="comment more" style ="font-family:Verdana; font-weight:normal;font-size:small; border-radius: 4px 4px 4px 4px; max-width :395px; min-height :5px; margin-top :5px; margin-bottom :0px; margin-left :65px; display :block; background-color: #CCCCFF;"> <%# DataBinder.Eval(Container.DataItem,"Comments").ToString().Replace("\n", "<br />") %> </p>
         <div style="width:435px;margin-left :65px;">
         <div style=" width:200px;float:left">
           <a href="JavaScript:divexpandcollapse('div<%# Eval("ID") %>');" style =" margin-top :1px; text-decoration :none " >
            <input id='btndiv<%# Eval("ID") %>' type="button" class ="btndivname" value="Reply" style =" border:0px; background-color :inherit; color :blue; cursor :pointer; "  />
            <asp:Label ID="Label8" runat="server" Text='<%#Eval("Like") %>'>' Font-Size="Smaller" Font-Names="Verdana"></asp:Label>
            <asp:ImageButton ID="ImageButton1" onclick="ImageButton1_Click" runat="server" ImageUrl="~/Image/thumb-up-icon.png"  ImageAlign="Top"  />
           &nbsp; &nbsp;
             <asp:Label ID="Label9" runat="server" Text='<%#Eval("Dislike") %>'>' Font-Size="Smaller" Font-Names="Verdana"></asp:Label> 
            <asp:ImageButton ID="ImageButton2" onclick="ImageButton2_Click" runat="server" ImageUrl="~/Image/thumb-down-icon.png"  ImageAlign="Top" />
          <div style="width:170px;float:right">
          &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <asp:Label ID="Label7" runat="server" Text="Report As" Font-Size="X-Small" Font-Names="Verdana"></asp:Label> <asp:DropDownList ID="DropDownList1" runat="server" ToolTip="Report Comment As" Width="20px" AutoPostBack="True"> <asp:ListItem>Profanity</asp:ListItem>
          <asp:ListItem>Threat </asp:ListItem>
         <asp:ListItem>Copy Infringement </asp:ListItem> 
         <asp:ListItem>Child Pornography </asp:ListItem> 




  <!--This is the child gridview -->
<div id="div<%# Eval("ID") %>" style="display:none; position:relative; left: 65px; overflow: auto; margin-top :5px;margin-bottom:5px">
      <asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="false">
<asp:GridView ID="gvChildGrid" runat="server" AutoGenerateColumns="false" BorderStyle="Double"  BorderColor="white" GridLines="None" Width="325px" onrowcommand="gvChildGrid_RowCommand"  EnableModelValidation="True" onrowdatabound="gvChildGrid_RowDataBound">
<Columns >
<asp:TemplateField >
<ItemTemplate >
<tr >
  <td style ="margin-top:0px; border-bottom :2px solid Blue;border-bottom-color :Gray; border-left :0px; border-left-color :White; border-right :0px; border-right-color :White; border-top :0px; border-top-color :White;background-color :White; height :100px; width :325px"> 
 <asp:Image ID="Image1" runat="server" style=" margin-right :5px; background-image :url('Image/imagebackground.png');"  ImageAlign ="Left" Height ="60px" Width="60px" />

 <asp:Label ID="name" runat="server"  Font-Bold="True" Text='<%# Eval("Name")%>' ForeColor="Blue"></asp:Label>

 <p id ="content2" class="comment more" style ="font-weight:lighter; font-size:xx-small; border-radius: 4px 4px 4px 4px; max-width :325px; min-height :5px; margin-top :5px; margin-left :65px; display :block; background-color: #CCCCFF; font-size :small"> <%# DataBinder.Eval(Container.DataItem,"Replies").ToString().Replace("\n", "<br />")  %> </p>




      <!-- This is the inputbox and the reply button -->
<asp:Label ID="Label3" runat="server" Text="Name"></asp:Label>
   <br />
  <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
  <br />
  <asp:TextBox ID="TextBox4" Height ="200px" Width ="325px"  TextMode ="MultiLine" CssClass="norez" runat="server" AutoPostBack="True"></asp:TextBox>
  <br />
      <div style="width:325px">
    <div style="float:left;width:100px">
  <asp:Button ID="Button2" runat="server" Text="Post Reply" OnClick="Button2_Click" OnClientClick="return ShowProgress2()" />
        <div align="center" style="float:right;width:225px"> 
    <asp:UpdateProgress ID="UpdateProgress2" runat="server"  DisplayAfter="1" AssociatedUpdatePanelID="UpdatePanel2" >
        <img id="Img1" runat="server" src="Image/loading.gif" alt="wait image" style=" height:40px; width:40px; text-align:left" />&nbsp; <b>Processing Request...</b></ProgressTemplate>
  <asp:AsyncPostBackTrigger ControlID="Button2" EventName ="Click" />




I needed to set the padding for text box controls in my ASP.NET web forms application because the were rendering inconsistently with Dropdownlist controls on the browser. The Dropdownlists had some padding between the text and the border and the Textboxes did not have any.

Visual Studio does not provide a direct padding property for controls so trying to set/change padding for controls like Textboxes and Dropdownlists can be very frustrating. After a lot of searching without any getting any useful solutions i was able to do it. See Answer below.