Hi all..
i'm working with asp.net c#..
i want to make a chart that can retrieve the data from the database..
i found one website that tell the way to make it but i dont understand the query used..
this the the link [URL="

Hi
I am using Ajax Slide Show extender to show my images.

Everything works fine.

Now what I want is when the anyone clicks on any particular image it should show them that particular image in another window or popup etc.

this is code when user click the image but i dont know then
[CODE]
<asp:ImageButton ID="imgShowImage" runat="server"
Height="300" Style="border: 1px solid black;width:auto"
AlternateText="" onclick="imgShowImage_Click"/>

        <asp:Label runat="Server" ID="imageLabel1"/><br />
        <asp:Button runat="Server" ID="prevButton" Text="Prev" Font-Size="Small" />
        <asp:Button runat="Server" ID="playButton" Text="Play" Font-Size="Small" />
        <asp:Button runat="Server" ID="nextButton" Text="Next" Font-Size="Small" />

        <ajax:SlideShowExtender ID="slideshowextend1" runat="server"
            TargetControlID="imgShowImage"
            SlideShowServiceMethod="GetSlides"
            AutoPlay="true"
            ImageDescriptionLabelID="imageLabel1"
            NextButtonID="nextButton"
            PlayButtonText="Play"
            StopButtonText="Stop"
            PreviousButtonID="prevButton"
            PlayButtonID="playButton"
            Loop="true" />

[/CODE]
anyone plz

Hi

now, when i download the image, the path will be in this format [CODE]C:\Users\itdept\Desktop\webmaster\image\Penguins.jpg[/CODE]

how can i make it save only the filename [CODE]Penguins.jpg[/CODE]?

this is my code
[CODE]
if (FileUpload1.PostedFile != null && FileUpload1.PostedFile.FileName != "")
{
byte[] imageSize = new byte[FileUpload1.PostedFile.ContentLength];
HttpPostedFile uploadedImage = FileUpload1.PostedFile;
uploadedImage.InputStream.Read(imageSize, 0, (int)FileUpload1.PostedFile.ContentLength);
string ImagePath = FileUpload1.PostedFile.FileName.Trim();
[/CODE]

ok..thanks..

hi all..
i'm working with slide show extender..
i'm referred to this website [URL="

thanks for ur response..
yes, it is client computer and i'm using file asp:upload..

if i make it like you suggest, the path in my db is like this

[CODE]
System.String[]
[/CODE]
is it true?

actually..my previous post is not clearly define what actually i need..
1) how to make the splitter from '\' to '/'
2) how to make a short path '~/image/Desert.jpg' instead of 'C:\Users\itdept\Desktop\webmaster\image\Desert.jpg'

the coding now is like this
[CODE]
protected void btnUpload_Click(object sender, EventArgs e)
{
string strDescription = txtName.Text.ToString();
if (FileUpload1.PostedFile != null && FileUpload1.PostedFile.FileName != "")
{
byte[] imageSize = new byte[FileUpload1.PostedFile.ContentLength];
HttpPostedFile uploadedImage = FileUpload1.PostedFile;
uploadedImage.InputStream.Read(imageSize, 0, (int)FileUpload1.PostedFile.ContentLength);
//string ImagePath = FileUpload1.PostedFile.FileName;
//string ImagePath = Server.MapPath("~/image/" + FileUpload1.FileName);
string[] ImagePath = FileUpload1.PostedFile.FileName.Split('/');
SqlConnection con = new SqlConnection("Server=(local); Database=test; user id=sa; password=itdept");

        // Create SQL Command 
        SqlCommand cmd = new SqlCommand();
        cmd.CommandText = "INSERT INTO image(imageView,Description,imagePath)" + " VALUES (@imageView,@Description,@imagePath)";
        cmd.CommandType = CommandType.Text;
        cmd.Connection = con;

        SqlParameter Description = new SqlParameter("@Description", SqlDbType.VarChar, 50);
        Description.Value = strDescription.ToString();
        cmd.Parameters.Add(Description);

        SqlParameter UploadedImage = new SqlParameter ("@imageView", SqlDbType.Image, imageSize.Length);
        UploadedImage.Value = imageSize;
        cmd.Parameters.Add(UploadedImage);

        SqlParameter imagePath = new SqlParameter("@imagePath", SqlDbType.NVarChar, 50);
        imagePath.Value = ImagePath.ToString();
        cmd.Parameters.Add(imagePath);

        con.Open();
        int result = cmd.ExecuteNonQuery();
        con.Close();
        if (result > 0)
        lblMessage.Text = "File Uploaded";
        GridView1.DataBind();
    }
}

[/CODE]

hi all, i'm going to make an upload picture into database.. in run successfully but now it will store as
[CODE]
C:\Users\itdept\Desktop\webmaster\image\Desert.jpg
[/CODE]
but i just want to make it like this
[CODE]
~/image/Desert.jpg
[/CODE]
is it possible?

actually i cannot how all those thing work..can you show me some sample code?

but is that actually request from my client =(

Hi all..
i want to create a banner in my website using asp.net and ajax..
banner will consist of many banners and have the paging under the banner that moving y itself.. what we call it? i cannot find any other example yet because i dont know the name of that application..

Hi all,
i havw make a page for user entry..now i'm uisng

[CODE]
<asp:RequiredFieldValidator ID="CmpCode" ErrorMessage="*" runat="server" ControlToValidate="txtCmpCode"></asp:RequiredFieldValidator>
[/CODE] to make a validation but not enough space..

anybody have any suggestion to make a validation rather than diaplay the error message?
i'm thinking about just red bold the textbox but not found yet..
anybody knows?

Thanks..

i see..
so, is there any validation for that error?
any suggestions?

int..
in the usp also int..it's happens only if i'm insert 9999999999

Hi all,
i'm doing a program using c# in creating an insert page..
i want to insert the zip code into the databse and have been validate using validation expression..

[CODE]
<asp:TextBox ID="txtCmpZip" runat="server" BorderStyle="Groove" MaxLength="10" Width="74"></asp:TextBox><asp:RequiredFieldValidator ID="CmpZip" runat="server" ErrorMessage="*" ControlToValidate="txtCmpZip"></asp:RequiredFieldValidator>
<asp:ValidatorCalloutExtender ID="ValidatorCalloutExtender2" runat="server" TargetControlID="RegularExpressionValidator2"></asp:ValidatorCalloutExtender>
<asp:RegularExpressionValidator ID="RegularExpressionValidator2" ErrorMessage="Zip code must at least 5 digits" ValidationExpression="\d{5,10}" Display="None" runat="server" ControlToValidate="txtCmpZip"></asp:RegularExpressionValidator>
[/CODE]

when i insert "999999999", it will giving me an error said

[CODE]
error converting data type nvarchar to int.
[/CODE]

but for the other zip code, it will insert successfully.. any help plz?

[CODE]
protected void Page_Load(object sender, System.EventArgs e)
{
if ( !(ViewState["ActiveTabIndex"] == null) && (! (sender == null)))
{
if (sender.GetType().ToString().Equals("AjaxControlToolkit.TabContainer"))
{
((AjaxControlToolkit.TabContainer)sender).ActiveTabIndex = (int)ViewState["ActiveTabIndex"];
}

    }

}
protected void MyTabContainer_ActiveTabChanged(object sender, EventArgs e)
{
    ViewState["ActiveTabIndex"] = MyTabContainer.ActiveTabIndex;
} 

[/CODE]

this is what i have tried, but did't work..
can you explain a little bit more

hi,
i have a problem with my tabcontainer that once user click the tab, it will not remains the tab but goes to the default tab..
This is my code
[CODE]
<cc1:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"></cc1:ToolkitScriptManager>
<cc1:TabContainer ID="MyTabContainer" runat="server" ActiveTabIndex="0>

            <cc1:TabPanel ID="TabPanel1" runat="server" HeaderText="Company">
                <ContentTemplate>
                    <a href="<%= Page.ResolveUrl("~")%>MASTER/Company_a.aspx" >Company Entry</a>&nbsp;&nbsp;&nbsp;
                    <a href ="<%= Page.ResolveUrl("~")%>MASTER/Company_v.aspx">View Company </a>&nbsp;&nbsp;&nbsp;
                </ContentTemplate>
            </cc1:TabPanel>

            <cc1:TabPanel ID="TabPanel2" runat="server" HeaderText="User">
                <ContentTemplate>                      
                    <a href ="<%= Page.ResolveUrl("~")%>MASTER/User_a.aspx">User Entry </a>&nbsp;&nbsp;&nbsp;
                    <a href ="<%= Page.ResolveUrl("~")%>MASTER/User_v.aspx">View User </a>
                </ContentTemplate>
            </cc1:TabPanel>

            <cc1:TabPanel ID="TabPanel3" runat="server" HeaderText="TabPanel3">
                <ContentTemplate>
                    Tab 3
                </ContentTemplate>
            </cc1:TabPanel>

        </cc1:TabContainer>  

[/CODE]

[CODE]
if(@sqltype = 'datagrid')
begin
SELECT CmpID,
CmpCode,
CmpName,
CmpEffDate,
CmpExpDate,
CmpStatusCode,
CodCode
from ms_Company C, ms_Code D
where C.CmpStatusCode = D.CodID
end
[/CODE]
this is what i have done, is it possible?

Hi all,
i have a problem with my datagrid attribute "OnPageIndexChanged="gridedit_PageIndexChanged""...
for example if i have 2 page and the second page contain only one record.. if i want to delete the record, this error appear..
anyone can help me plz..

[CODE]
Invalid CurrentPageIndex value. It must be >= 0 and < the PageCount.
[/CODE]

i have continued my research and found the solution..tq

Hi all,
i need some help in c# in order to display the attrtibute that is not in the same table..
i have a table COMPANY and CODE..in company table, i have attribute called CmpStatusCode that just display in int (input by ddl which is selectedvalue ex: 1,2,3)..but in CODE table, there are definition for that selectedvalue (ex: 1=active , 2=not active).. what should i do to display the value of "active" by refering to 1,2,3? i'm using usp..
i'm using datagrid to display the data..
[CODE]

<asp:TemplateColumn HeaderText="Status" HeaderStyle-Width="5%" SortExpression="CmpStatusCode" visible="true">
<ItemTemplate>
<center><asp:Label Id="lblCmpStatusCode" width="50px" Text='<%# DataBinder.Eval(Container, "DataItem.CmpStatusCode") %>' Runat="server" /></center>
</ItemTemplate>
</asp:TemplateColumn>
[/CODE]

this is my usp
[CODE]
begin
SELECT CmpID,
CmpCode,
CmpName,
CmpEffDate,
CmpExpDate,
CmpStatusCode
from ms_Company
end

[/CODE]
now, when the page is build, value for CmpStatusCode will be in 1,2,3.. i could not find the way to display the value for 1,2,3 that need to be refer in table code.. in Code table, the attribute that explain the CmpStatusCode is CodCode..

anybody please help me.. sorry for the bad english.. i dont know how to explain it:sad:

Check this link
[URL="

Hi all,
now i'm working to convert html to pdf in asp.net..
i don't have any idea to make it..
now i have this code to convert it but have a problem..
anybody please help me see thid code or send me link as a guide..
i'm using iTextSharp to convert it
[CODE]
protected void btnSubmit_Click(object sender, EventArgs e)
{
//create document
Document document = new Document();
try
{
//writer - have our own path!!! and see you have write permissions...
PdfWriter.GetInstance(document, new FileStream(Server.MapPath("/") + "WordDoc/" + "parsetest.pdf", FileMode.Create));
document.Open();

        //html -text - can be from database or editor too
        String htmlText = "<font  " +
       " color=\"#0000FF\"><b><i>Title One</i></b></font><font   " +
       " color=\"black\"><br><br>Some text here<br><br><br><font   " +
       " color=\"#0000FF\"><b><i>Another title here   " +
       " </i></b></font><font   " +
       " color=\"black\"><br><br>Text1<br>Text2<br><OL><LI>hi</LI><LI>how are u</LI></OL>";

        //make an arraylist ....with STRINGREADER since its no IO reading file...
        [U]ArrayList htmlarraylist = iTextSharp.text.html.simpleparser.HTMLWorker.ParseToList(new StringReader(htmlText), null);[/U]

        //add the collection to the document
        for (int k = 0; k < htmlarraylist.Count; k++)
        {
            document.Add((IElement)htmlarraylist[k]);
        }

        document.Add(new Paragraph("And the same with indentation...."));

        // or add the collection to an paragraph 
        // if you add it to an existing non emtpy paragraph it will insert it from
        //the point youwrite -
        Paragraph mypara = new Paragraph();//make an emtphy paragraph as "holder"
        mypara.IndentationLeft = 36;
        [U]mypara.InsertRange(0, htmlarraylist);[/U]
        document.Add(mypara);
        document.Close();
    }
    catch (Exception exx)
    {
        Console.Error.WriteLine(exx.StackTrace);
        Console.Error.WriteLine(exx.Message);
    }
}

[/CODE]
i have a problem with underline coding..

Thanks in advance

Thanx a lot rohan =) i had solved it..

This is the code i'm using now that given the error..
[CODE]
public void SearchData(string CmpID)
{
//Define Class gdex
gdexClass gd = new gdexClass();

    //Open Database Connection 
    SqlConnection sqlconnection = gd.GetConnection();
    sqlconnection.Open();

    //Define Store Procedure
    SqlCommand Cmd = new SqlCommand("usp_TbCompany_sd", sqlconnection);
    Cmd.CommandType = CommandType.StoredProcedure;

    //Bind Data from tbe control to Stored Procudure 
    Cmd.Parameters.AddWithValue("@CmpID", CmpID);
    //Cmd.Parameters.AddWithValue("@StatCode", ddlCmpStateCode.SelectedValue);

    //Define one SqlDataReader 
    SqlDataReader objDR;
    objDR = Cmd.ExecuteReader(); // here procedure gets execute
    if (objDR.Read())
    {

        txtCmpStateCode.Text = objDR["CmpStateName"].ToString();

        ddlCmpStateCode.SelectedValue = ((ListItem)ddlCmpStateCode.Items.FindByValue(objDR["CmpStateCode"].ToString())).Value;
        ((ListItem)ddlCmpStateCode.Items.FindByValue(objDR["CmpStateCode"].ToString())).Selected = true;

        ListItem li = ddlCmpStateCode.Items.FindByValue(objDR["CmpStateCode"].ToString());
        if (li != null)
        {
            ddlCmpStateCode.SelectedValue = li.Value;
            li.Selected = true;
        }

        txtCmpEffDate.Text = objDR["CmpEffDate"].ToString().Substring(0, 10);
        txtCmpExpDate.Text = objDR["CmpExpDate"].ToString().Substring(0, 10);
        txtCmpDBlink.Text = objDR["CmpDBlink"].ToString();
    }
    // complete close datareader.
    objDR.Close(); 

}

[/CODE]

usp_TbCompany_sd = contain all information about the company but does not contain record of state
Error = NullReferenceException: Object reference not set to an instance of an object
i have added the latest code, it doesnt read it and still give the same error

Thanks again..i have tried this code but error apperar
[CODE]
Object reference not set to an instance of an object.
[/CODE]

May be this is because of the record from ddlCmpStateCode is taken form other table..am i right?

this is my stored procedure
[CODE]
ALTER PROCEDURE [dbo].[usp_TbCompany_sd]

@CmpID nvarchar(10)

AS
BEGIN

SET NOCOUNT ON;

SELECT *
from Tb_Company 
WHERE CmpID=@CmpID

END

[/CODE]
should i select from other table too? which is table state that store the record state..
but there is no CmpID in table state

thank you very much..
i also want to apply this code to dropdownlist but it not display any data.. i have make some changes to selected.value but also cannot make it..

[CODE]
txtCmpCode.Text = objDR["CmpCode"].ToString();
txtCmpName.Text = objDR["CmpName"].ToString();
txtCmpAddr1.Text = objDR["CmpAddr1"].ToString();
txtCmpAddr2.Text = objDR["CmpAddr2"].ToString();
txtCmpCityCode.Text = objDR["CmpCityCode"].ToString();
txtCmpCityName.Text = objDR["CmpCityName"].ToString();
txtCmpZip.Text = objDR["CmpZip"].ToString();
ddlCmpStateCode.SelectedValue = objDR["CmpStateCode"].ToString();
[/CODE]

Hi..
now i'm working with asp.net c#.. i want to view the data from database in the textbox in order to make editing to the data is avaiable..but i'm using user stored procedure..

now this is my code where i want to display the data..
[CODE]
<tr>
<td class="style1">Company Code </td>
<td>:</td>
<td>
<asp:TextBox ID="txtCmpCode" runat="server" Width="80" BorderStyle="Groove" MaxLength="10" ReadOnly="true"></asp:TextBox

        Company Name: <asp:TextBox ID="txtCmpName" runat="server" Width="217" BorderStyle="Groove">      
    </td>
</tr> [/CODE]

for the back end code is
[CODE]
protected void Page_Load(object sender, EventArgs e)
{
string strCompCode = Request.QueryString["comp_code"].ToString();
SearchData(strCompCode);
}
//SearchData
public void SearchData(string CmpCode)
{
//Define Class gdex
gdexClass gd = new gdexClass();

    //Open Database Connection 
    SqlConnection sqlconnection = gd.GetConnection();

    //Define Store Procedure
    SqlCommand Cmd = new SqlCommand("usp_TbCompany_sc", sqlconnection);
    Cmd.CommandType = CommandType.StoredProcedure;

    //Bind Data from tbe control to Stored Procudure 
    Cmd.Parameters.AddWithValue("@CmpCode", CmpCode);

    Cmd.Parameters.Add("@CmpCode", SqlDbType.NVarChar, 10);
    Cmd.Parameters.Add("@CmpName", SqlDbType.NVarChar, 100);

    String Comp_Code = (string)Cmd.Parameters["@CmpCode"].Value;
    String Comp_Name = (string)Cmd.Parameters["@CmpName"].Value;

    Cmd.Connection = sqlconnection;
    sqlconnection.Open();

    txtCmpCode.Text = Comp_Code;
    txtCmpName.Text = Comp_Name;
    sqlconnection.Close();

[/CODE]

for the txtCmpCode is successfully display because of the parameter passing, but for the rest i dont know what should i do else..i had tried many ways but not solve yet..
please anybody can help me..

i just make some changes to your code and now it works..

[CODE]
string strCompCode = Request.QueryString["comp_code"];
[/CODE]

thank you very much rohand =)

Thanks fro your response..
but, i should put it in aspx.cs right?
i had put in page_load but error
non-invocable member 'System.web.HttpRequest.QueryString' cannot be use like a method..

anything should i put in together?