|
I am fetching product name and the corresponding link from the database i want to display the product name and when click on it i have to go the corresponding page.search button ia also there.the products similar to that we typed will also have to display.that's why i am using response.write.But I don't want to display these at the beginning of the page.if anyone have a solution for this plse send.
|
|
|
|
|
is it possible to diplay output in a specific position in a page without using controls in asp.net.I am fetching product name and the corresponding link from the database i want to display the product name and when click on it i have to go the corresponding page.search button ia also there.the products similar to that we typed will also have to display.that's why i am using response.write.But I don't want to display these at the beginning of the page.if anyone have a solution for this plse send.
|
|
|
|
|
hi all,
please help me i this, i wnt to make all text boxes inside the page are readonly true.but insted of doing for each textbox i want find all the text boxes in page and make at once read only true . i am using this code to find
foreach(Controls control in Page.Controls)
{
if (control is TextBox)
{
}
}
but unable to get common property of text boxes is there any way please help me.
Thanks And Regards,
GuruKiran
|
|
|
|
|
foreach(Controls control in Page.Controls)
{
if (control is TextBox)
{
(control as TextBox).ReadOnly = true;
}
}
Does this work....
Intelligence is measured by common sense not by how many scholarly books you read.
|
|
|
|
|
foreach (Control ctrl in c.Controls) {
if ((ctrl.GetType() == TextBox)) {
((TextBox)(ctrl)).ReadOnly = true;
}
}
Regards - J O N -
|
|
|
|
|
Hi to all- CaN anyone please tell.
My question is to those who are saying as follows
I have read in certain post something like below.
In below code we can not use 'is' and it is better to use 'as'.
Just give a look at below code.
I think Christian Graus has told someone to use 'as' instead of 'is'.
So please justify this. Why should i use 'as'
<br />
foreach(Control c in Page.Controls)<br />
{<br />
foreach(Control ctrl in c.Controls)<br />
{<br />
if(ctrl is TextBox)<br />
{<br />
((TextBox)ctrl).Enabled = false;<br />
}<br />
else if(ctrl is CheckBox)<br />
{<br />
((CheckBox)ctrl).Enabled = false;<br />
}<br />
}<br />
}<br />
Thanks
-- modified at 6:04 Monday 22nd October, 2007
Believe Yourself :->
|
|
|
|
|
when you "as" if type conversion fails then it returns null. so just by checking null or not we can do remaining operations on it. Here in this case interest is not for what type it is exactly rather we need a TextBox control instance. So just try to type cast using "as" operator is sufficient. "is" is used when we need to compare types.
Intelligence is measured by common sense not by how many scholarly books you read.
|
|
|
|
|
hi
Rao
Thanks for ur valuable reply,
I got to do so u have stated earlier,
But plz tell me where and how i have to change in the code that i have submitted earlier.
If i write as instead of is i m getting error like :
" Cannot implicitly convert type 'System.Web.UI.WebControls.TextBox' to 'bool' "
So please tell where and what to change in above code.
Thanks a lot....
-- modified at 6:09 Monday 22nd October, 2007
Believe Yourself :->
|
|
|
|
|
try this
foreach (Control ctrl in c.Controls) {
if ((ctrl.GetType() == TextBox)) {
((TextBox)(ctrl)).Enabled = false;
}
}
Regards - J O N -
|
|
|
|
|
Hi Jon,
Thanks Dost Giving For Reply.
I m getting error
here the same thing u have stated.
But where is the think that i want???
I want to use 'as' instead of 'is'.
Believe Yourself :->
|
|
|
|
|
Did you try replacing 'AS' in the place of 'IS'? Does it works? I don't think so. Christian might have told this in terms of VB.NET code. Cause replacing 'IS' with 'AS' would work in VB.NET. But There is a world of difference in using these both in a particular context(gives different meaning).
'AS' - used when declaring a variable/object states that a Variable is declared as Type specified.
'IS' - used when checking for the TYPE of a particular variable/object
Dim txtControl AS TextBox
If TypeOf txtControl IS TextBox
can you makeout the difference between the above two statements. below there is a VB code that does what you exactly asked and in this context see how AS and IS are used.
For Each child As Control In c.Controls
If TypeOf child Is WebControl Then
CType(child , WebControl).Enabled = False
End If
Next
Regards - J O N -
|
|
|
|
|
Can anyone tell me if the TreeView control in Infragistics allows dynamic loading to be done by populating a node from a text file rather than using a Dataset for the same ??
|
|
|
|
|
I want to receive a query and load it directly onto the loginview control in asp.net 2.0 how can I do that? I have a formview in the loginview and a gridview control the formview must go to the page where the page index is equal to the selected index in the gridview control.
BiG RaLpH
|
|
|
|
|
sorry! can you be a bit elaborative about the problem. I just confused.
Intelligence is measured by common sense not by how many scholarly books you read.
|
|
|
|
|
I have a gridview control and a formview control in a loginview control when I send a link to this page with ?Code={0}
the page does not load with the required code how can I make it work in the page_load event?
BiG RaLpH
|
|
|
|
|
?Code=0
In the page_load event handler
if (Request.QueryString.Count>0) // it is always better to perform conditional operation on querystring before retrieving values.
{
if (Request.QueryString["Code"]!=null)
{
// place code that has to execute.
}
}
Hope this will solve your problem.
Happy programming.
Intelligence is measured by common sense not by how many scholarly books you read.
|
|
|
|
|
this function is working fine when I click a button but if I put it in the page load it doesn't.
On Error Resume Next
gv4 = LoginView1.FindControl("GridView4")
gv5 = LoginView1.FindControl("GridView5")
lbl5 = LoginView1.FindControl("Label5")
txtSe = LoginView1.FindControl("txtSearch")
Dim fv1 As FormView
fv1 = LoginView1.FindControl("FormView1")
If LoginView1.FindControl("GridView4").ToString = True Then
i = 0
For i = 0 To gv4.Rows.Count - 1
If gv4.Rows(i).Cells(0).Text.StartsWith(gv5.Rows(0).Cells(0).Text) Then
gv4.SelectedIndex = i
fv1.PageIndex = gv4.SelectedIndex
Exit For
End If
Next
sIndex = gv4.SelectedIndex
lbl5.Text = gv4.SelectedIndex
End If
BiG RaLpH
|
|
|
|
|
Hi All,
I am using C#.2005. I created a resource file in business layer to store messages for users. As per you know, visual studio automatically created a class for this resource file and properties for each string. So I can access each string by typing [class name].[property name]. The problem is that these properties are declared with the keyword 'internal'. So I can access it only in the business layer. To access these properties in presentation layer, I changed the scope to public. Now I can access the properties also from presentation layer. But there is hundreds of string in this resource file. So it is difficult to modify each property. How can I overcome this problem? Please help me.
Thanks & Regards,
Hogan
|
|
|
|
|
Sounds like the class belongs in the presentation layer, seeing as it consists of rendering details.
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 )
|
|
|
|
|
Sorry I didn't get you. Can you please explain it little bit more?
Thanks
Hogan
|
|
|
|
|
Not sure how to explain it better - your strings are shown in the presentation layer, so that's probably where your resource files belong. Not in the business layer.
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 )
|
|
|
|
|
No sir. I want to use it in both layer. That's why I created it in BL.
For example I created functions to send mail to users. These functions are written in the BL. The mail body is declared in this resource file. So I want to access it in BL.
Thanks to spend time with me
Hogan
|
|
|
|
|
oh I can pass it as parameters. Sorry to waste your time for these silly questions. But I am curious, is there any way to access resource files in different assemblies?
Thanks and Regards,
Hogan
|
|
|
|
|
Hi all,
Can anyone tell me a regular expression to validate a decimal(18,2).
Thanks
Bye
|
|
|
|
|
\d{1,18}\.?\d{0,2}
At a guess.
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 )
|
|
|
|