|
Looks like the first control in the Controls collection is the RepeaterHeaderItem, it can be found there with FindControl.
Won't finding the the Items collection.
Thanks for the reply.
|
|
|
|
|
Hi~
I have a user control with a gridvew that contains a checkbox and textbox. The textbox is set to Enabled=false by default.
On Page 1: the Header of the checkbox column is "Remove" and there is a Save button. On this page I need all UNCHECKED rows to have an enabled textbox
On Page 2: the Header of the checkbox column is "Select". On this page I need all CHECKED rows to have an enabled textbox and all others to be disabled.
How do I create the javascript for these requirements? I am using asp.Net and C#.
Here is my sample code:
UserControl.ascx:
<asp:gridview xmlns:asp="#unknown">
<asp:templatefield headertext="Select">
<itemtemplate>
<asp:checkbox id="chkBox" runat="server" checked="<%#Bind(" />
</itemtemplate>
</asp:templatefield>
<asp:templatefield headertext="Size">
<itemtemplate>
<asp:textbox id="txtSize" runat="server" text="<%#Bind(" size=")%>" readonly="false" enabled="false" enabledviewstate="true"> </asp:textbox>
</itemtemplate></asp:templatefield></asp:gridview>
Current JavaScript:
function CheckChanged(cb, tb)
{
var chkBox=document.getElementById(cb);
var txtSize=document.getElemetnById(tb);
if(chkBox.checked)
{
txtSize.disabled=true;
txtSize.style.backgroundColor=\"lightgray\";
}
else
{
txtSize.disabled= false;
}
}
This javascript is getting written via a StringBuilder in the .aspx.cs file of each page. Currently, I can only get the script to work properly for Page 2. On Page 1, I need the textbox to always be enabled unless something is checked. What is the best way to enable the textboxes on this page?
Thanks!
modified on Wednesday, February 25, 2009 9:39 AM
|
|
|
|
|
Can you use an ajax solution to post back and enable / disable all of the controls in server side code?
Otherwise, your best bet is to create a public static string property in server side code such as textBoxIds. On the item databound event of your grid,
set
<br />
textBoxIds += (textbox)row.findcontrol("txtbox").clientId + ",";<br />
Then add javascript to iterate your comma separated string on client.
<br />
<br />
var textBoxIds = '<%= this.textBoxIds %>';<br />
<br />
<br />
var Ids = textBoxIds.split(',');<br />
for (var i = 0; i < Ids.length; i++) {<br />
var tb = document.getElementById(Ids[i]);<br />
if (tb != null) {<br />
tb.disabled = true;<br />
}<br />
}<br />
Good luck.
I didn't get any requirements for the signature
|
|
|
|
|
Would the ajax solution be better to use? I am not familiar with ajax so I am not sure how to do this.
Thanks.
|
|
|
|
|
|
Thank you all for helping me. Also, ToddHileHoffer, thanks for posting the link.
|
|
|
|
|
Hello Experts,
In populating a DataGrid a couple options include (but not limited to):
- use of a Typed DataSet
- use of a Custom Collection of Objects
From some reading, one of the (apparent) drawbacks of a Typed DataSet is performance. One alternative is to use Custom Collections instead.
Has anyone done any benchmarking on this issue (of populating a Gridview using Typed DataSet VS Custom Collection)?
“You will never be a leader unless you first learn to follow and be led.”
–Tiorio
"Coming together is a beginning, staying together is progress, and working together is success." Henry Ford
|
|
|
|
|
Mogaambo wrote: Has anyone done any benchmarking on this issue (of populating a Gridview using Typed DataSet VS Custom Collection)?
No. But I never use either. I just use a regular data table, seems easy and efficient.
I actually used to make entity classes and use generic lists. I've also messed around with LINQ to SQL and the Entity framework, but I have reverted back to simply using data tables for ease of coding / maintainability.
If you are interested in benchmarking, try using this tool. http://www.jetbrains.com/profiler/[^]
It is great and you can do your own tests to see what works best for your situation.
I didn't get any requirements for the signature
|
|
|
|
|
How can I make software lock ( or Activation Code) for web applications ?
Your prompt reply will be appreciated …
regards
|
|
|
|
|
Given that it needs to be hosted on a machine connected to the internet, it's actually pretty easy. But, the hard part is, I am not sure if you can package your code in a dll in the newer versions of ASP.NET. If you ship your code, people can obviously change it, although your business tier could enforce activation, then all you're giving away is your UI.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
is it possible to use vb.net form inside asp.net to commiunicate with db.
|
|
|
|
|
|
varsha dixit wrote: no
LOL.
Edit. I misread the original question. I thought he asked if he could use VB.Net to communicate with a database.
I didn't get any requirements for the signature
modified on Tuesday, February 24, 2009 2:50 PM
|
|
|
|
|
that is funny, i misread it as
is it possible to use vb.net from inside asp.net to commiunicate with db.
Yusuf
|
|
|
|
|
Yeah, I did the same.
I didn't get any requirements for the signature
|
|
|
|
|
I recommend reading the forum guidelines. How is ASP.NET as good subject ?
Also, the answer is maybe, but it would be a stupid thing to do.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Is there a way to open the MDB file in the browser and be able to edit it?
|
|
|
|
|
No, not directly...an .mdb is a database file, its binary. You need to attach that database to a SQL Server instance, such as SQL Server 2005 Express, and query it to retrieve and display data.
|
|
|
|
|
Or open it in Access, right ?
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Sure, you could open it in access. Not exactly sure how that will get it visible on the web, however.
|
|
|
|
|
I didn't get that he wanted to view it in SQL Server across the web, but surely if SQL Server can see it, Access can ?
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Perhapse I misunderstood the question, but I got that he wanted to view data from the MDB in a web site. Regardless of whether it is attached via Access, or SQL Server Express, to view data from an MDB in a browser, i.e. from a web site, you would need to write a program around the MDB. Assuming I didn't completely miss the point of the question...
|
|
|
|
|
Actually, i don't want to see the data. Lets say for example you open an mdb file on your local machine and you are able to view the table structure, modify the table structure, view the data, etc.
My question is how can i give this similar functionality in the browser. The mdb is located on the server and I will build a webpage that will open the this mdb within the browser and users will be able to view the table structure, etc. They don't need to have microsoft access installed on there machine. and if they do have it this should still open in the browser.
|
|
|
|
|
So, if your need is that you need to give users the ability to edit your .mdb as if they were using Access, but on the web...then you are still left with writing a web application to provide that functionality. However, I wouldn't recommend actually sharing the .mdb directly through the web. If you choose not to host the database within SQL Server 2005, then you will have to deal with the strict limitations of the Access OLEDB (or maybe its the ODBC) provider...namely limitations with concurrent users (I think 10 is the recommended max). If you do host the mdb in SQL Server 2005, then you won't have the connection limitation, and you'll probably gain a variety of other benefits that SQL Server has to offer.
As for providing similar functionality to Access through the browser...your best bet is to check out some of the Web Control packages that many companies provide. There are some that provide Microsoft Office 2003 and 2007 like web UI components, including very interactive data grid controls (many of the ads on this site advertise such control packages). That would be the easiest and quickest (and probably the cheapest) way to provide an Access-like UI to your users through the web for editing your database. Beyond the UI...I can imagine there might be some fairly difficult challenges regarding managing concurrent usage of a single database in an Access-style UI. Generally, most web sites use databases transactionally...retrieving information, displaying one record for edit, and inserting/updating/deleting one record at a time. The Access UI allows bulk, batch (or perhapse just very rapid row-by-row) editing of data in tables, which is a whole different ball game for a web UI.
|
|
|
|
|
I've got an image control on a page that has its ImageURL property set based on a web address in a database table. Now, if the web link doesn't work, I get a box on my page with the red X. In cases like this I want to display a stock "No Photo Available" instead of the red X box. Is there a property I can set that will help me with this?
|
|
|
|