|
how can i find the checkbox is checked or not.....
present inside the datagridview...
send me sample coding..
|
|
|
|
|
Why crosspost.This won't help anybody instead of irritating..
Cheers!!
Brij
|
|
|
|
|
|
hi
Suppose you have gridview with one checkbox named CheckBox1.
You can find the checkbox control using the code
protected void Button1_Click(object sender, EventArgs e)
{
foreach (GridViewRow gvRow in GridView1.Rows)
{
CheckBox ch = (CheckBox)gvRow.FindControl("CheckBox1");
Response.Write(ch.Checked.ToString());
}
}
|
|
|
|
|
Hi All,
I am trying to test the success of WMI to check connectivity to a remote computer:
I have 2 computers:A,B Computer A: Windows Server 2008.Computer B: Windows XP SP2.They are all on the same network (a workgroup, not domain), with no firewalls in between (excepting Windows Firewall, which I have disabled on Computer B)
i wrote the following code.if local system means that code is working fine.Remotely means it show on Access Denied Error.How to Access WMI From Server 2008 to Windows XP.That remote connection Windows xp to Server 2008 Success.but Server 2008 to Windows Xp show on error like that access denied. Can Anyone help me?
Any help would be appreciated.
ConnectionOptions connection = new ConnectionOptions();
connection.EnablePrivileges = true;
ManagementScope scope = null;
//connection.Authority = "NTLMDomain:" + domain;
//connection.Username = userName;
//connection.Password = password;
//Local Machine
if (compName.ToUpper() == Environment.MachineName.ToUpper())
{
scope = new ManagementScope(@"\root\cimv2", connection);
}
else //Remote Machine
{
scope = new ManagementScope(@"\\" + compName + @"\root\cimv2", connection);
}
scope.Options.EnablePrivileges = true;
scope.Connect();
//
ObjectQuery query = new ObjectQuery("SELECT * FROM Win32_OperatingSystem");
ManagementObjectSearcher objsearcher = new ManagementObjectSearcher(scope, query);
ManagementObjectCollection objcol = objsearcher.Get();
|
|
|
|
|
The account you run your app under has to have administrator permissions to each machine on the network you want to query. Or, you can supply appropriate credentials in the WMI connection code to do the same thing.
|
|
|
|
|
Hello everybody,
This is my first post here and I am learning .NET so please excuse my baby steps.
I am trying to load the elements in tree view. My base item is loading two times. I know why it's loading but i don't know how to protect it or what's the other method so that base item will not load twice.
Thanks. Here is the code.
Private Sub LoadScenarios()
For Each aScenarioBase As MmScenario In aDataSet()
Dim baseScenarioTreeNode As TreeNode = Me.tvScenario.Nodes.Add(aScenarioBase.Id.ToString, aScenarioBase.Label)
LoadScenariosAndChildren(aScenarioBase, baseScenarioTreeNode)
Next
End Sub
Private Sub LoadScenariosAndChildren(ByVal aScenarioParent As MmScenario, ByVal parentScenarioTreeNode As TreeNode)
Dim childScenarioTreeNode As TreeNode = parentScenarioTreeNode.Nodes.Add(aScenarioParent.Id.ToString, aScenarioParent.Label)
For Each aScenario As IScenario In aScenarioParent.Children()
LoadScenariosAndChildren(aScenario, childScenarioTreeNode)
Next
End Sub
Results:
0000
0000
0001
0001.1
0002
I want:
0000
0001
0001.1
0002
Many Thanks.
|
|
|
|
|
Have you debugged and stepped through your code? You'll learn a lot watching what happens.
only two letters away from being an asset
|
|
|
|
|
yes, i looked at every steps. I know why it's doing that but i don't know how to prevent that. Any help will be appreciated. Thanks.
|
|
|
|
|
In LoadScenarios() you add the node to the tree then pass that node as the parent to LoadScenariosAndChildren where you immediately add the node again. Don't load the node in LoadScenarios().
only two letters away from being an asset
|
|
|
|
|
Exactly, I don't want to load the node in LoadScenarios() but without doing that i cannot pass the node. Is there way just to initialize?
what i am trying to do is to create the following structure in treeview:
---Base_0
-----Base_0_1
---Base_1
---Base_2
---Base_2_1
---Base_2_1_1
---Base_3
Thanks for your prompt response.
|
|
|
|
|
i mean this :
---Base_0
-----Base_0_1
---Base_1
---Base_2
-----Base_2_1
-------Base_2_1_1
---Base_3
|
|
|
|
|
musabiralo wrote: cannot pass the node
Pass a null then check for it. If the node is null, add to the root, if not add children
There are plenty of examples of how to recursively populate a tree, have you looked at any of them?
only two letters away from being an asset
|
|
|
|
|
i bind one table in my datagridview
i have 4 check box in my datagridview...
one for present...
second one for absent...
third one for morning present...
fourth one for evening present...
if i check only one check box i get the following error...
// ERROR // Object reference not set to an instance of an object.
bcz i assigned check box value to one string variable...
string value11 =”aa” , value22 =”aa” , value33 =”aa” , value44 =”aa” ;
con27.Open();
int rows = dataGridView1.Rows.Count;
rows = rows - 1;
for (int i = 0; i < rows; i++)
{
SqlCommand cmd27 = new SqlCommand("sp_update_att_lkg", con27);
cmd27.CommandType = CommandType.StoredProcedure;
value11 = dataGridView1.Rows[i].Cells[0].Value.ToString();
value22 = dataGridView1.Rows[i].Cells[1].Value.ToString();
value33 = dataGridView1.Rows[i].Cells[2].Value.ToString();
value44 = dataGridView1.Rows[i].Cells[3].Value.ToString();
string value10 = dataGridView1.Rows[i].Cells[4].Value.ToString();// S_ID
string value6 = dataGridView1.Rows[i].Cells[5].Value.ToString();// name
string value7 = dataGridView1.Rows[i].Cells[6].Value.ToString();// class
string value8 = dataGridView1.Rows[i].Cells[7].Value.ToString();//section
string value9 = dataGridView1.Rows[i].Cells[8].Value.ToString();// scode
string value5 = dataGridView1.Rows[i].Cells[9].Value.ToString();// uid
string dt1 = dateTimePicker1.Text;
DateTime DT = DateTime.Parse(dt1); // ATTENDANCE
if (value11 == "True")
{
value11 = "present";
}
else
{
value11 = "absent";
}
cmd27.Parameters.Add(new SqlParameter("@puid", SqlDbType.Int));
cmd27.Parameters["@puid"].Value = value5;
cmd27.Parameters.Add(new SqlParameter("@pname", SqlDbType.VarChar));
cmd27.Parameters["@pname"].Value = value6;
cmd27.Parameters.Add(new SqlParameter("@pclass", SqlDbType.VarChar));
cmd27.Parameters["@pclass"].Value = value7;
cmd27.Parameters.Add(new SqlParameter("@psection", SqlDbType.VarChar ));
cmd27.Parameters["@psection"].Value = value8;
cmd27.Parameters.Add(new SqlParameter("@pcode", SqlDbType.VarChar));
cmd27.Parameters["@pcode"].Value = value9;
cmd27.Parameters.Add(new SqlParameter("@pattend",SqlDbType.DateTime));
cmd27.Parameters["@pattendance"].Value = DT;
cmd27.Parameters.Add(new SqlParameter("@pstatus", SqlDbType.VarChar));
cmd27.Parameters["@pstatus"].Value = value11;
cmd27.Parameters.Add(new SqlParameter("@ps_id", SqlDbType.VarChar));
cmd27.Parameters["@ps_id"].Value = value10;
cmd27.ExecuteNonQuery();
}
expecting suggestions...
|
|
|
|
|
There is a question about run dotnetframework1.1 application and dotnetframework2.0 application at the same time.
Is anybody tell me the solution for this? Thanks very much!
OS: Win2003 64bit
|
|
|
|
|
If you have web application deployed on IIS,then every virtual directory should be mapped to corrrect version of ASP.NET ISAPI exetention.You can configure it by aspnet_regiis.exe.So every Virtual directory will run on 1.1,and for 2.0,you also need to register it,after registering it you'll get dropdown for ASP.NET version in the properties of your Virtual Directory and selecting ASP.NET tab.
Cheers!!
Brij
|
|
|
|
|
The server's OS is Win2003 64bit
Installed dotnetframework1.1(32bit) and dotnetframework2.0(64bit).
There has no ASP.NET choose in IIS.
|
|
|
|
|
lucasluo wrote: There has no ASP.NET choose in IIS.
Its means you have installed IIS after .NET Framwork.
If you want this, From the command prompt , go to Framework Directory
e.g : c:\windows\microsoft.net\Framework\V2.05732
then run aspnet_regiis Command
cheers,
Abhijit
|
|
|
|
|
I reinstall the .NET Framwork1.1(32bit) and .NET Framwork2.0(32bit) by aspnet_regiis.exe -i
But also have no the ASP.NET option.
|
|
|
|
|
As you said,OS is 64 bit.So install the 64 bit framework,32 bit wont work
Cheers!!
Brij
|
|
|
|
|
|
Hi again. I have another question hopefully someone can help me with. I've found articles online where it is said that an Interface does not have a GetType() function as it is not derived from 'Object'. This seems true since when trying to work with the IDataObject interface, there is no GetType() function.
The problem is, as my last post addresses, I'm trying to change code from C# to VB for drag and dropping from Outlook. The original C# code is shown below. The very Odd thing I don't understand is how in C# GetType() works with IDataObject. Inside the DragDrop event of an Windows Form object e.Data.GetType() is usable, but this is not the case in VB.
I have the below code converted to VB but the New constructor does not work since there is no GetType() functions "visible."
Thanks again!!
private System.Windows.Forms.IDataObject underlyingDataObject;
private System.Runtime.InteropServices.ComTypes.IDataObject comUnderlyingDataObject;
private System.Windows.Forms.IDataObject oleUnderlyingDataObject;
private MethodInfo getDataFromHGLOBLALMethod;
public OutlookDataObject(System.Windows.Forms.IDataObject underlyingDataObject)
{
this.underlyingDataObject = underlyingDataObject;
this.comUnderlyingDataObject = (System.Runtime.InteropServices.ComTypes.IDataObject)this.underlyingDataObject;
FieldInfo innerDataField = this.underlyingDataObject.GetType().GetField("innerData", BindingFlags.NonPublic | BindingFlags.Instance);
this.oleUnderlyingDataObject = (System.Windows.Forms.IDataObject)innerDataField.GetValue(this.underlyingDataObject);
this.getDataFromHGLOBLALMethod = this.oleUnderlyingDataObject.GetType().GetMethod("GetDataFromHGLOBLAL", BindingFlags.NonPublic | BindingFlags.Instance);
}
|
|
|
|
|
Hi David,
I am having the same problem, I can get the oleUnderlyingDataObject ok but I am unable to get the method getDataFromHGLOBLAL.
The last line of code returns nothing...
Did you find a resolution to this?
Regards
Bill Terrington
Public Sub New(ByVal underlyingDataObject As System.Windows.Forms.IDataObject)
'get the underlying dataobject and its ComType IDataObject interface to it
Me.underlyingDataObject = underlyingDataObject
Me.comUnderlyingDataObject = DirectCast(Me.underlyingDataObject, System.Runtime.InteropServices.ComTypes.IDataObject)
'get the internal ole dataobject and its GetDataFromHGLOBLAL so it can be called later
Dim innerDataField As FieldInfo = CType(Me.underlyingDataObject, Object).[GetType].GetField("innerData", BindingFlags.NonPublic Or BindingFlags.Instance)
Me.oleUnderlyingDataObject = DirectCast(innerDataField.GetValue(Me.underlyingDataObject), System.Windows.Forms.IDataObject)
Me.getDataFromHGLOBLALMethod = CType(Me.oleUnderlyingDataObject, Object).[GetType].GetMethod("getDataFromHGLOBLAL", BindingFlags.NonPublic Or BindingFlags.Instance)
End Sub
|
|
|
|
|
Sorry but I never did find the solution. Not sure if you are using the same code I was (Providing for drag and drop from Outlook)?
I ended up using the original C# code and creating a C# library that my VB program referenced.
Then I ended up using an online code converter and now the program is in c# anyway...
Sorry couldn't be more helpful.
|
|
|
|
|
I have already created a c library but was hoping to avoid
the overhead if possible.
Thanks for the reply anyway.
|
|
|
|