__avd 1,826

I guess, you want to request an action without adding parameters. Take a look at second parameter of action; it is non-nullable (value type). You need to convert Char type to Nullable.

Function mostrar(cor As String, alinea? As Char) As ActionResult
   ViewBag.cor = cor
   ViewBag.alinea = alinea
   Return View()
End Function
diafol commented: Long tie no see - great to see you back! +15
__avd 1,826

You should have to use System.DateTime type.

Dim newDate = DateTime.ParseExact("20111120", 
                                  "yyyyMMdd",
                 CultureInfo.InvariantCulture)

Me.txtSoNo.text=newDate.ToString("yyyyMMdd")
__avd 1,826

The System.Array is base/super class of array. Here you need to request a method : a.GetValue(0)

__avd 1,826

You can populate the DataSet by selecting any one of .net XML API (XmlDocument (DOM), LINQ to XML or XPathNavigator).

__avd 1,826

I guess you want to create a list of people and display this list whose birth date is equal to DateTimePicker date (day and month). I suggest you to use LINQ to XML to populate List<Person>.

Here is a working sample :

Create a TYPE Person

 public class Person
 {
   public string Name { get; set; }
   public DateTime BirthDate { get; set; }
 }
Code to read XML doc and populate the List
     XDocument doc = XDocument.Load(fileName);

     var list = doc.Descendants("Person")
                   .Where(x => DateTime.Parse
                         (x.Element("BirthDate").Value).Day == DateTime.Today.Day 
                         && DateTime.Parse(x.Element("BirthDate").Value).Month == DateTime.Today.Month)
                   .Select(x => new Person()
                    {
                     Name = x.Element("Name").Value,
                     BirthDate = DateTime.Parse(x.Element("BirthDate").Value)
                }).ToList();
Bind the result to DataGridView
DataGridView1.DataSource = list;
__avd 1,826

Wrap your databinding code in page_Load handler,

protected void page_load()
 {
  if(!IsPostBack)
    {
     //databinding code
      }
 }
__avd 1,826

I've started learning C# by reading MSDN resources:

  1. C# Language Specification
  2. Visual C# Resources
  3. C# Reference
  4. C# Programming Guide
__avd 1,826

You're comparing references of string objects. Use String.equals() method to compare strings:

if(word.equals(d))
  //
else
 //
__avd 1,826

Do not add button into contentPane of JFrame directly instead create a JPanel (with FlowLayout) and add that button in it.

JPanel bottom=new JPanel();
bottom.add(button);  
frame.add(bottom, BorderLayout.SOUTH);
__avd 1,826

You can use Linq To XML.

string xmlStr = @"<?xml version=""1.0"" encoding=""utf-16""?>
 <CurrentWeather>
  <Location>Madrid / Cuatro Vientos, Spain (LEVS) 40-23N 003-47W 687M</Location>
  <Time>Dec 22, 2012 - 03:00 AM EST / 2012.12.22 0800 UTC</Time>
  <Wind> Calm:0</Wind>
  <Visibility> less than 1 mile:0</Visibility>
  <SkyConditions> obscured</SkyConditions>
  <Temperature> 50 F (10 C)</Temperature>
  <DewPoint> 50 F (10 C)</DewPoint>
  <RelativeHumidity> 100%</RelativeHumidity>
  <Pressure> 30.30 in. Hg (1026 hPa)</Pressure>
  <Status>Success</Status>
</CurrentWeather>";

var doc = XDocument.Parse(xmlStr);
string location = doc.Root.Element("Location").Value;
Console.WriteLine(location);
__avd 1,826

You may use indexer method of DataRowView to obtain selected column value.

Dim Equip As DataRowView = ListBox1.SelectedValue
Dim val1=Equip(0) 'Returns value from 1st column
__avd 1,826

You can't use both - DataSource control (codeless approach) and Code methods to handle events of DataList control. Choose either one of them.

If you've plan to use code then use IsPostBack property in page_load to populate the DataList control.

Something like this:

if(!IsPostBack)
{
  string name=Request.QueryString["name"];
  string id = Session["Customer_ID"].ToString();
  SqlConnection con = new SqlConnection();
  con.ConnectionString = "Data Source=HP-HP\\SQLEXPRESS;Initial Catalog=OnlineShop;Persist Security Info=True;User ID=sa;Password=rane@1234";
  con.Open();
  SqlCommand cmd = new SqlCommand("select * from Cart1 where Customer_ID='"+name+"'", con);
  SqlDataReader dr = cmd.ExecuteReader();
  DataTable dt = new DataTable();
  dt.Load(dr);
  DataList1.DataSourceID = null;
  DataList1.DataSource = dt;
  DataList1.DataBind();
  con.Close();
}

I'd like to suggest you that you should dispose the ADO.NET objects properly by using using block.

using(SqlConnection con = new SqlConnection())
 {
   con.ConnectionString = "Data Source=HP-HP\\SQLEXPRESS;Initial Catalog=OnlineShop;Persist Security Info=True;User ID=sa;Password=rane@1234";
  using(SqlCommand cmd = new SqlCommand("select * from Cart1 where Customer_ID=@name", con))
    {
    cmd.Parameters.AddWithValue("@name",name); 
    SqlDataReader dr = cmd.ExecuteReader();
    ...
    }
  }
__avd 1,826

May be the reference variable rec contains null or gender.SelectedValue or martial.SelectedValue returns null.

Please add a break-point at these lines and verify the value of reference variables/properties.

__avd 1,826

You need to include the markup in your post that you've tried. I think you need to include the return url hidden field that contains the absolute URI of your webapp's resource/page.

<form ....>
  .....
  <input type="hidden" 
         name="return" value="http://localhost/WebSite/page1.aspx" />
  ....
</form>
__avd 1,826

Parse the string and wrap update code in,

Datetime dt;
if(DateTime.TryParse(date,out dt))
 {
   //code to update record
 }

EDIT:

@HunainHafeez : Done, Thanks alot man ! but just for learning purpose tel me that how did it work ?

I think return value of Calendar extender will be DateTime.MinValue. if you didn't select the calendar then this statement String date = Request.Form[txtb.UniqueID]; assign invalidate date value. Using DateTime.Parse, DateTime.TryParse and DateTime.ExactTryParse - static methods of DateTime struct, you can parse the string data to DateTime object and also validate date/time value.

HunainHafeez commented: wowwwwwwwwwww ! Done, Thanks alot man ! but just for learning purpose tel me that how did it work ? +2
__avd 1,826

You must have to post relevant code that you've written so far, name of Database product that you're using, and Stored-Proc desciption (name along with parameters type).

Generally, we use ADO.NET core Provider API - Connection,Command,DataReader classes to execute Stored-procedures/functions/queries.

__avd 1,826

You're passing productid to ProductLarge.aspx as QueryString and rendering an image via handler so you need to request the handler with productid in ProductLarge.aspx.

<asp:HyperLink 
          ID="lnkImage" runat="server" 
          ImageUrl='<%# Eval("productid","~/Handler.ashx?productid={0}") %>'
          NavigateUrl='<%# Eval("productid","ProductLarge.aspx?productid={0}")' />

and markup in ProductLarge.aspx should be,

<img src='Handler.ashx?productid=<%=Request["productid"] %>' alt='Large Image' />
__avd 1,826

Handle the doPost() method and use following API to upload a file.

  1. Use Servlet 3.0 Part API
  2. Apache commons fileupload API.

Tutorial - Uploading files in Servlet 3.0

__avd 1,826

ABCpdf is commecial product. Use wkhtmltopdf tool or download the iTextSharp library. (Tutorials link)

__avd 1,826

Remove single quotes around parameters.

SqlCommand SQLINSERT =new SqlCommand();
SQLINSERT.CommandText = "insert into table_1 (ID,name,address,phone,city) values (@id,@name,@address,@phone,@city)" ;
SQLINSERT.Connection=conn;
SQLINSERT.Parameters.AddWithValue("@ID",Textbox1.Text.ToLower());
SQLINSERT.Parameters.AddWithValue("@name",Textbox1.Text.ToLower());
SQLINSERT.Parameters.AddWithValue("@address",Textbox1.Text.ToLower());
SQLINSERT.Parameters.AddWithValue("@phone",Textbox1.Text.ToLower());
SQLINSERT.Parameters.AddWithValue("@city",Textbox1.Text.ToLower());
SQLINSERT.ExecuteNonQuery();
__avd 1,826

It is impossible to say/guess something about your code. Please include SSCCE.

Mike Askew commented: amen. +3
__avd 1,826

Please add your SSCCE (Code and description) here. Do you want to change the properties of HyperLink?

__avd 1,826

Please read the MSDN documentation about Caching.

__avd 1,826

Use DateTime.AddMonths, AddDays methods.

    Dim dt = #12/20/2010#
    dt = dt.AddMonths(1)
    dt = dt.AddDays(-(dt.Day - 1))
__avd 1,826

What will happen when a user type following in the TextBox:

hello' or '1'='1

One must have to avoid the SQL Injection by creating stored procedure or parameterized query.

string cnstr=ConfigurationManager.ConnectionStrings["RegConnectionString"]
                                        .ConnectionString;
bool found=false;
using(SqlConnection con = new SqlConnection(cnstr))
 {
   string cmdStr = "Select username from Reg where Username = @username";
  using(SqlCommand userExist = new SqlCommand(cmdStr, con))
   {
     con.Open();
     object result=userExist.ExecuteScalar();
     if(result!=null)
       found=true;
    }
 }
 if(found)
    //
else
    //
lhsunshine commented: tq... +0
__avd 1,826

Firstly, you have to create the array and after that instantiate the LinkedList elements.

  Dim myarray(3) As LinkedList(Of String)

  For i As Integer = 0 To myarray.GetUpperBound(0)
        myarray(i) = New LinkedList(Of String)
  Next
__avd 1,826

Never use hard-coded sql strings. Always use Parameters.

cmd.CommandText = "select * from exam where category=@category";
cmd.Parameters.AddWithValue("@category",Request.QueryString["cat"]);
__avd 1,826

I didn't realise you could call DataBind expressions on controls without a DataSource assigned.

Actually, you have assigned a single value as an "expression"; it is also known as [URL="http://support.microsoft.com/kb/307860"]simple data binding[/URL].

You must have to call [ICODE]DataBind()[/ICODE] method in order to evaluate [icode]<%# Eval("expression") %>[/icode].

__avd 1,826

No! you can't use <%= %> (expression) with server controls.

Use Binding expression:

Markup:
[CODE][/CODE]

Code-behind

[CODE] protected void Page_Load(object sender, EventArgs e)
{
Session["value"] = 100;
Label1.DataBind();
}[/CODE]

|-|x commented: provided a clear, precise and correct solution. +2
__avd 1,826

Use Linq to Xml (import the System.Xml.Linq namespace). That way you can easily read/write XML document.

To read Xml document.

[CODE]doc = XDocument.Load(file);

string server = doc.Root.Element("Parameters").Element("servername").Value;
string username = doc.Root.Element("Parameters").Element("username").Value;
Console.WriteLine(server);
Console.WriteLine(username);
[/CODE]

To create Xml document.

[CODE]XDocument doc = new XDocument();
XElement root=new XElement("Configuration");
XElement param=new XElement("Parameters");
param.Add(new XElement("servername","A"));
param.Add(new XElement("username","B"));
param.Add(new XElement("password","C"));

root.Add(param);
doc.Add(root);
doc.Save(file);
[/CODE]