|
I need to iterate through the rows in a datagrid and record the number of rows that are checked (checkboxes in a templatecolumn). I need to do that on the client side. The object of this is to either submit if none of the checkboxes are checked or prompt the user to save records (via javascript confirm). The code-
function dtgValidateCheckBox(grdid, objlist)
{
//if user clicks on "Search", then this method
//will check to see if there are products
//selected but not saved. User is prompted
//to either continue and loose items in the cart
//or cancel and then click on save items to cart.
//attribute is added from the server side to fire this method.
var chkbox;
var i=20;
var iCount=0;
chkbox=document.getElementById(grdid + "__ctl" + i + "_" + objlist);
while(chkbox!=null){
if(chkbox.checked == true)
{
iCount++;
}
i=i+1;
chkbox=document.getElementById(grdid +
'__ctl' + i + '_' + objlist);
}
if(iCount>0)
{
return confirm("There are unsaved items in your cart. Do you wish to continue?");
}
}
Any Ideas?
|
|
|
|
|
hi wood0601
just try to send count of rows in grid and pass the value to javascript. I hope it will easy to u.
k.ravi sankar
|
|
|
|
|
Thanks priyaram1. Not sure how. Do you have any example code?
|
|
|
|
|
This sample script for validating the textboxes in datagrid.
function quanvalid(k)
{
var a = new Array(k);
var count =2;
var sam;
var falge=0;
for(var i=0;i<k;i++)
{
="" if(count="" <="" 10)
="" count="0" +count;
="" }
="" a[i]="CtrlPOUpdateControl1_POGrid_ctl" +count+'_txtqtynow';
="" sam="document.getElementById(a[i]).value;
" if(sam="" !="0)
" return="" true;
="" count++;
="" alert("should="" enter="" quantity");
="" false;
="" }
=""
<div="" class="ForumSig">k.ravi sankar
|
|
|
|
|
priyaram1. Thanks for the info. Your example gave me what I needed!
|
|
|
|
|
Is it a wise idea to use master page in a website. The name mangling problem in master page will affect the JavaScript and CSS style. The designer’s logics will sometimes breaks when the web developer applies master pages.
My question is :
1. how to solve name mangling problem
2. Keeping the JavaScript code as separate .js file (better solution for traffic and maintains)
3. Advantages and disadvantages in using master pages
4. performance
Does every one prefer using master pages? After reading several articles I am still confused on using master pages. Advice me...
|
|
|
|
|
You can replace the control's name in the page load event like this:
abstract string script = "[Label1ID].innerHTML = 'Hello!';";
abstract string scriptKey = "SayHello";
abstract bool addScriptTags = true;
protected void Page_Load(object sender, EventArgs e)
{
script = script.Replace("[Label1ID]", Label1.ClientID);
ClientScript.RegisterStartupScript(this.GetType(), scriptKey, script, addScriptTags);
}
|
|
|
|
|
1) What do you mean? How does it affect CSS and JavaScript?
2) Why can't you?
3) Advantages: Conformity throughout the application.
4) Not an issue
only two letters away from being an asset
|
|
|
|
|
Hi,
1. if we add a text box named as "TextBox1" inside a content page "ContentPlaceHolder1". Then asp.net generate the name "ctl00_ContentPlaceHolder1_TextBox1" on run time. This name mangiling problem will affect the javascripts that written by using the 'TextBox1'. the CSS that applies to a particual named tag (#topImage) will also get effected.
2. if name mangiling happens how can use the below script inside a .js file
var textbox1 = document.getElementById('TextBox1');
3. yes i agree with that. How to seperate programmer and designer logics.
4. i agree with that
|
|
|
|
|
The name mangaling is not a cause of using a master page. Using any container will cause this so as to uniquely identify the control on the page. You just have to understand this process and code accordingly. I have never had a problem with this, in javascript or with dynamic CSS.
only two letters away from being an asset
|
|
|
|
|
I have a details view that a user is editing a txt box called txtComments. When they hit update it is writing those comments to a db. I also want to write those comments to an audit table. So during DetailsView1_ItemUpdating I am having it write to another table. How can I get the contents of txtComments into my db? Is there a dtv.field command or something I can call?
-- modified at 12:04 Wednesday 13th June, 2007
Never mind I figured it out. For others to pull items out of the Details view, set another field as a data key and the following syntax will drop it to a variable:
DetailsView1.DataKey(1)
Where (1) is the key id of the field you are trying to pull. Remember you start off with 0!
BJJONESEY
|
|
|
|
|
hello:
i wanna ask if i can get the installer of the print activeX of crystal report,
iam developing a website using asp.net and installed it on a server. when i tried to access the website from a client PC the report didnt printed. i think its because of the activeX component is missing.
the client is connected through a network with the server and dont have an internet connection
have any idea why the report didnt printed or how to get the activeX installer of the print crystal report. thanx
|
|
|
|
|
I have a template column in a grid view with a button that has the command name set to "Edit". I handle the button click event myself and do not want the grid to fire the RowEditing event. Is there any to turn this default behavior off?
-Mike.
|
|
|
|
|
hi
in the RowEditing Event write
Grid.EditRowIndex = -1;
bye
|
|
|
|
|
Thanks, but not exactly what I'm looking for. I want to stop the event form firing all together.
-Mike.
|
|
|
|
|
I've written a session state provider and tested it in my own app. I now want to set it up to work from within an ASP.Net Application.
My class derives from SessionStateStoreProviderBase and is in an assembly that is referenced from my ASP project and set to CopyLocal true.
I've added this to the web config file inside a sessionState element:
<providers>
<add name="MySqlStateStore"
type="MySQLIntegration,MySqlStateStore"
connectionStringName="ASPSessionState"
writeExceptionsToEventLog="false" />
</providers>
I've tried using a dot or a comma and using the dll name, the namespace, the class name etc in various combinations but I keep getting the following error.
Could not load file or assembly 'MySqlStateStore' or one of its dependencies. The system cannot find the file specified.
Does anyone know what i have to do to the dll or what i have to put in the type attribute in the web.config to get this to work? I've found loads of people asking related questions but not many answers as yet. All the examples i've found on MSDN or elsewhere talk loads about writing the class but seem to think that the web.config just sorts itself out.
Thanks for any help or references anyone can give me
Russell
|
|
|
|
|
Hi All
How can I convert a number to type double in javascript. Pls help. Its urgent.
Thanks in advance.
|
|
|
|
|
Javascript doesnt have the data types.
|
|
|
|
|
I mean, I have a number , I need that number to be display like double.
If number is 34, it should be 34.00.
How is that done.
|
|
|
|
|
|
How acn I read all certificates (using C# code + asp.net 2.0) which are installed in my IE
browser?
Regards
I Love SQL
|
|
|
|
|
can anyone tell me code for below scenario
i populate gridview at pageload.to tht obtained gridview i need to add extra 2 colums one is button n another one is textbox whn i click on button i get popup window in which i enter some value tht value must enter in gridviews textbox.
suppose i have gridview with 5 records 5 buutons n 5 textboxes have to entered
how to get id of those textbosex?????
bye
|
|
|
|
|
Since you are new you should know a few things about the boards:
1. Please read the forum guidelines. Message titles such as 'help' or 'urgent' are often ignored since they give no indication what the problem is.
2. You are asking for code. More people will help you if you at least write some code then ask you questions such as 'why is this giving an error' or 'why does this code not do xyz?' Sometimes by searching the articles (or previous messages) you can find code snippets that are close to what you need.
______________________
stuff + cats = awesome
|
|
|
|
|
How do you add in refernces in VS 2005. In VS 2003 you just right-clicked the references folder and slected which refernces to add and it added it in and you could see it. How do you do same in VS 2005??
Anyone any ideas??
Thanks,
macca
|
|
|
|
|
Website --> Add Reference...
Regards,
Jay
|
|
|
|