Go Premium for a chance to win a PS4. Enter to Win

x

ASP.NET

124K

Solutions

28K

Contributors

The successor to Active Server Pages, ASP.NET websites utilize the .NET framework to produce dynamic, data and content-driven web applications and services. ASP.NET code can be written using any .NET supported language. As of 2009, ASP.NET can also apply the Model-View-Controller (MVC) pattern to web applications

Share tech news, updates, or what's on your mind.

Sign up to Post

I've got a VB 2015 / ASP app that features a Gridview  displaying 6 columns of data via a SQL query.
I wish to add a new column at runtime, and poke in a text string based off cell text in column1(0 based)
Here's what my aspx Gridview section looks like:
         
   <asp:GridView ID="GridView1" runat="server" AllowSorting="True" AutoGenerateColumns="False" DataSourceID="SqlDataSource1" Height="486px" Width="661px">
                <columns>
                    <asp:BoundField DataField="spid" HeaderText="spid" SortExpression="spid" />
                    <asp:BoundField DataField="Login" HeaderText="Login" ReadOnly="True" SortExpression="Login" />
                    <asp:BoundField DataField="DB" HeaderText="DB" ReadOnly="True" SortExpression="DB" />
                    <asp:BoundField DataField="SERVER" HeaderText="SERVER" SortExpression="SERVER"/>
                    <asp:BoundField DataField="LOGIN TIME" HeaderText="LOGIN TIME" ReadOnly="True" SortExpression="LOGIN TIME"/>
                    <asp:BoundField DataField="USER COUNT" HeaderText="USER COUNT" ReadOnly="True" SortExpression="USER COUNT"/>
                    <asp:TemplateField HeaderText="SITE"   runat="server"></asp:TemplateField>
                </columns>
            </asp:GridView>

Open in new window


In my code behind, I have a For loop where I'm doing some gridview manipulation such as cell coloring..etc
and I thought maybe I could do something similar to:
For i = 0 To GridView1.Rows.Count - 1
nameToCheck = GridView1.Rows(i).Cells(1).Text
nameToCheck = nameToCheck.Trim()

If nameToCheck = "MYNAME" Then GridView1.Rows(i).Cells(5).Text = "ME"

Open in new window


Here's a snippet of what the grid looks like at runtime:
Capture.PNG
I want to query cell#2 for a value, and depending on the result, poke some text into my new column/cell...
make sense?
Am I even remotely close??
Rich
0
Concerto Cloud for Software Providers & ISVs
LVL 5
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

I have a web application in asp.net where i'm using JavaScript Popups. On one popup i have a Link which redirect me to new popup.
Now situation is when i close that new popup i can see my old popup on screen in IE11 but this is not working in chrome. In chrome link on popup redirect me to new popup but my old popup get minimized.  So when i close new popup i need to search my old popup on task bar.

i want this to work same as IE11. Please give some solution.
0
in my case i use more than form tag in usercontrol and each form has some controls with validations and the validation works fine but when i try to call codebehind method the button don't fire the event

here is example of my code in user control
<form data-toggle="validator" role="form">


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






<div class="form-group">
<label for="DDL_Comp_Baladya">البلدية</label>
<select class="form-control" id="DDL_Comp_Baladya" runat="server">
</select>
</div>


<div class="form-group">
<label for="DDL_Comp_Baladya">الإدارة</label>
<select class="form-control" id="DDL_Comp_Management" runat="server">
</select>
</div>




<div class="form-group">
<label for="txt_Comp_Name" class="control-label">الاسم</label>
<input type="text" class="form-control" id="txt_Comp_Name" runat="server" placeholder="الاسم" data-required="عفواَ من فضلك ادخل الاسم !!" required>
</div>


<div class="form-group has-feedback">
<label for="txt_Comp_Phone" class="control-label">الهاتف</label>

<input type="text" pattern="[0-9]+" title="" maxlength="10" class="form-control" id="txt_Comp_Phone" runat="server" placeholder="الهاتف">
</div>


<div class="form-group has-feedback">
<label for="txt_Comp_ID" class="control-label">السجل المدني / الأقامة</label>

<input type="text" pattern="[0-9]+" title="" maxlength="10" class="form-control" id="txt_Comp_ID" runat="server" placeholder="السجل المدني / الأقامة" required>
</div>


<div class="form-group 

Open in new window

0
I have xml file and I want to load the xml using JavaScript datatable

https://editor.datatables.net/examples/advanced/REST.html

Do you know how to do that?
0
I have a web service pushing vfp data (oledb dataset) from server A to an asp.net app's gridview on server B.
The date fields showing up in the grid are ALL the previous date. For example, the raw data is 11/20/2017, yet the gridview will show 11/19/2017. I also tried with the asp.net app installed on a completely different server, on a different network. I get the same results.  
However, if I call the web service from server A to my asp.net dev PC, I get the proper dates showing up.
I've tried coding the webservice using both ODBC and oledb and the results are the same. Any ideas?
0
In .net environment on a server with .net framework 4.5.2 installed , web api's are hanging and resulting in time out when the web config is introduced with a extra attribute of targetfarmework as 4.5, this was done for utilising the async features. however the same piece of api's work fine if no targetframework is mentioned in the config. Appreciate you expert advise on the cause & remedy to it.

Rgds,
0
Hi,
To the prompt, after having pressed Password button below. I expect the password strength to be shown, exactly after having input two password (but before Submit button is pressed). What to adjust?
http://my-friend.co/UserMaintenance2/Default.aspx?userid=mc23&readonly=n
0
HI guys,
I have asp.net application and have button which is implemented on the server side.

<asp:TextBox ID="txtObject" onfocus="this.select();" runat="server" AutoPostBack="True" CssClass="form-control"></asp:TextBox>

Open in new window


I would like to fire this textbox just when user click ENTER key = 13, for now I used the method onchange "txtObject_TextChanged" as it is the only option i have in asp.net.

The issue I have is if I change anything in the textbox it postback and I would like to postback just when I press enter in the textbox.

I also tried to setup the  AutoPostBack to false and It didn't worked for me as if you set it to false the enter key will not work as well.

please any suggestions.

Thank you.
0
I have a simple Gridview and Formview set up on a couple of different pages. I use the FormView to edit existing records in the GridView or to add a new record. It works perfectly on one page, but on another one when I select the record in the Gridview that I want to edit in the FormView, I keep getting this error message:
'DropDownList1' has a SelectedValue which is invalid because it does not exist in the list of items.
Parameter name: value

Open in new window

I can run SELECT DISTINCT WHS FROM AER_DOCK_APPOINTMENTS and I get three returned entries, each two characters long. In the DropDownList on the page, I have those same three two-character long choices as ListItems. The Insert from the FormView works perfectly.

CODE FOR DROPDOWN ON PAGE THAT WORKS
<asp:DropDownList ID="DropDownList1" runat="server" SelectedValue='<%# Bind("WAREHOUSE") %>'>
                                <asp:ListItem Selected="True"></asp:ListItem>
                                <asp:ListItem>LB</asp:ListItem>
                                <asp:ListItem>LP</asp:ListItem>
                                <asp:ListItem>SN</asp:ListItem>
                                <asp:ListItem>SS</asp:ListItem>
                                <asp:ListItem>WA</asp:ListItem>
                            </asp:DropDownList>

Open in new window


CODE FOR DROPDOWN ON PAGE THAT DOES NOT WORK
<asp:DropDownList ID="DropDownList1" runat="server" SelectedValue='<%# Bind("WHS") %>'>
                                <asp:ListItem Selected="True"></asp:ListItem>
                                <asp:ListItem>LB</asp:ListItem>
                                <asp:ListItem>SN</asp:ListItem>
                                <asp:ListItem>SS</asp:ListItem>
                            </asp:DropDownList>

Open in new window


What am I missing to figure this out?
0
i am facing issue i have radiobutton with different time slot and i want to disable radio button list item if system current time is more than radiobutton list item.
 
I am getting error input string is not in correct format..
 
What I have tried:
 
<pre>  string id = Request.QueryString["id"];
        txtdate.Text = Calendar1.SelectedDate.ToShortDateString();
        Calendar1.Visible = false;
       
      //  DateTime txtMyDate = DateTime.Parse(txtdate.Text);
        SqlConnection cnn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
        string Query = "select slot from appoint where selectdate = @date and doc_id='"+id+"'";
        SqlCommand cmd = new SqlCommand(Query, cnn);
        cmd.Parameters.AddWithValue("@date", txtdate.Text);
        DataTable dtAdmin = new DataTable();
        SqlDataAdapter da = new SqlDataAdapter(cmd);
        da.Fill(dtAdmin);
        if (dtAdmin.Rows.Count > 0)
        {
            string[] slots = dtAdmin.Rows.OfType<DataRow>().Select(k => k["slot"].ToString()).ToArray();
            string time = DateTime.Now.ToString("HH:mm tt");
 
            foreach (ListItem item in RadioButtonList1.Items)
                if (slots.Contains(item.Text) && Convert.ToInt32(item.Text) < Convert.ToInt32(time))
                {
               
                        item.Enabled = false;
                   
                }
                else
                {
         …
0
Concerto's Cloud Advisory Services
LVL 5
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

When I select the save button in tab 2 , the focus does not stay in tab 2 but instead it jumps back to tab 1.
Here's the code..
<div id="myTabs">
            <ul class="nav nav-tabs tabs" id="thistab" runat="server">

                <li class="tab-link current" data-tab="tab1" id="tab11" data-toggle="tab" title="Person" onclick="return setText('lblSelect',this.title);"><a href="#tab1">Person</a></li>

                <li class="tab-link" data-tab="tab-6" id="tab6" data-toggle="tab"><a href="#tab6" onclick="return setText('lblSelect',this.title);" runat="server" title="Employee">Information</a></li>
                <li class="tab-link" data-tab="tab-2" id="tab2" data-toggle="tab"><a href="#tab2" onclick="return setText('lblSelect',this.title);" title="Assignment">Assignment History</a></li>
                <li class="tab-link" data-tab="tab-3" id="tab3" data-toggle="tab"><a href="#tab3" onclick="return setText('lblSelect',this.title);" title="Issues">Issues</a>
                    <ul class="tabs show-on-hover" id="ulIssue">


                        <li class="tab-link" data-tab="tab-8" id="tabs-8"><a href="#tabs-8" title="New Issue" onclick="addlocation('RedIssue.aspx')">New Issue</a>

                        </li>


                    </ul>
                </li>
                <li class="tab-link" data-tab="tab-4" id="tab4" data-toggle="tab"><a href="#tab4" onclick="return setText('lblSelect',this.title);" title="PPC">PPC</a></li>
                <li 

Open in new window

0
Hi
i have a hibernate entity class
class task

private tasktemplate

class tasktemplate
private contactinfo

now when i fetch a task.
i do get the tasktemplate object.
but the contactinfo i get as null.

whereas if i fetch the tasktemplate directly then i do get the contactinfo object.
this contactinfo is a custom type which i am storing as json.
what could be the reason for this that when i am fetching it directly i get the proper data and when its inside as a reference a foreign key then i get it as null.
also this is only for custom types
there are other attributes in tasktemplate like normal string etc. they do get fetched.
i am using hibernate here

thanks
0
I am looking for how to properly move an ASP.NET website to a VS2013 website project or website application?

Thanks,
Andrew
0
Hi,

Once again coming from a beginner perspective so I can start to do some reading for curiosity.

I know that ASP.NET core web apps have to handle things to handle different screen sizes. For example a client might
browse from a phone or a PC or a tablet.

How is this detected and handled basically.

What term should I be looking for in the documentation and tutorials to see how this is approached.?

Also really to ask how difficult this is to code and handle in general.

Thanks,

Ward
0
Hi,

Can an ASP.NET Core app support reading and writing to an access database? BTW this would be a ASP.Core app running on a Linux host.

https://blogs.msdn.microsoft.com/dotnet/2016/11/09/net-core-data-access/

I assume it cant but wanted to double check in case there is another way.

Thanks,

Ward
0
Hi Experts,

I am using below C# code to remotely login to a machine in domain say D2 from my local machine in domain D1. When i use MSTSC and pass correct credentials, I am able to get into. But using below code, I get inner exception "Access Denied" and parent exception as  "Could not connect to remote machine". I am able to ping remote machine from my machine and also ensured that remote registry servcie is up and running on remote machine.The accounts are different for my local and remote machine. What am i missing? If its access of local machine or local account on remote, what exact steps need to be followed to get it done.


using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 public static class ProcessExtensions
    {
        public static void KillRemoteProcess(this Process p, string user, string password)
        {
            new Process
            {
                StartInfo = new ProcessStartInfo
                {
                    FileName = "TaskKill.exe",
                    Arguments = string.Format("/pid {0} /s {1} /u {2} /p {3}", p.Id, p.MachineName, user, password),
                    WindowStyle = ProcessWindowStyle.Hidden,
                    CreateNoWindow = true
                }
            }.Start();
        }

        public static void KillProcessesRemote()
        {
            string targetProcessName = "EXCEL"; //Do not put…
0
Hi, Im getting following error Messages

HTTP Error 500.21 - Internal Server Error
Handler "ExtensionlessUrlHandler-Integrated-4.0" has a bad module "ManagedPipelineHandler" in its module list

I have run following command  no results

c:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -I


%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -i
0
Hi, I need to install C# Application the Network sharing place. Then all the users to access the EXE file.
without installing all the user's machine individually. How to do that.
Many Thanks
0
Hi,
i am using this code display Response in new link...
i want Response in string

My Code is :-

void PostMe(Object sender,EventArgs e){
		RemotePost myremotepost =  new RemotePost();
        myremotepost.Url = "http://www.xyz.in/abcd.aspx";
        myremotepost.Add("txtuu", "15470038610");
		
		myremotepost.Post();
	}


public class RemotePost{
			private System.Collections.Specialized.NameValueCollection Inputs = new System.Collections.Specialized.NameValueCollection();


			public string Url = "";
			public string Method = "post";
			public string FormName = "form1";
			
			public void Add(string name,string value){
				Inputs.Add(name,value);
			}
			
			public void Post(){

                System.Web.HttpContext.Current.Response.Clear();

                System.Web.HttpContext.Current.Response.Write("<html><head>");

                System.Web.HttpContext.Current.Response.Write(string.Format("</head><body onload=\"document.{0}.submit()\">", FormName));
                System.Web.HttpContext.Current.Response.Write(string.Format("<form name=\"{0}\" method=\"{1}\" action=\"{2}\" >", FormName, Method, Url));
                for (int i = 0; i < Inputs.Keys.Count; i++)
                {
                    System.Web.HttpContext.Current.Response.Write(string.Format("<input name=\"{0}\" type=\"hidden\" value=\"{1}\">", Inputs.Keys[i], Inputs[Inputs.Keys[i]]));
                }
                System.Web.HttpContext.Current.Response.Write("</form>");
            

Open in new window

0
Free Tool: Subnet Calculator
LVL 11
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Hello,

Hello, i am creating ASP.net application using web browser my application locally working fine after that hosting this application in our server ... application not working not showing any data and no error show...
1. web browser control permission problem in my VPN windows server 2012 r2?
 2. web browser control install windows server 2012 r2 ?
3. how to permit this control in our VPN windows server 2012 r2 ?
0
I'm uploading a file, using an asp FileUpload control but want to change the default text after a successful upload. When the control/page renders the default text is: "No file selected". It also defaults to this after the successful upload. I'd like to change it to something else if that's possible? Thanks.

<asp:FileUpload ID="flupldIAAPhotos" runat="server" />

Open in new window

0
Hi,
I am having default.aspx page. This page contains two iframes. Left iframe is having tree. clicking on parent or child nodes will open diferent pages in the right iframe. User can add or edit information using right iframe and it will reflect in the left iframe. making changes in the firames doesn't refresh the default.aspx.

Session Timeout 15 minutes.
Warning Popup appears at 13  minutes. clicking ok on dialog. user can continue to do the work till 2 more minutes and it will redirect to session timeout page.

Problem: Warning popup appears at 13 minutes. clicking ok on dialog. user is doing some activity and click submit on iframe2. This will reset the session timeout again back to 15 minutes. This part is not working.
If I refresh the default.aspx then session timeout is resetting, but refreshing the iframes not reset the session timeout. Please find my code and fix the issue. I am stuck in this issue.

[b]default.aspx[/b]
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="default.aspx.cs" Inherits="default" MasterPageFile="~/Masterpage.Master"%>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp"%>
 
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">
 
    <div class="container">
      <iframe id="frameName1" src="index.aspx" frameborder="0" class="indexframe" ></iframe>       
      

Open in new window

0
Actually i need to create bookappointment page of each doctor  who register to my website, and when I  generate URL then use only book appointment page URL to each doctor website..
0
Hi I am using asp.net application and I am using asp:menu. At one point I am disabling menu but on IE11 and chrome It still looks like active(It's not clickable but color looks same), I tried to change menu color from codebehind but when It switch back to that menu as enabled then it doesn't work properly,How I can fix this problem?

Regards,
Sudhanshu
0
Hi, my asp.net code working fine from local machine  but after hosting this page on server not getting data
please help...


MY CODE IS -:

 private void CallBatocTransIndia()
        {

            string url = "http://www.XYZ.in/";
            
            Thread thread = new Thread(delegate()
            {
                using (WebBrowser browser = new WebBrowser())
                {
                    browser.ScrollBarsEnabled = false;
                    browser.AllowNavigation = true;
                    browser.Navigate(url);
                    browser.Width = 1024;
                    browser.Height = 768;
                    //browser.Document.GetElementById("txtLrNo").SetAttribute("value", "15470038610");
                    //browser.Document.GetElementById("ImageButton1").InvokeMember("click");
                    browser.ScriptErrorsSuppressed = true;

                    browser.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(DocumentCompleted);
                    browser.ProgressChanged += new WebBrowserProgressChangedEventHandler(ProgressChanged);
                    while (browser.ReadyState != WebBrowserReadyState.Complete)
                    {

                        System.Windows.Forms.Application.DoEvents();

                        //gg.InnerHtml = browser.Document.Body.InnerHtml;
                    }
                }
            });
            thread.SetApartmentState(ApartmentState.STA);
            

Open in new window

0

ASP.NET

124K

Solutions

28K

Contributors

The successor to Active Server Pages, ASP.NET websites utilize the .NET framework to produce dynamic, data and content-driven web applications and services. ASP.NET code can be written using any .NET supported language. As of 2009, ASP.NET can also apply the Model-View-Controller (MVC) pattern to web applications