473,586 Members | 2,792 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

javascript for html buttons in c#

1 New Member
I have a problen regarding javascript that , i m generating html buttons in c# file for asp.net webpage and applying javascript on that html button but it is giving exception .The code is

try
{
string sql = "Select AdFile, AdLink, '" + StringFormat.To String() + "' as Sampleview, Adweightage, " +
"'<input type=\"checkBox \" value=\"on\" name=\"selectCh k' + AdFile + '\">' as cusSelect, " +
"'<input type=\"text\" size=\"10\" value=\"' + str(Adweightage ) + '\" name=\"txtAdwei ghtage' + AdFile + '\">' as cusAdweightage, " +
"'<input type=\"submit\" value=\"Delete\ " onclick=\"retur n confirm('Are you sure want to delete?');\" name=\"btnDel' + AdFile + '\">' as cusDel, " +
" iif(IsEnabled,' <input type=\"checkBox \" title=\"Enable\ " onclick=\"check Adcredits(this. name)\" checked value=\"on\" name=\"chkEnabl e' + AdFile + '\">','<input type=\"checkBox \" onclick=\"check Adcredits(this. name)\" title=\"Enable\ " value=\"on\" name=\"chkEnabl e' + AdFile + '\">') as cusEnable " +
" FROM BuinessAds " +
" WHERE BizId =" + BusinessID.Valu e + " AND AdType='Custom' ";
onclick="return confirm('Are you sure want to delete?');"
OdbcDataAdapter bizDataAdapter = new OdbcDataAdapter (sql, con);
DataTable dt = new DataTable();
bizDataAdapter. Fill(dt);
Sep 19 '07 #1
3 1272
jhardman
3,406 Recognized Expert Specialist
I have a problen regarding javascript that , i m generating html buttons in c# file for asp.net webpage and applying javascript on that html button but it is giving exception .The code is

try
{
string sql = "Select AdFile, AdLink, '" + StringFormat.To String() + "' as Sampleview, Adweightage, " +
"'<input type=\"checkBox \" value=\"on\" name=\"selectCh k' + AdFile + '\">' as cusSelect, " +
"'<input type=\"text\" size=\"10\" value=\"' + str(Adweightage ) + '\" name=\"txtAdwei ghtage' + AdFile + '\">' as cusAdweightage, " +
"'<input type=\"submit\" value=\"Delete\ " onclick=\"retur n confirm('Are you sure want to delete?');\" name=\"btnDel' + AdFile + '\">' as cusDel, " +
" iif(IsEnabled,' <input type=\"checkBox \" title=\"Enable\ " onclick=\"check Adcredits(this. name)\" checked value=\"on\" name=\"chkEnabl e' + AdFile + '\">','<input type=\"checkBox \" onclick=\"check Adcredits(this. name)\" title=\"Enable\ " value=\"on\" name=\"chkEnabl e' + AdFile + '\">') as cusEnable " +
" FROM BuinessAds " +
" WHERE BizId =" + BusinessID.Valu e + " AND AdType='Custom' ";
onclick="return confirm('Are you sure want to delete?');"
OdbcDataAdapter bizDataAdapter = new OdbcDataAdapter (sql, con);
DataTable dt = new DataTable();
bizDataAdapter. Fill(dt);
moved to .NET forum
Sep 19 '07 #2
Plater
7,872 Recognized Expert Expert
Uhh you are aware that you're generating a pretty much worthless string right?
All of those special asp calls have to happen at the parser on the server side.
What you have is probably just going to wrtie plain html out to a page.
Sep 19 '07 #3
davef
98 New Member
Huh? What are you trying to accomplish with that string??
Sep 19 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

14
5446
by: tshad | last post by:
I posted this on the asp.net group, also. I wasn't sure whether this was an asp.net problem or a javascript problem. I have a page that was originally created from a program I found on the net that works well as an html page. It brings up a modal popup window that I have been trying to work out for days now and this was the closest I...
9
4902
by: tshad | last post by:
This is from my previous post, but a different issue. I have the following Javascript routine that opens a popup page, but doesn't seem to work if called from an asp.net button. It seems to work fine from a link. The button does bring up the popup window, but when I press the links on the page, it doesn't return or close the window. ...
0
8199
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8336
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7950
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8212
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5710
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5389
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3863
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1447
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1175
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.