|
You could do that with reflection, I guess, but a far better way is to write a recursive functon to work through the pages Controls collection finding textboxes and setting them accordingly. Or, just put them in an array you can go over.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi...
All I've database table named : tblCategory.
The Table's structure is like :
ChildID-------Category Name---------ParentID
1------------ Category 1 ---------- 0
2------------ Category 2 ---------- 1
3------------ Category 3 ---------- 1
4------------ Category 4 ---------- 2
5------------ Category 5 ---------- 3
6------------ Category 6 ---------- 4
Here, For Example :
'Category 4' is the Child Record of 'Category 2' because 'Category 4's ParentID is 2.
Now, I want to find the all child record from ParentID.
Like : If I entered simple ParentID 1, then I want the all nested child record of Parent 1.
So, If Possble, Please give me sql query of it or any relavant solotuion.
Thanks is advance.
Regards,
Abhi
|
|
|
|
|
Just fire a query on ur datatable saying:
DataRow[] foundParent ;
foundParent = dt.Select("ParentID = 1");
if (foundParent.GetUpperBound(0) > 0)
{
for (Int32 intRowCnt = 0; intRowCnt <= foundParent.GetUpperBound(0); intRowCnt++)
{
foundChild = dt.Select("ParentID=" + foundParent[intRowCnt]["ChildID"]);
if (foundChild.GetUpperBound(0) > 0)
{
//Do something
}
for (intColCnt = 0; intColCnt <= dt.Columns.Count - 1; intColCnt++)
{
//Do something
}
}
and write this in for loop.
|
|
|
|
|
ASP.NET 2.0 wrote: and write this in for loop.
Means, I have to write this whole code in for loop of each and every row of DataTable or this is enough ??
Thanks for your posting. Please, Reply of this my confusion.
Thanks in advance.
Regards,
Abhi
|
|
|
|
|
This is the code:
DataRow[] foundParent ;
foundParent = dt.Select("ParentID = 1");
if (foundParent.GetUpperBound(0) > 0)
{
for (Int32 intRowCnt = 0; intRowCnt <= foundParent.GetUpperBound(0); intRowCnt++)
{
foundChild = dt.Select("ParentID=" + foundParent[intRowCnt]["ChildID"]);
if (foundChild.GetUpperBound(0) > 0)
{
//Do something
}
for (intColCnt = 0; intColCnt <= dt.Columns.Count - 1; intColCnt++)
{
//Do something
}
}
|
|
|
|
|
As Per Ur Requirement the query below is
select p.parentid,p.childname,p.childid from tblCategory , tblCategory p
where c.childid=p.parentid
1 Category 2 2
1 Category 3 3
2 Category 4 4
3 Category 5 5
4 Category 6 6
and also if u want to execute the query with where clause then
select p.parentid,p.childname,p.childid from #temp c , #temp p
where c.childid=p.parentid
and p.parentid=1
Hope It help u ....
Regards
Tarini Singh
Sr. Software Engineer. (IT)
tksingh@zenta.com
|
|
|
|
|
i have used code:
---------------
imgbtnSub.Attributes.Add("onclick", "javascript: return window.alert('Agree Terms & Conditions to proceed');");
it works fine,but as i have given this under imgsub_click()
it pop-up message only during second click
i even tried giving onload, not working,
hw to pop-up during first time itself
Thanks in advance,
Priya.
|
|
|
|
|
Hi priya,
Does u give this code
"imgbtnSub.Attributes.Add("onclick", "javascript: return window.alert('Agree Terms & Conditions to proceed');");" line in page load. if not than do the same.
Hello Forum
Always be in touch to help about the topic ASP.NET
|
|
|
|
|
Priya Cool wrote: it works fine,but as i have given this under imgsub_click()
it pop-up message only during second click
Can you put your code snippet here?
Paras Kaneriya The difference between genius and stupidity is that genius has its limits.
|
|
|
|
|
There are many ways to do the alert, but while asking about any thing from members in this forum u should equally need to give reply for the questions asked about your query.
Hello Forum
Always be in touch to help about the topic ASP.NET
|
|
|
|
|
if (!IsPostBack)
{
if (CheckBox1.Checked == false)
{
Button1.Attributes.Add("onclick", " window.alert('Agree Terms & Conditions to proceed');");
}
}
i tried like tis, every time it pop-ups the message
even after checking the checkbox
Thanks in advance,
Priya.
|
|
|
|
|
Write a javascript function and u check there whether the checkbox is checked or not and then show the alert msg and add this
Button1.Attributes.Add("onclick", "Myfun();");
Hope this helps u??
|
|
|
|
|
Hi
try to put your Add attribute code to put under page load as given below and i am sure your prob got solved.and remove code from imgsub_click().
if (!IsPostBack)
{
ImageButton1.Attributes.Add("onclick", "javascript: return window.alert('Agree Terms & Conditions to proceed');");
}
thanks
bhavesh
|
|
|
|
|
Hello
I am storing images in SQL 2005 using the Varbinary(Max) type, however I am looking for a way to display the images on an Image within a template for a datalist.
So far the only suggestions I have found is to save the image then use the fiels URL to set the Image's ImageURL location but this defeates the point from my perspective of saving the Images in the DB.
If somebody could point me in the direction of the best way to do this I would be grateful.
|
|
|
|
|
There's really no other way. Your best bet is to store the images locally and store the paths in your database. You can do a BinaryWrite to pass a byte array that represents a single image back, if that's all you intend to display, but you can't do that for images in the middle of a page.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi All,
I am build a treegrid using Javascript and whenever I refresh the page or running it for the first time I get the error saying:
"A script on this page is causing Internet Explorer to run slowly, If it continues to run, your computer may become unresponsive.
Do you want to abort the script?"
and Yes No Buttons
Can anyone tell me what might be the problem??
Thanks in advance....
|
|
|
|
|
The problem is obvious. Your script sucks. It's taking too long and IE is reporting the fact.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Is there any way to remove that error??
|
|
|
|
|
You can probably tell your local IE that you don't mind if it takes 5 minutes to run. But, you can't stop others seeing it, no. You have to repair the script.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi,
Functional Requirement is this, We need to display the Data in gridview control in hirerchy.What exactly play on code projects of subject and messge grid in discussion page.
Expecting clue if Is Any.
Thanks & Regards
Tarini Singh
Sr. Software Engineer. (IT)
|
|
|
|
|
I dont know how much is this helpful but I think u r looking something like this. Check this:
http://www.codeproject.com/jscript/wsGridCtrl.asp
|
|
|
|
|
Hello all
I have two websites and both the sites have common userid and password but different databases i.e user created on one site is automatically created on the other site. now what i want is that if the user is logged in on one site and if he clicks on some link for the other site, he should not be required to log in on the other site. His session of the logged in site should be carried to the other site also. Is is possible
Regards
|
|
|
|
|
Do the sites run on the same server ? If so, you should be able to centralise your membership database so it tracks who is online for both. You could also use a cookie, but that is hideously insecure.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Yes, the sites are on the same server. Membership database? U mean to say that if a user is online it should be stored in the database or something like that........
Regards
|
|
|
|
|
sabby2006 wrote: U mean to say that if a user is online it should be stored in the database or something like that........
Yes, that's about the only way you will do it. The database is what the sites have in common, so it's where they can look for member info. They will have seperate sessions, which is what you'd expect and want. Unless you host one app, and the two actual apps are just subfolders of the main root.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|