Click here to Skip to main content
16,004,944 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: Call classic asp page from asp.net Pin
Blue_Boy10-Jul-09 21:24
Blue_Boy10-Jul-09 21:24 
AnswerRe: [Message Deleted] Pin
Abhijit Jana10-Jul-09 21:41
professionalAbhijit Jana10-Jul-09 21:41 
GeneralRe: [Message Deleted] Pin
astrovirgin10-Jul-09 21:46
astrovirgin10-Jul-09 21:46 
GeneralRe: [Message Deleted] Pin
Blue_Boy10-Jul-09 21:51
Blue_Boy10-Jul-09 21:51 
GeneralRe: [Message Deleted] Pin
Abhijit Jana10-Jul-09 21:55
professionalAbhijit Jana10-Jul-09 21:55 
Questionhelp me Pin
priyu 200910-Jul-09 20:48
priyu 200910-Jul-09 20:48 
AnswerRe: help me Pin
Abhijit Jana10-Jul-09 20:52
professionalAbhijit Jana10-Jul-09 20:52 
Questiontextbox inside template text issue Pin
sacwchiri10-Jul-09 20:38
sacwchiri10-Jul-09 20:38 
hello i run into a little problem that i cant seem to understand.

I have a details view that i use to show, edit and insert data into a database, but when i try to insert a generated key into a text box in a template inside the details it says the object reference is not set to an instance of an object. But the weird thing is if i call the same method during the page load it works.... so why might this be???

protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Request.QueryString["id"] != null)
            {
                dataEmp = empleado.getEmployeeById(Request.QueryString["id"]);
                DetailsView1.DataSource = this.dataEmp;
                DetailsView1.DataBind();
            }
            else
            {
                dataEmp = empleado.getEmployeeById("noId");
                DetailsView1.DefaultMode = DetailsViewMode.Insert;
                DetailsView1.DataSource = this.dataEmp;
                DetailsView1.DataBind();

                btnNew_Click(sender, e); //works if called here
            }
        }
    }

protected void btnNew_Click(object sender, EventArgs e)//does not worked when user clicks on button
    {
        DetailsView1.ChangeMode(DetailsViewMode.Insert);
        
        ((TextBox)DetailsView1.Rows[0].FindControl("txtID")).Text = generateKey();
       
        btnInsert.Visible = true;
        btnNew.Visible = false;
        Response.Write("clear form");
        
    }
private string generateKey()
    {   
        Random numb = new Random();
        string generatedKey =   ((char)((short) 'A' + numb.Next(26))).ToString() + 
                            ((char)((short) 'A' + numb.Next(26))).ToString() + 
                            ((char)((short) 'A' + numb.Next(26))).ToString() + 
                            ((char)((short) '1' + numb.Next(8))).ToString() + 
                            ((char)((short) '0' + numb.Next(9))).ToString() + 
                            ((char)((short) '0' + numb.Next(9))).ToString() +
                            ((char)((short) '0' + numb.Next(9))).ToString() +
                            ((char)((short) '0' + numb.Next(9))).ToString();
        if (numb.Next(1, 2) == 1)
            generatedKey += 'F';
        else
            generatedKey += 'M';

        return generatedKey;
    }

QuestionSlideshow extender with database records..., Pin
Member 387988110-Jul-09 19:30
Member 387988110-Jul-09 19:30 
AnswerRe: Slideshow extender with database records..., Pin
Abhijit Jana10-Jul-09 20:58
professionalAbhijit Jana10-Jul-09 20:58 
Questionproblem in reading data from (.dat) file Pin
souravghosh1810-Jul-09 19:20
souravghosh1810-Jul-09 19:20 
AnswerRe: problem in reading data from (.dat) file Pin
Parwej Ahamad10-Jul-09 19:28
professionalParwej Ahamad10-Jul-09 19:28 
AnswerRe: problem in reading data from (.dat) file Pin
Abhijit Jana10-Jul-09 20:48
professionalAbhijit Jana10-Jul-09 20:48 
QuestionReorderlist control problem.. Pin
RajpootRohan10-Jul-09 18:08
professionalRajpootRohan10-Jul-09 18:08 
AnswerRe: Reorderlist control problem.. Pin
Parwej Ahamad10-Jul-09 19:25
professionalParwej Ahamad10-Jul-09 19:25 
GeneralRe: Reorderlist control problem.. Pin
RajpootRohan10-Jul-09 19:55
professionalRajpootRohan10-Jul-09 19:55 
GeneralRe: Reorderlist control problem.. Pin
Parwej Ahamad10-Jul-09 20:02
professionalParwej Ahamad10-Jul-09 20:02 
GeneralRe: Reorderlist control problem.. Pin
RajpootRohan10-Jul-09 20:28
professionalRajpootRohan10-Jul-09 20:28 
AnswerRe: Reorderlist control problem.. Pin
Abhijit Jana10-Jul-09 20:54
professionalAbhijit Jana10-Jul-09 20:54 
GeneralRe: Reorderlist control problem.. Pin
RajpootRohan17-Jul-09 21:36
professionalRajpootRohan17-Jul-09 21:36 
Questionhelp me , user -defined control Pin
chienbq0709i10-Jul-09 9:21
chienbq0709i10-Jul-09 9:21 
AnswerRe: help me , user -defined control Pin
Abhijit Jana10-Jul-09 9:23
professionalAbhijit Jana10-Jul-09 9:23 
AnswerRe: help me , user -defined control Pin
Manas Bhardwaj10-Jul-09 10:24
professionalManas Bhardwaj10-Jul-09 10:24 
JokeRe: help me , user -defined control Pin
Abhijit Jana10-Jul-09 10:45
professionalAbhijit Jana10-Jul-09 10:45 
QuestionInsert data from Dataset to Multipule tables in SQLServer Pin
Ash_VCPP10-Jul-09 5:00
Ash_VCPP10-Jul-09 5:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.