C#

92K

Solutions

25K

Contributors

C# is an object-oriented programming language created in conjunction with Microsoft’s .NET framework. Compilation is usually done into the Microsoft Intermediate Language (MSIL), which is then JIT-compiled to native code (and cached) during execution in the Common Language Runtime (CLR).

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

Sign up to Post

On Import.aspx. how can i capture leadSource paramter?
Should I use Request.querystring or Request.form?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>

</title></head>
<body>
<form method="post" action="http://www.google.com/import.aspx?leadSource=Test_Source" id="form1">
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwULLTE2MTY2ODcyMjlkZBHuFX8tPKjcuMr1eVYWRaIvHmGMi62hWdWUK6yz/WIY" />

<div>

</div>
</form>
</body>
</html>

Open in new window

0
Technology Partners: We Want Your Opinion!
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

In my vb.net winforms .NET application I need to merge two different datatables that each have a field they match on. One is the parent, one is the child. The child has more rows. In Master Table the field to match is "Rec_ID". In the child table the field that matches Rec_ID is "Order ID". They tables have already been populated with data at the time to make the match. Merge does not work as the schemas of the tables are quite different. Relations do not work with tables populated after the fact. I am going nuts here. Thank you.
0
Code is below

how do i combind the two buttons into one When i press get Token after getting the string i want to pass it to the form method post without an submit button. I looked into using javascript but do not see how that will work.

  <form runat="server">
         <asp:Button ID="GetToken" runat="server" Text="Get Token" OnClick="GetToken_Click" />


   </form>
   
    <form method="post" action="https://test.authorize.net/payment/payment"
id="formAuthorizeNetPage" >

       
        <input type="text" name="Token" value="<%=token%>" />
       
         <input type="submit" name="button" value="Buy now" />
0
I'm using goDaddy to host a website and need to do a file upload into a table. It occurred to me that I don't think I'll be able to use excel as my data source so I was hoping to be able to upload a .csv file. Is there a C# example of how to do this or possible some other method?
0
I have an installshield program that works fine in terms of saving local files, data files registration information but with previous installations of the product (not controlled by Install shield)  those files are deleted during the reinstall
0
step one.
when user get token it call a c# class and returns the token.
step two
after the program get the token value uses a  html form post to send to an html page with a hidden value

How do i do this without a submit button.

The html code

 <form runat="server">
         <asp:Button ID="GetToken" runat="server" Text="Get Token" OnClick="GetToken_Click" />

   </form>
   
    <form method="post" action="https://test.authorize.net/payment/payment"
id="formAuthorizeNetPage" >
       
        <input type="text" name="Token" value="<%=token%>" />
       
         <input type="submit" name="button" value="Buy now" />


   
</form>
0
I had this question after viewing asp.net repeater modal & data command.
0
I am trying to update an web refence url and get the folloring error in the attached file.
The current locataion is D:\DotNet\schemas\XAV.wsdl
the code was downloaded from ups and i need to change it to a local drive for testing which is
C:\Users\Ron\Documents\upsaddressaug\Street Level Address Validation for SHIPPING\XAVWebServices\SCHEMAS-WSDLs
i just seeing how the code works to use it
the program will not update the current location either.
error.png
0
hi want combobox in datagrid and do crud operation in wpf with EF.
0
I have an application that has been written for me and i have all the source code.  When i compile and run it i get the following error.  What can be causing this?

See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.InvalidCastException: Unable to cast object of type 'System.Windows.Forms.ToolStripMenuItem' to type 'System.Windows.Forms.Control'.
   at Accusoft.FSInvoicesDemo.MDIParent2.localFolderToolStripMenuItem_Click(Object sender, EventArgs e)
   at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
   at System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)
   at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
   at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
   at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
   at System.Windows.Forms.ToolStripDropDown.OnMouseUp(MouseEventArgs mea)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ToolStrip.WndProc(Message& m)
   at System.Windows.Forms.ToolStripDropDown.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
    Assembly Version: 4.0.0.0
    Win32 Version: …
0
Independent Software Vendors: We Want Your Opinion
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

hi,

I have gridview. chexbox is inside gridview. its giving an error when there is no data . Checkbox ix a bit field. How to resolve it.

  <asp:TemplateField HeaderText="Status"  HeaderStyle-HorizontalAlign="Left"   >
             <ItemTemplate>
                  <asp:CheckBox ID="lbIsActive" Enabled="false" runat="server"  Text="" Checked='<%# Eval("IsActive") == DBNull.Value ? false :  Eval("IsActive") %>' /> Is Active?
             </ItemTemplate>
             <EditItemTemplate>
                 <asp:CheckBox ID="rdIsActive" runat="server" Text="" Checked='<%# Eval("IsActive") == DBNull.Value ? false :  Eval("IsActive") %>'/> Is Active?
             </EditItemTemplate>
            <FooterTemplate>
                 <asp:CheckBox ID="inIsActive"  runat="server"  /> Is Active?
        
            </FooterTemplate>
         </asp:TemplateField>


c#
   protected void Page_Load(object sender, EventArgs e)
    { 
            if (!IsPostBack)
            {
                LoadAllApplications();
            }
}

   protected void LoadAllApplications()
    {
        try
        {
            AppAccessDataLayer obj = new AppAccessDataLayer();
            DataSet ds = obj.GetAllApplications();

            int count = ds.Tables[0].Rows.Count;
            if (ds.Tables[0].Rows.Count > 0)
            {
                gridView.DataSource = ds;
                gridView.DataBind();
            }
            else
            {
                

Open in new window

0
Is there a way to force a file that is locked by another process to be moved/copied in C#?
0
my current database is MS-Access.

I used primary key in my table.

Also, First i am deleting record and then followed by inserting.

But, while inserting i am getting Error : Concurrency violation: the UpdateCommand affected 0 of the expected 1 records.

I am unable to find out the exact problem for this.

See my complete code.

string connectionstring1 = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + mdbname + ";";
OleDbCommand command = new OleDbCommand();
OleDbTransaction transaction = null;
OleDbConnection cn1 = new OleDbConnection(connectionstring1);
cn1.Open();

// Start a local transaction
transaction = cn1.BeginTransaction();

// Assign transaction object for a pending local transaction.
command.Connection = cn1;
command.Transaction = transaction;

// Execute the commands.
string sqlTrunc = "DELETE FROM [" + tableName + "]";
OleDbCommand cmd = new OleDbCommand(sqlTrunc, cn);

cmd.ExecuteNonQuery();

transaction.Commit();
string ConStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + mdbname + ";";
//using (OleDbConnection cn = new OleDbConnection(connectionstring))
using (OleDbConnection connection = new OleDbConnection(ConStr))
{
connection.Open();
OleDbDataAdapter adapter = new OleDbDataAdapter();
adapter.SelectCommand = new OleDbCommand("SELECT * FROM [" + TABLENAME + "]", connection);
OleDbCommandBuilder builder = new OleDbCommandBuilder(adapter);

adapter.Fill(newdt);

adapter.Update(newdt);

}

What is the …
0
I have the webmethod below and it works fine.
Now, I need to add database bind  because I have gridview inside of this page. In this case, what can i do?

 [WebMethod]
        public static string RemoveXMLData(int messageID)
        {
            string result = "";
            try
            {
                string templatePath = HttpContext.Current.Request.PhysicalApplicationPath + "UserMessages.xml";
                XmlDocument xmlDoc = new XmlDocument();
                xmlDoc.Load(templatePath);
                try
                {
                    XmlNodeList nodeList = xmlDoc.SelectNodes("Users/User[MessageID = " + messageID + "]");

                    foreach (XmlNode xn in nodeList)
                    {
                        xn.ParentNode.RemoveChild(xn);
                    }                   
                    result = "Data deleted";                    
                }
                catch { result = "Some error in node deletion"; }
                finally
                {
                    xmlDoc.Save(templatePath);
                }
            }
            catch { result = "Eror in xml file loading"; }
            return result;
        }

     html = html + "<ul class='list-unstyled'>" +
                                          "<li class='left clearfix'>" +
                                          "<span class='chat-img1 pull-left' style='vertical-align: text-top;'>" +
                                          "<i class='fa 

Open in new window

0
I see alert message "Process cannot access the file because it is being used by another process".
when I click the button at third time. It seems reading is okay. but when i click the button to write something inside  to the xml.
it fails. how can i resolve this issue?

I know the  "Process cannot access the file because it is being used by another process". continue to happen the new message is sent.
sendMsg_Click(), but that does not mean the issues came from there.

And I check all controllers I used, and when the file is opened, it is closed immediately.

  protected void Page_Load(object sender, EventArgs e)
        {
            phoneNoList.DataSource = Utility.Controller.GetUniquePhoneNo(fromPhoneNo);
            phoneNoList.DataBind();
}

  protected void sendMsg_Click(object sender, EventArgs e)
        {
		 #region add a record to all message xml
                Domain.User u = new Domain.User();
                u.fullName = fullName.Text;
                u.from = "+1" + fromPhoneNo;
                u.to = "+1" + toPhoneNo.Text;
                u.body = body.Text;
                u.dateTimeSent = DateTime.Now.ToString();
                u.direction = "outbound-reply";
                string result = Utility.XML.Add(Utility.Controller.filePathUserMessagesAll, u);
                #endregion


}

  public static string Add(string inputFilePath,Domain.User u)
        {
            XDocument doc = XDocument.Load(inputFilePath);
            XElement user = 

Open in new window

0
I have created a controller for a KeyLog (users check in keys or check out keys) from a physical box.  I return a list of log entries to a free fqGrid control via json.  Below is my controller code:
var jsonData = new
            {
                rows = from logs in db.KeyLogs.Where(k => k.KeyId == id).ToList()
                       select new
                       {
                           id = logs.Id,
                           keyId = logs.KeyId,
                           removeDate = logs.KeyRemovedDate.HasValue ? logs.KeyRemovedDate.Value.ToString("MM/dd/yyyy") : "",
                           removeTime = logs.TimeOut.HasValue ? logs.TimeOut.Value.ToString("HH:mm:ss") : "",
                           returnDate = logs.KeyReturnedDate.HasValue ? logs.KeyReturnedDate.Value.ToString("MM/dd/yyyy") : "",
                           returnTime = logs.TimeIn.HasValue ? logs.TimeIn.Value.ToString("HH:mm:ss") : " ",
                           officer = logs.Officer
                       }
            };

Open in new window


The problem is that this code errors on the time vaues if one of them is null.  How can I get around this?  The date vaules are not a problem.
0
Along with this error there are more. I downloaded ups sample and it updated the files to viusal studio 2015. I am just trying the check address to see how it works before doing the shipping api. . Does anyone have a working example for anything from API ups that i could look at and try to figurage out how to get the samples to work. The project is in a zip file at http://rrrwebsite.com/
0
A  wonderful new day.

Am wriiting a window service application in C# and its supposed to call  a C programme from its OnStart() function.

My question is this :

(1 ) Can i develop a C WIN32API in Visual Studio 2017, if yes, how can i please.

(2) Starting from the OnStart() function  how  do i call the C application


Thank you
0
Hi Experts,
I have an MVC.Net application that uses C#.Net code behind.
In my views I use a Kendo UI grid.  One of the columns in the grid is a link.

When the user clicks on the link it should open a .pdf file.  So we need to pass the file path and the file name.
How can I do this?

Thank you,
mrotor
0
Industry Leaders: We Want Your Opinion!
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Hello Experts,
I have hard time understanding the below code.  Please try to explain if possible.  I have a network user not able to sign into an application. Trying to see what could be wrong.  Thank you in advance.

DirectoryEntry de=new DirectoryEntry("GC://root.local");
DirectorySearcher ds= new DirectorySearcher(de,String.Format("(&(objectCategory=user)(objectClass=user)(samAccountName={0}))",strLogin));
SearchResultCollection results=ds.FindAll();

Thank you!
0
Hi, I need to implement a Google Maps Geofence with MVC 5.

Anyone has a sample?
0
good day,
i am using window form app
i would like to adjust my graph while clicking on the track bar. how can i do that, please i need assistance
i have attached 2 files , please take a look at it.
this is the code for my track bar click event, it is not working
 private void trackBar1_Scroll(object sender, EventArgs e)
        {
            if(trackBar1.Value == 1)
            {
                // the updatePoint is the method i used to get the highest point and incremented the highest by 1
                updatePoint();

                // this is for drawing the graph after the change has been made
                drawGraph();
            }
        }

Open in new window



Open in new window

adjust0.png
adjust1.png
0
Hello I have an error in my code


using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using UCS.Core;
using UCS.Core.Network;
using UCS.Core.Threading;
using UCS.Helpers.Binary;
using UCS.Logic;
using UCS.Packets.Messages.Server;

namespace UCS.Packets.Messages.Client
{
    // Packet 14715
    internal class SendGlobalChatLineMessage : Message
    {
        public SendGlobalChatLineMessage(Device device, Reader reader) : base(device, reader)
        {
        }

        public string Message { get; set; }

        internal override void Decode()
        {
            this.Message = this.Reader.ReadString();
        }

        internal override async void Process()
        {
            if (Message.Length > 0 && Message.Length < 200)
            {
                if (Message[0] == '/')
                {
                    object obj = GameOpCommandFactory.Parse(Message);
                    if (obj != null)
                    {
                        string player = "";
                        if (this.Device.Player != null)
                            player += " (" + this.Device.Player.Avatar.UserId + ", " +
                                      this.Device.Player.Avatar.AvatarName + ")";
                        ((GameOpCommand) obj).Execute(this.Device.Player);
                    }
                }
                else
                {
                    long senderId = 

Open in new window

0
good day,
i am developing an application using window form
i am new to graph in visual studio c#,
i want to know if there is a way or a method i can use to  find the (x,y) coordinates of the peaks and valleys of a graph?
i have attached a file containing a picture of my graph.
graph.png
0
var test1 = Convert.ToInt32(Session["SID"]);
Line 90:                       //  int ist = EAdapter.Insert(Convert.ToInt32(Session["SID"]), txtclgname.Text, txtErlno.Text,
Line 91:                         int ist=EAdapter.Insert(Convert.ToInt32(Session[test1]), txtclgname.Text, txtErlno.Text,
Line 92:                           drpsem.SelectedItem.Text, drpEdu.SelectedItem.Text, drpBranch.SelectedItem.Text, drpPassyear.SelectedItem.Text,
Line 93:                           float.Parse(txtCGPA.Text), drpreqskill.SelectedItem.Text, txtExSkill.Text, resume);

Open in new window

0

C#

92K

Solutions

25K

Contributors

C# is an object-oriented programming language created in conjunction with Microsoft’s .NET framework. Compilation is usually done into the Microsoft Intermediate Language (MSIL), which is then JIT-compiled to native code (and cached) during execution in the Common Language Runtime (CLR).