KushMishra 38 Senior Technical Lead

Hi, I am eager to help you for this and you just need to paste in the code in which you're facing the problem...
Thanks.

KushMishra 38 Senior Technical Lead

Hello Dee, In my point of view .Net should be preferred because its a new technology and obviously a new technology comes with some new enhancements and .Net provides you the security,robustness,reliability and faster web pages although I don't know much about PHP but still its very obvious to think that why most of the programmers have switched to .Net from PHP.
There may be many articles on the Internet and its just like a question : Whether you want to eat an orange or an apple?
What does it matter to you if you're getting something to eat and the major point is that you're not empty stomach after eating either of the two fruits i.e., your same work is done with both of the technologies.So, decision is yours whether you choose an old language or a new one.
Hope that helps.
Thanks.

KushMishra 38 Senior Technical Lead

Hello,

There's a little code you've forgotten to add in the Default.master....
After belowContentInfo, you've not added bottomFooter...So after </div> just try to add the following code...

<div id="bottom" class="clearfix">
        <div class="wrapper clearfix">
            <asp:ContentPlaceHolder ID="bottomFooter" runat="server">
            <!--THIS WAS MISSING-->
            </asp:ContentPlaceHolder>
        </div>
    </div>

And one more thing is that under the belowContent in the Default.master the class should be "wrapper clearfix" instead of "wrapper clear" as it does not exist...

KushMishra 38 Senior Technical Lead

Great...thank you very much for your kind advice...and I've found the solution to my confusion...

KushMishra 38 Senior Technical Lead

Hello, gppuddinpie I think you are facing the problem of adding your new web page in the master page....So, please post the xhtml code of both the master page and the new web page so that it would become easier to solve your problem as quickly as possible.

KushMishra 38 Senior Technical Lead

Thanks for your kind and quick reply Ancient Dragon..That was a great help..However, another query of mine is I am confused that whether I should begin with the C++ basics only or should I try learning C# first because C# is a new language, so what should I do first?

KushMishra 38 Senior Technical Lead

Hello fuston05, AndreRet is correct and in my point of view, it would be better for you to opt for a certified course that is known as MCSD (Microsoft Certified Solutions Developer) which is only for the Microsoft products like .Net.

With this certificate you can get the jobs more easily.Hope that helps.

KushMishra 38 Senior Technical Lead

Hello,

I am really confused and not able to make decision about how to begin learning programming languages.
I've done C,C++ and 2 projects of ASP.Net with C#.
But, now I've forgotten most of the concepts of C++(like constructors,structures,classes and even the basic programs like Fibonacci series and other tricky programs) and I am confused that whether I should begin with the C++ basics only or should I try learning C#?

I am in a great confusion.Any relevant help would be very highly honored.Please provide me the best E-Books,learning material or something like that which would help me learning these languages and kindly inform me how to begin from the start.

Thanks in advance.

KushMishra 38 Senior Technical Lead

are you sure that

allow users="?"

....I think it should be

deny users="?"
KushMishra 38 Senior Technical Lead

Hi there....,saw ur post and found that the same problem was faced by me too and the solution to such a problem is as follows...

protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "cmd")
        {
            string filename=e.CommandArgument.ToString();
            string path=MapPath("~/PDF FOLDER IN WEBSITE/" + filename);
            byte []bts=System.IO.File.ReadAllBytes(path);

            Response.Clear();
            Response.ClearHeaders();

            Response.AddHeader("Content-Type", "Application/pdf");
            Response.AddHeader("Content-Length",bts.Length.ToString());
            Response.AddHeader("Content-Disposition","attachment; filename=" + filename);
            Response.BinaryWrite(bts);
            Response.Flush();
            Response.End();
        }
    }
KushMishra 38 Senior Technical Lead

Hello,

Actually you're facing a very common problem in SQL.........My opinion to you is that you should replace the spaces by "CamelCasing" or just by "Underscores"......If you're using a datagrid or gridview etc. to display those items,just go to their properties and write in the "AlternateDataString" column or something likewise........
Hope this helps ya.......

KushMishra 38 Senior Technical Lead

Server=ServerName\theInstanceName;Database=myDataBase;Trusted_Connection=True;

For "Server" go to Sql management studio and copy the whole thing like......KM\\SQLEXPRESS........but remember to write it as KM\SQLSERVER in the Server....Hope this helps....

KushMishra 38 Senior Technical Lead

Are you using the C# code behind as well ????.......If yes then plz check the MakerID coloumn name in that.........

KushMishra 38 Senior Technical Lead

still facing the same prob.....

KushMishra 38 Senior Technical Lead

sql server 2005.......table name is "Info"..........table field is "Username"...and it is a dropdown list....plz reply as soon as possible.....

KushMishra 38 Senior Technical Lead

your code's working fine but I'm facing a new prob....

In the database, the values are deleted (this should happen).But at the runtime of my application dropdown list shows double values including the one which I've deleted.

For Example........
If entries in dropdown list are.....
KM499
KK499
Kush
Microsoft etc.

And if I delete KK499 then result comes as follows....
KM499
KK499
Kush
Microsoft
KM499
KK499
Kush
Microsoft

What should I do for this...please help me.......

Thanks in advance............

KushMishra 38 Senior Technical Lead

Hello guys,

I am asking a very simple thing to be done in my project (May be I've forgotten the syntax).........

I've taken a drop-down list in which diff. user-names are coming and added a delete button to delete the full row which contains the selected drop-down list user-name.

I've written the code as............

SqlConnection con2 = new SqlConnection(ConfigurationManager.ConnectionStrings["KMCon"].ToString());
SqlCommand cmd2 = new SqlCommand("delete * from Info where Username=[B]???????[/B], con2);
con2.Open();
cmd2.ExecuteNonQuery();
con2.Close();

What and how should be the syntax to write in the ???????

Thanks in advance........

KushMishra 38 Senior Technical Lead

Actually I'm askin how to add multiple content types in a single Response.Headers() ???????

KushMishra 38 Senior Technical Lead

Hello to all,

I've written this thread because I want to know the different content types used like.................

Response.AddHeader("Content-Type", "Application/octet-stream");

It was used for software and It was successful........But what for Music,Pictures and E-Books ???????????

Thanks in advance...........

KushMishra 38 Senior Technical Lead

I must say that you're a total genius for me bro...This was the only problem that I was facing for many days and because of you I've found my solution and the end of my project too....May u get whatever you need........Thanks a lot man........

KushMishra 38 Senior Technical Lead

Its for a single file i.e., test.zip.......But I'm getting a list of software stuff from the database into the gridview........How can I code for every file????

KushMishra 38 Senior Technical Lead

Error coming as..........

'System.Web.HttpResponse' does not contain a definition for 'ClearHeader' and no extension method 'ClearHeader' accepting a first argument of type 'System.Web.HttpResponse' could be found (are you missing a using directive or an assembly reference?)
KushMishra 38 Senior Technical Lead

If I'm not wrong then I think You've missed the con.open();

Hope this helps........

KushMishra 38 Senior Technical Lead

May be you should go for the form authentication in asp.net

Here's a demo code for you.......

</configSections> // after this in your web.config add the following.
<appSettings/>
<connectionStrings>
<add name="KMCon" connectionString="initial catalog=KM; data source=DEVELOPER\SQLEXPRESS; Integrated Security=SSPI"/>
</connectionStrings>

And give location path which you want to be accessed by all (including your Images,CSS,Javascipt etc. folders also for their proper working)...........

<location path="Pics.aspx">
    <system.web>
      <authorization>
        <allow users="*"/>
      </authorization>
    </system.web>
  </location>
  <location path="Reg.aspx">
    <system.web>
      <authorization>
        <allow users="*"/>
      </authorization>
    </system.web>
  </location>

Now add the following code for which you want a resticted and secure access..........

</compilation> // after this in your web.config add the following.
<authentication mode="Forms">
<forms loginUrl="Admin-IMKM/AdminLogin.aspx" defaultUrl="Admin/WelcomeAdmin.aspx"></forms>
</authentication>

Hope this helps ya........

KushMishra 38 Senior Technical Lead

Hello to all,

I've designed a website to provide Software and all the data is coming into the gridview.The entries in database are......

SoftName : Name of the software

SoftType : Type of the software (like windows,mac etc.)

SoftUrl : Path of the software file in the website
(It is a folder "Soft")

Now I want to add a download link into the gridview that'll make the user to download directly my software from the Gridview.

Thanks in advance.......

KushMishra 38 Senior Technical Lead

Thanks for your kind and quick response.

Can you also tell me how to make a download link for the Songs retrieved in gridview......

KushMishra 38 Senior Technical Lead

Again facing the same problem.
Here's my complete code........

<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Pics.aspx.cs" Inherits="Pics" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<table cellpadding="0" cellspacing="0" align="center">
<tr>
<td align="center">
<div align="center">
<asp:GridView ID="Picg" runat="server" Width="700px" Height="650px" AutoGenerateColumns="False"
BorderWidth="1px" BackColor="White" CellPadding="3" BorderStyle="None" BorderColor="#CCCCCC"
Font-Names="Arial">
<FooterStyle ForeColor="#000066" BackColor="White"></FooterStyle>
<PagerStyle ForeColor="#000066" HorizontalAlign="Left" BackColor="White"></PagerStyle>
<HeaderStyle ForeColor="White" Font-Bold="True" BackColor="#006699"></HeaderStyle>
<Columns>
<asp:BoundField DataField="PicID" HeaderText="ID" />
<asp:BoundField DataField="PicName" HeaderText="Name" />
<asp:BoundField DataField="PicCategory" HeaderText="Category" />
<asp:TemplateField HeaderText="Image">
<ItemTemplate>
<asp:Image ID="Image1" runat="server" ImageAlign="Middle" ImageUrl='<%# (string) FormatImageUrl( (string) Eval("PicUrl")) %>' Height="100px" Width="100px" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:LinkButton ID="DownloadPicl" runat="server" Text="Download" PostBackUrl='<%# Eval("PicUrl","~/{0}") %>'>
</asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<SelectedRowStyle ForeColor="White" Font-Bold="True" BackColor="#669999"></SelectedRowStyle>
<RowStyle ForeColor="#000066"></RowStyle>
</asp:GridView>
</div>
</td>
</tr>
</table>
</asp:Content>

And here's the c# code...........

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;

public partial class Pics : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["KMCon"].ToString());
SqlDataAdapter da = new SqlDataAdapter("select PicID,PicName,PicCategory,PicUrl from Pics order by PicName", con);
DataSet ds = new DataSet();
da.Fill(ds);
Picg.DataSource = ds;
Picg.DataBind(); 
}
protected string FormatImageUrl(string url)
{
if (url != null && url.Length > 0)
return ("~/" + url);
else return null;
}
}
KushMishra 38 Senior Technical Lead

Sorry adatapost, It's showing the same error again.......

KushMishra 38 Senior Technical Lead

I've recently used the following code in Pics.aspx........

<asp:TemplateField>
<ItemTemplate>
<asp:LinkButton ID="DownloadPicl" runat="server" Text="Download" PostBackUrl='<%# (string) FormatImageUrl1( (string) Eval("PicUrl")) %>'>
</asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>

And in Pics.cs, I've used.........

protected string FormatImageUrl1(string url1)
{
if (url1 != null && url1.Length > 0)
return ("~/" + url1);
else return null;
}

And the error is as follows...........

The HTTP verb POST used to access path '/KMWorld/Pictures/fatmanpolarbear.jpg' is not allowed.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.HttpException: The HTTP verb POST used to access path '/KMWorld/Pictures/fatmanpolarbear.jpg' is not allowed.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[HttpException (0x80004005): The HTTP verb POST used to access path '/KMWorld/Pictures/fatmanpolarbear.jpg' is not allowed.]
   System.Web.DefaultHttpHandler.BeginProcessRequest(HttpContext context, AsyncCallback callback, Object state)
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +3391004
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +161
KushMishra 38 Senior Technical Lead

Sorry to all experts but I'm still unable to find an appropriate solution.
If anyone who knows how to resolve my problem then show your kind response as soon as possible.......

KushMishra 38 Senior Technical Lead

actually I don't know how to do it all.........I've taken a button field here's the .aspx code.......

<asp:TemplateField HeaderText="Download Link">
<ItemTemplate>
<asp:Button ID="DownloadPicb" runat="server" Text="Download" OnClick="DownloadPicb_OnClick" />
</ItemTemplate>
</asp:TemplateField>

and I'm asking what to write in.........

protected void DownloadPicb_OnClick(object sender, EventArgs e)
{
        ??????? 
}

Hope you'll make a quick reply as earlier.

Thanks.

KushMishra 38 Senior Technical Lead

Hello guys,
I'm a newbie to asp.net....I've recently designed a website in which I've taken a gridview control and added a button in the itemtemplate field of the gridview........What I want is that if anyone clicks on this button then the data in the particular row of the gridview comes for the download to user (like open,save etc.).....please make your response as soon as possible.
Thanks in advance.