|
I think you need to reregister the new dll to GAC again.
|
|
|
|
|
I'm building a web app and on one page I am using a check box list control for a group of selections. Before I submit my info to the database, I am sanitizing it and then placing it into session variables so the user can look over the info they typed in before putting it into the database.
The checkbox list in question is for a question asking about what type of work the user is looking for (Full-time, Part-time, or Temporary Work). What I want to put into the database is all of the user's selections, each separated by a comma. Here is the code I was using to pull that information from the checkbox list:
Dim w As Integer = 0
Dim chkbxWork As CheckBoxList = New CheckBoxList
chkbxWork = CType(Form.FindControl("cblWork"), CheckBoxList)
Dim sbWork As StringBuilder = New StringBuilder()
For w = 0 To chkbxWork.Items.Count - 1
If chkbxWork.Items(w).Selected Then
sbWork.Append(chkbxWork.Items(w).Value & ",")
End If
Next
'remove last comma
Dim IVWork As String = Left(sbWork.ToString(), Len(sbWork.ToString()) - 1)
Session("WorkType") = Server.HtmlEncode(IVWork)
This is all inside of a Try/Catch block, so naturally I keep getting an error when the for loop runs saying that there is a null object. What am I doing wrong?
|
|
|
|
|
Aptiva Dave wrote: chkbxWork = CType(Form.FindControl("cblWork"), CheckBoxList)
Why do you need to do that? Dont you have me.cblWork ?? If the control is serverside you can refer using Me.cblWork.
chkbkWork will hold Null if CType fails.
Please let me know where exactly you are getting an error. There are lots of places where you could get the NullReferencException , but I want you to put a breakpoint on the code and run it to find out where exactly the error is generated.
|
|
|
|
|
The Null exception happens when the for loop starts.
Also, I tried me.cblWork and it didn't recognize the control.
|
|
|
|
|
if Me.cblWork doesnt recognise, then there must be some problem with the designer. Might be you didnt mentioned runat="server" for the control.
If you cant call using its ID, it will not be found using FindControl as well.
|
|
|
|
|
In my application I have two modules "Admin" and "User".Admin can access all pages while User is Restricted to few pages only. How can I do this and restrict user to go the "Admin Pages" by just copying the url.
Please give me some help....any most relevent article on codeproject?
I m just new in asp.net.
|
|
|
|
|
|
|
Hello,
I have developed a website in n-tier architecture model. IT is working fine in local. But the problem is it is not working fine on server. I have uploaded website(files and folders including Bin). Transport,Data,Business layers dll's are in Bin folder.
The Problem is While retrieving the values from database into dataset error occurs.
Please Let me know how to upload N-tier arch model website and what files have to upload.
Thanks in advance
|
|
|
|
|
|
Thanks for the answer. But I have developed website not windows application.
Am getting Security Exception. i.e
System.Security.SecurityException: That assembly does not allow partially trusted callers.
Thanks in Advance
|
|
|
|
|
|
The Implementation is the same , for the Error that you are getting take Abhishek Sur advice and following the link
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
Here iam creating dynamic data with 2 tables
the desired Output should be like this
<a href="http://www.freeimagehosting.net/uploads/3ae42a5662.jpg"> click here to see</a>
but im getting this
<a href ="http://www.freeimagehosting.net/uploads/6835576eac.jpg" > Click Here to see </a>
Please help me
DataSet ds;
DataTable t1, t2, t3;
DataRow r;
DataColumn c1, c2, c3, c4, c5, c6;
ds = new DataSet();
t1 = new DataTable("emp");
t2 = new DataTable("dep");
c1 = new DataColumn("Eid");
c2 = new DataColumn("Ename");
c3 = new DataColumn("DID");
t1.Columns.Add(c1);
t1.Columns.Add(c2);
t1.Columns.Add(c3);
c4 = new DataColumn("DID");
c5 = new DataColumn("Dname");
c6 = new DataColumn("Daddress");
t2.Columns.Add(c4);
t2.Columns.Add(c5);
t2.Columns.Add(c6);
for (int i = 0; i < 3; i++)
{
r = t1.NewRow();
r[0] = 10 + i;
r[1] = "charle" + i;
r[2] = 100 + i;
t1.Rows.Add(r);
}
for (int i = 0; i < 3; i++)
{
r = t2.NewRow();
r[0] = 100 + i;
r[1] = "IT DEP no " + i;
r[2] = "AMPT";
t2.Rows.Add(r);
}
dataGridView1.DataSource = t1.DefaultView;
dataGridView2.DataSource = t2.DefaultView;
t1.Merge(t2);
dataGridView3.DataSource = t1.DefaultView;
please help me Friends
|
|
|
|
|
|
Hello All
I've a grid with multiple columns ,one of them is a boolean column,i want to represent it as a chackbox ,
when the checkbox checked or unckecked i want the database to change automatically ,
i get this error before the page even loaded ,here is the Source Error:
-------------------------------------------------------------------
Line 38: <cc1:gridtemplate runat="server" id="tplSent">
Line 39: <template>
Line 42:
------------------------------------------------------------------------
Microsoft (R) Visual Basic Compiler version 8.0.50727.42
for Microsoft (R) .NET Framework version 2.0.50727.42
Copyright (c) Microsoft Corporation. All rights reserved.
C:\CRFF\Default.aspx.vb(79) : warning BC42104: Variable 'wks' is used before it has been assigned a value. A null reference exception could result at runtime.
If Not (wks Is Nothing) Then
~~~
C:\CRFF\Default2.aspx(49) : warning BC42020: Variable declaration without an 'As' clause; type of Object assumed.
Dim s = r("employeeid").ToString
~
C:\CRFF\IT_Daily_Tasks.aspx(40) : error BC30201: Expression expected.
target.SetDataBoundString(1, System.Convert.ToString(Container.Value == "True" ? "checked='checked'" : "", System.Globalization.CultureInfo.CurrentCulture))
~
C:\CRFF\IT_Daily_Tasks.aspx(40) : error BC30035: Syntax error.
target.SetDataBoundString(1, System.Convert.ToString(Container.Value == "True" ? "checked='checked'" : "", System.Globalization.CultureInfo.CurrentCulture))
----------------------------------------------------------------------------
Help Please
modified on Wednesday, December 2, 2009 12:10 AM
|
|
|
|
|
I understand that your code behind is VB.NET [C:\CRFF\Default.aspx.vb].
As far as I know there is no ternary operator i.e. [expr?expr:expr], available in VB.
|
|
|
|
|
Actually i do have VB.net code behind ,but for the purpose of instant DB
updating i've used JAVASCRIPT the sript is below, hope that would clarify
function updateSent(bSent, iRowIndex) {
var oRecord = new Object();
oRecord.OrderID = grid1.Rows[iRowIndex].Cells[0].Value;
oRecord.ShipName = grid1.Rows[iRowIndex].Cells[1].Value;
oRecord.ShipCity = grid1.Rows[iRowIndex].Cells[2].Value;
oRecord.ShipPostalCode = grid1.Rows[iRowIndex].Cells[3].Value;
oRecord.ShipCountry = grid1.Rows[iRowIndex].Cells[4].Value;
oRecord.Sent = bSent;
grid1.executeUpdate(oRecord);
}
|
|
|
|
|
Based on your question I understood that we are talking about a compilation error and my comment was about the checkbox definition statement
<input type="checkbox" önclick="updateSent(this.checked, <%# Container.PageRecordIndex %>)" <%# Container.Value == "True" ? "checked='checked'" : "" %> />
You are using a server evaluation to set the checked status using the ternary operator in the below line.
<%# Container.Value == "True" ? "checked='checked'" : "" %>
I guess this is where the error is, using ternary operator in a server evaluation where the code behind is VB.NET
|
|
|
|
|
I guess you are right ,cuz when i removed the[evaluation] the page loaded succesfuly , now do i have to give up the whole idea of changing the DB instantly via some JavaScript code?
|
|
|
|
|
Did you try using the IFF function to evaluate the checked status?
|
|
|
|
|
i tried but i got:
BC30451: Name 'IFF' is not declared.
i tried : Checked="<%# IF((Container.Value = "True"), true, false)%>" />
i got the old error : BC30201: Expression expected.
|
|
|
|
|
Try the following:
<asp:CheckBox ID="chkBox" runat="server" önclick="updateSent(this.checked, <%# Container.PageRecordIndex %>)" Checked='<%# Container.Value == "True" ? "true" : "false" %>' />
Hope that this will work.
|
|
|
|
|
thnx for yr swift response, but it doesnt work
|
|
|
|
|
Why din't I think of this before?
Ok try this!
<input type="checkbox" onclick="updateSent(this.checked, <%# Container.PageRecordIndex %>)" Checked="<%# IFF((Container.Value = "True"), true, false)%>" />
|
|
|
|