|
Hiii...
Please help me in this problem.
Problem In ASP.NET WebPage:
In webpage i have GridView. In javascript when i write
document.getElementByID('Gridview1') it shows id. means Gridview found.
But when i put same code in Content Page
it shows null.
var grid = document.getElementById(gridViewId); --> Shows null.
After that When page gets loaded .. i put alert on same code
var grid = document.getElementById(gridViewId); --> It Shows Object Found...
Why this happened ???
“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
|
|
|
|
|
What happened is that the id changes because it is in a content section.
Use document.getElementById("<%=gridViewId.ClientID %>"); instead
I didn't get any requirements for the signature
|
|
|
|
|
if u r using ur code, var grid = document.getElementById(gridViewId) it always give only the access of gride.
instead of this u can use document.getElementsByTagName('td')
Thanks
(with regards)
B.Balachandhar
|
|
|
|
|
Hi CP ,
I am using an iFrame in an application . i am setting focus to it to type the text .
After typing some text i want to press the keys using combination like this ::
" ctrl+shift+p "
like what we do normally in iFrame i.e., Ctrl+X, Ctrl+V ,Ctrl+y ,Ctrl+C .
I am using shortcuts.js JS File for generating normally it is working for textarea/ any control if it is having the focus. from the below site.
http://www.openjs.com/scripts/events/keyboard_shortcuts/#keys
<title>Untitled Page
shortcut.add("ctrl+shift+p", function ()
{
document.getElementById('<%=Button1.ClientID%>').click();
}
,{
//'type':'keydown',
//'propagate':false,
//'target':document.getElementById('ifrm')
//}
);
function LoadFrame()
{
document.getElementById("ifrm").contentWindow.document.designMode = "On"; //Registering the keydown event
// frames[0].document.onkeydown = function () {
// keypressed=frames[0].event.keyCode;
// if(keypressed==80)
// {
// ctrlPressed = true;
// return false;
// }
// if(keypressed==17)
// {
// shiftpressed = true;
// return false;
// }
// if(keypressed==16 && ctrlPressed && shiftpressed)
// {
// short()
// ctrlPressed=false;
// shiftpressed=false;
// return true;
// }
// return true;
// };
// But this not the Exact way .& this is time taking for events to fire atleast 3 times for all buttons to be pressed.
}
<asp:button id="Button1" runat="server" text="Button" xmlns:asp="#unknown">
This is the code which i am using currently . I want to use the keyboard shortcuts, if iframe is having the focus.
I request to give the suggestions/output without leaving the question unanswered.
Regards, Sriram.
|
|
|
|
|
Hi all,
iam using following java script code for validating multiple checkboxex
if((document.submitForm.check[0].checked !==true)&&(document.submitForm.check[1].checked!==true))
{
alert("Please select the one check box ");
return false;
}
and html page i have declared the checkbox like this.
<TR>
<TD align="center"> <input type="checkbox" name="check[]" value="Erosion Control"><font size=3>Erosion Control</font></TD>
</TR>
<TR>
<TD align="center"> <input type="checkbox" name="check[]" value="Forestation"><font size=3>Forestation</font></TD>
</TR>
iam getting this error
document.check.0. is not object .
can any body guide me in this issue that what iam doing wrong .
How i debug the java script code ?
i have to validate multiple checkboxes
Best Regards
rameez
|
|
|
|
|
Getting all the checkbox object reference use the following script.
var getAllcheckbox = document.getElementsByTagName("INPUT");
for(var i=0;i<getallcheckbox.length;i++)>
{
if(getAllcheckbox[i].type == "checkbox" && getAllcheckbox[i].name = "check[]")
{
//do your validation here...
}
}
|
|
|
|
|
Hi I am using GridView. And in that gridview One hyperlink filed is there. Till now I was passing only one parameter as a querystring to DataNavigateUrlFormatString property but now it is required to pass 2 value So how can I do
Here is the code which was workig fine
<asp:hyperlinkfield datanavigateurlfields="CrId" itemstyle-cssclass="clientbor" headerstyle-cssclass="clientbort" datanavigateurlformatstring="customInteraction.aspx?CrId={0}" headertext="Name" xmlns:asp="#unknown">
DataTextField="CrName" SortExpression="CrName" />
But now I added this one so it is giving error
Like "Index(zero base) must be greater than or equal to zero and less than the size of the argument list."
<asp:hyperlinkfield datanavigateurlfields="CrId" itemstyle-cssclass="clientbor" headerstyle-cssclass="clientbort" datanavigateurlformatstring="customInteraction.aspx?CrId={0}&Date={1} " headertext="Name">
DataTextField="CrName" SortExpression="CrName" />
Can any one figure it out what is the problem and how can we solve? Thanks in advance
http://techiefromsurat.blogspot.com/
|
|
|
|
|
you need to give date in datanavigateurlfields.
datanavigateurlfields="CrId,Date"
<asp:hyperlinkfield datanavigateurlfields="CrId,Date" itemstyle-cssclass="clientbor" headerstyle-cssclass="clientbort" datanavigateurlformatstring="customInteraction.aspx?CrId={0}&Date={1} " headertext="Name">
DataTextField="CrName" SortExpression="CrName" />
|
|
|
|
|
Hi,
Iam writting a c# DLL for users login. Here i need to get the machine name of the client who is accessing my class. In case if we are designing a website we can write the following code to get the machine name
string[] aStrComputerName = System.Net.Dns.GetHostEntry(Request.ServerVariables["remote_addr"]).HostName.Split(new Char[] { '.' });
string strMachineName = computer_name[0].ToString();
But I cant use this code in C# class because Request.ServerVariables is not supported in c# class.
Can any body help me to solve this problem.
Its Very urgent. Please help me. Thanks in Advance.
Regards,
Suresh Kumar G
|
|
|
|
|
try using ebvironment variables
Cheers!!
Brij
|
|
|
|
|
You can use Windows Management Instrumentation (WMI) to get this information, Try this sample code.
using System;
using System.Management;
using System.Windows.Forms;
namespace MyComputerName
{
public class GetComputerName
{
public static void Main()
{
try
{
ManagementObjectSearcher searcher =
new ManagementObjectSearcher("root\\CIMV2",
"SELECT * FROM Win32_ComputerSystem");
foreach (ManagementObject queryObj in searcher.Get())
{
Console.WriteLine("Client Computer Name is : {0}", queryObj["Name"]);
}
}
catch (ManagementException e)
{
MessageBox.Show("Oops ! ERROR : " + e.Message);
}
}
}
}
|
|
|
|
|
Please don't cross-post. I just saw this same question in C# Forum. I know that you are new here, but wait for an answer man (This is not Expert-Exchange.com ), sombody will sure answer your question.
Also this question is more suitable for C# Forum.
|
|
|
|
|
HI,
I have used the following code to find the pc name of the client in server, when a request comes
System.Net.Dns.Resolve(Request.ServerVariables("REMOTE_ADDR")).HostName.Split(".")(0).ToString()
This is working fine and able to get the pc name when the request comes with out through a proxy server.
But when the request comes through same proxy, for different machines I could get only the proxy name only.
Is there any way to get the machine even if it comes through proxy? or at least any way to identify that this the request comes from a proxy so that in server we can restrict.
I would really appreciate any help/guidance for this..
Thanks very much in Advance!
Rahul.
SoftwareDeveloper(.NET)
|
|
|
|
|
Hi all,
I have migrated my Asp.net1.1 application to Asp.net 3.5(VS 2008)...After migration Crystal reports are not working....
It is giving an error like "Unable to find the report in the manifest resources"....
I searched in Google and i got a solution tht thy have told to open that report in VS 2008 and save it....(while doing this it asked for upgrade and i gave ok)....but still it is the same...
pls somebody help me to solve this issue.....
Thanks in advance....
|
|
|
|
|
hello,
Is it anyway to share variables or objects between javascript and c# in ASP.net 2.0 application
best regards
dghdfghdfghdfghdgh
|
|
|
|
|
|
Hi buddy,
I don't think so that you can share any variable or object with Javascript(ClientSideScript) and C#(ServerSideScript). And if you want to use variable then you can use hidden field server side so both C# and Javascript can access it easily.
Hope it will help
http://techiefromsurat.blogspot.com/
|
|
|
|
|
The easiest way is a hidden field on the page, use that to pass values back to C#. An AJAX call works too, but if you're not using AJAX, a hidden field is easier.
Christian Graus
Driven to the arms of OSX by Vista.
"Iam doing the browsing center project in vb.net using c# coding" - this is why I don't answer questions much anymore. Oh, and Microsoft doesn't want me to.
|
|
|
|
|
Hi
mmm is it any example in ajax that explain how to do it ?
regards
dghdfghdfghdfghdgh
|
|
|
|
|
|
Hi lipi,
I hope you have heard about GridView inside GridView.
Just try that you can easily do that.
If you haven't heard about that just go through this code,
Put one GridView on aspx page with inside This master gridview put another gridview with name 'GridView2' ok
Write RowBound event of GridView1(Master gridView)
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
GridViewRow row = e.Row;
if (row.DataItem == null)
{
return;
}
GridView gv = new GridView();
gv = (GridView)row.FindControl("GridView2");
//Prepare the query for Child GridView by passing the Employee ID of the parent row
DataSet ds = ChildDataSource(((DataRowView)e.Row.DataItem)["employeeID"].ToString());
gv.DataSource = ds;
gv.DataBind();
}
Here is the ChildDataSource Method
private DataSet ChildDataSource(string strEmployeeId)
{
DataSet ds = new DataSet();
string Query = "Select * from Employee_Master where EmployeeId='" + strEmployeeId+ "'";
// This is my structure to access data ok just use here your code
ds = dataacesslayer.SqlHelper.ExecuteDataset(DBCon.ConnectionString, CommandType.Text, Query);
return ds;
}
And let me know is your problem solved or not?
http://techiefromsurat.blogspot.com/
|
|
|
|
|
Hello Friends..
I have one website(asp.net with C#) which have .csproj file.
when i open that website it cant convert that
website to compatible version until i remove that .csprob file.
If i remove the file and open the website than it runs cool
but it puts me in one trouble in which i cant able to edit the code.
Can any one help me regarding this?? this is very urgent for me....
plz reply ASAP.......
thanks in advance
KIRANKUMAR ROY.
+91-9998847534
kirankumar.roy@gmail.com
|
|
|
|
|
Hi Raviraj,
Delete that .csproj file.
Go to Visual Studio or Visual WebDeveloper Express (whatever you are using).
There Go File-> Open Website. Then Browse your website folder (the one having web.config on root). Open the website.
Try this. This May work.
Thanks,
Padmanabh
|
|
|
|
|
Hi Padmanabh
I am very thank ful for your reply.
I have tried this before.
it will allow me to open website But actual problem is
when i edit some code and try to debug than it will not allow me.
It not give error or message.
It simply debug the line which are previously located on my break point.
suppose i have below code
1 switch (selectedRole)
2 {
3 case (0):
4 // undefined
5 break;
6 case (1):
7 // member
8 viewControls(false, true, false, false);
9 break;
10 case (2):
11 case (3):
12 case (4):
13 // admin, financial controller & marketing manager
14 viewControls(true, false, false, false);
15 break;
16 }
now if i remove the case 2 and 3 from above switch
and put new code than it will debug above one only.
|
|
|
|
|
Hi Raviraj,
Strange. I didnt face such behaviour in past.
Well, do one thing.
If your Website does not have huge number of files then
create a new Website project and add your old files one by one. Then try to build the complete website and check what happens.
Thanks,
Padmanabh
|
|
|
|