Click here to Skip to main content
15,890,882 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: Button in Master Page Validates content section textboxes,How to avoid Pin
sepel31-Dec-08 20:12
sepel31-Dec-08 20:12 
QuestionSending email from website Pin
CrimeanTurtle200831-Dec-08 17:37
CrimeanTurtle200831-Dec-08 17:37 
AnswerRe: Sending email from website Pin
Christian Graus31-Dec-08 17:50
protectorChristian Graus31-Dec-08 17:50 
GeneralRe: Sending email from website Pin
CrimeanTurtle200831-Dec-08 18:11
CrimeanTurtle200831-Dec-08 18:11 
GeneralRe: Sending email from website Pin
Christian Graus1-Jan-09 2:31
protectorChristian Graus1-Jan-09 2:31 
Questiondynamically adding buttonfields to gridview Pin
g00fyman31-Dec-08 15:25
g00fyman31-Dec-08 15:25 
AnswerRe: dynamically adding buttonfields to gridview Pin
g00fyman31-Dec-08 15:50
g00fyman31-Dec-08 15:50 
GeneralRe: dynamically adding buttonfields to gridview Pin
g00fyman31-Dec-08 16:40
g00fyman31-Dec-08 16:40 
ok, I have tried everything I can think of and cannot do it server side. I have tried ButtonFields, TemplateFields, CommandFields and all offer different access to the button but it still renders it's own javascript that I cannot change.

So ... I have resolved it with client side code let the gridview to render it out.
If anyone requires the code, see below.

If anyone has a server side solution please let me know.

Thanks,
Maurice

Client Code:
/* function to handle delete confirmation placement on gridview delete buttons */
function setupDeleteConfirmation() {
  var imgs = document.getElementsByTagName('input');
  for (var i in imgs) {
    if (imgs[i].title == 'Delete' && imgs[i].className == 'delete-button') {
      imgs[i].oldClick = imgs[i].onclick;
      imgs[i].onclick = function() {
        var answer = confirm('Are you sure you want to delete this item?\n\nClick OK to delete this item or Cancel to keep it.');
        if (answer == true) { this.oldClick; }
        return answer; 
      };
    }
  }
}


Server Code:
protected override void OnInit(EventArgs e)
    {
      base.OnInit(e);

      if (DesignMode == false)
      {
        if (Page.ClientScript.IsClientScriptIncludeRegistered("_GridViewClicks") == false)
        {
          Page.ClientScript.RegisterClientScriptInclude("_GridViewClicks", Page.ClientScript.GetWebResourceUrl(GetType(), GRID_JS));
        }
      }
      
      // other stuff here
    }

protected override void Render(HtmlTextWriter writer)
    {
      base.Render(writer);

      writer.WriteLine("<script type="text/javascript"> // <![CDATA[");
      writer.WriteLine("  setupDeleteConfirmation(); // ]]>");
      writer.WriteLine("</script>");
    }

Questionpublishing pages using FTB program. Pin
ahlamasp31-Dec-08 7:18
ahlamasp31-Dec-08 7:18 
AnswerRe: publishing pages using FTB program. Pin
Not Active31-Dec-08 9:12
mentorNot Active31-Dec-08 9:12 
AnswerRe: publishing pages using FTB program. Pin
Christian Graus31-Dec-08 17:13
protectorChristian Graus31-Dec-08 17:13 
GeneralRe: publishing pages using FTB program. Pin
ahlamasp1-Jan-09 5:09
ahlamasp1-Jan-09 5:09 
QuestionPrecreated column in inherited gridview Pin
Member 202259231-Dec-08 6:39
Member 202259231-Dec-08 6:39 
QuestionEmail exist or not. Pin
kavitha_blueindia31-Dec-08 6:15
kavitha_blueindia31-Dec-08 6:15 
AnswerRe: Email exist or not. Pin
scottgp31-Dec-08 6:48
professionalscottgp31-Dec-08 6:48 
AnswerRe: Email exist or not. Pin
Christian Graus31-Dec-08 17:11
protectorChristian Graus31-Dec-08 17:11 
QuestionI want to create option like print and mail to friend in my site same as codeproject Pin
cooolguymca31-Dec-08 2:56
cooolguymca31-Dec-08 2:56 
AnswerRe: I want to create option like print and mail to friend in my site same as codeproject Pin
N a v a n e e t h31-Dec-08 3:01
N a v a n e e t h31-Dec-08 3:01 
AnswerRe: I want to create option like print and mail to friend in my site same as codeproject Pin
Aman Bhullar31-Dec-08 6:02
Aman Bhullar31-Dec-08 6:02 
QuestionHow to use FileUpload Pin
Muhammad Gouda31-Dec-08 2:17
Muhammad Gouda31-Dec-08 2:17 
AnswerRe: How to use FileUpload Pin
N a v a n e e t h31-Dec-08 2:52
N a v a n e e t h31-Dec-08 2:52 
GeneralRe: How to use FileUpload Pin
Abhijit Jana31-Dec-08 2:56
professionalAbhijit Jana31-Dec-08 2:56 
GeneralRe: How to use FileUpload Pin
N a v a n e e t h31-Dec-08 2:59
N a v a n e e t h31-Dec-08 2:59 
GeneralRe: How to use FileUpload Pin
Abhijit Jana31-Dec-08 3:31
professionalAbhijit Jana31-Dec-08 3:31 
AnswerRe: How to use FileUpload Pin
MarcelloTurnbull31-Dec-08 3:03
MarcelloTurnbull31-Dec-08 3:03 

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.