|
thanx man
|
|
|
|
|
Hello & Smiles,
I had to add a new field to one of my old projects which was designed using Datagrid, it is a checkbox field with datatype as 'Bit'(SQL 2005)same as boolean. I added the checkbox in datagrid as below:
<asp:templatecolumn headertext="Current Driver?">
<itemTemplate>
<asp:checkbox id="cbcurrentdriver" runat="server" autopostback="true" checked='<%# DataBinder.Eval(Container.DataItem,"currentdriver") %>' />
</itemTemplate>
</asp:templatecolumn>
In the Insert and Update Sub's I added the code as below:
Dim chkbox As CheckBox = CType(e.Item.Cells(9).FindControl("cbcurrentdriver"), CheckBox)
If chkbox.Checked = True Then
Command.Parameters.Add("@currentdriver", SqlDbType.Bit, 2).Value = "True"
Else
Command.Parameters.Add("@currentdriver", SqlDbType.Bit, 2).Value = "False"
End If
Also, included the field in Databind for Datagrid with select * from etc...
This works fine when I open the page in update mode and shows the status of checkbox as checked or unchecked depending upon it's value in database.
My datagrid has a feature 'Add New row' which blank row and this part fails giving me the error -
Conversion from type 'DBNull' to type 'Boolean' is not valid.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidCastException: Conversion from type 'DBNull' to type 'Boolean' is not valid.
Source Error:
Line 1175:<asp:templatecolumn headertext="Current Driver?">
Line 1176:<itemTemplate>
Line 1177:<asp:checkbox id="cbcurrentdriver" runat="server" autopostback="true" checked='<%# DataBinder.Eval(Container.DataItem,"currentdriver") %>' /></itemTemplate>
Line 1178:
I have been struggling with Null checks for checkboxes etc... for last two days. Any help is Gratifying.
Thankyou.
Aartee.
...HE is watching Us All!
|
|
|
|
|
hi , try to use default value in database as 'F'.it may help u
thanks and regards,
Kinnu
|
|
|
|
|
Hello Kinnu,
Thankyou for your reply.
I did try giving it a default value 'F' with 7 without quotes, I even tried default value false and NULL but it didn't work and SQL database is giving me an error when I type the default value as: Error validating the default value for column 'currentdriver'. It does not give me this error when I enter default value as NULL or 0 but my program is still not working and giving me the same conversion (DBNULL to Boolean) error.
Thanks once again. Please let me know if you have any other tips or suggestions.
Aartee.
...HE is watching Us All!
|
|
|
|
|
Since this is a bit column you need the default value to be 0 which is false and then you would avoid this. Also if you dont want a default value, create a Protected Function in the code behind and pass the value from the Datagrid DB value and accept it as an Object, check for DBNull and if it is return a 0/False whatever works.
Cleako
|
|
|
|
|
Hi gyes, I have installed vs.net and I am trying to build a new web project, but it does not accept this action and it displays an error message which says that:
Visual Studio .NET has detected that the specified Web server is not running ASP.NET version 1.1. You will be unable to run ASP.NET Web applications or services.
is there any one has an idea to solve this problem??
kind regards
Kind Regards
OBarahmeh
Palestinian Central Bureau of Statistics (PCBS)
Ramallah-Palestinian Territory
|
|
|
|
|
run aspnet_regiis -i from your .NET 1.1 folder ( c:\windows\microsoft.net\framework\v1.1.something)
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
hi,
i have also met that problem. first u chk the web server that is IIS is install properly or not. if not plz reinstall the IIS and try again...
i done that.... only...
|
|
|
|
|
i have a web page with a textbox and a listbox.
the data to be displayed in the listbox is stored in an array on the client side.
i need to trap the keys when the users types in the textbox, and display the data related
to it from the data stored inn the array and populate the listbox(on the client side).
thanks
any kind of help would be appreciated
|
|
|
|
|
You can handle onkeyup event of textbox and populate listbox with neccessary items in it
function getKeyCode (e_) {
return parseInt(e_ ? e_.which : window.event.keyCode);
}
function srcEl(e_) {
if (window.event)
return window.event.srcElement;
else
return (e_ ? e_.target : null);
}
function onKeyUp(e) {
var textbox = srcEl(e),
keyCode = getKeyCode(e);
var text = textbox.value;
....
fill list box based on "text" string
....
}
textbox.onkeyup = onKeyUp;
|
|
|
|
|
Hi Folks,,
I have a web page with multiple buttons on it...Each button is responsible for retriving and presenting information on this web page...
I want to implement caching on this web page where I can vary the page depending upon which button caused the postback...
Can anyone suggest how can I achieve this...
Joel
JO
|
|
|
|
|
Hi there:
I'm not sure what you need about caching based on e.CommandName...
For caching...just simply load data and put it into cache...
<< >>
|
|
|
|
|
I dont wanna cache the entire data set...I just wanna vary the cache based on the commandName property of all my button controls..
Thanks
joel
JO
|
|
|
|
|
So what is your problem when do caching based on that commandName...?I think, when a button is cliecked...you just check if the data is already cached or not...if not, load from DB and cache it...if already, just read from cache...is that ok?
<< >>
|
|
|
|
|
Actually I am using Output caching ..not data caching..
<%@ OutputCache Duration="120" VaryByParam=
I wanna cache different versions of the page depending on the commandname argument...
JO
|
|
|
|
|
Hello all,
I have been working on this project for quite some time now and to be honest i cant stand it anymore! I have a simple request, i want to get a parameter, taken from a querysting and pass it to a crystal report.
I have setup the crystal report viewer on my default.aspx page and by setting the default value of the parameter, i am able to view the crystal report. Here is the follwing code that i use
---------------------------------------------------------------------------------
<CR:CrystalReportViewer ID="rptViewer" Runat="server" AutoDataBind="True"
Height="947px" ReportSourceID="CrystalReportSource1" Width="845px" DisplayGroupTree="False" EnableDatabaseLogonPrompt="True" HasRefreshButton="True" />
<CR:CrystalReportSource ID="CrystalReportSource1" runat="server">
<Report FileName="SS_Server.rpt">
<Parameters>
<CR:Parameter ConvertEmptyStringToNull="False" DefaultValue="45"
Name="SERVER_ID" ReportName="" />
</Parameters>
</Report>
</CR:CrystalReportSource>
------------------------------------------------------------------------------------
This code works fine, however i want to have the parameter SERVER_ID to be taken from a querystring sent to this page! Si in my innocence i thought, instead of having the defaultvalue="45" can i use DefaultValue=" <% response.write request.querystring('server_id') %>" but this doesnt work.
I have read somewhere that like a control parameter one can code a querystring parameter! Does anyone know how to do this??
Im sure someone can help me, the idea behinf this is so simple, but im only new to Asp and am not sure where im goin wrong.
If anyone can help it would be greatly appreciated!
|
|
|
|
|
Do you get any runtime exception ??
Make sure the parameter type on the report and your program match...
Also try using DefaultValue=" <% request.querystring('server_id').tostring() %>"
Let me know...
JO
|
|
|
|
|
Jo, thanks for your reply and suggestions
1. no i dont get any runtime exception
2. yes the parameters match
3. i tried ur method but it acts the same as mine, it simply prompts for the parameter, server_id
i was reading on MSDN site that one can use a querystringparameter;
http://msdn2.microsoft.com/en-us/library/ms227827(VS.80).aspx[^]
However i cannot find any example that use this and cannot get the querystringparameter tag to work!
Could it be that the crystalreportsource control does not allow this segment of asp code??
Could it be somethin wrong with my web.config file or something im not including in the default.aspx.vb page????
Any help would be great,
Thanks again
|
|
|
|
|
Is this report being set off by a click of a button...
Just a thought...Try saving this query string variable in viewstate in your page_load method...
ViewState("x")=QueryString("serverid").tostring()
Then use ViewState as a parameter...
If you have prepared crystal document object use
crDcoument.Parameters.Add(x,y) method to associate the parameter value with the report..
x=name of the parameter in crystal report
y=value of the parameter..in ur case its ViewState("x").tostring()
Let me know
JO
|
|
|
|
|
JO
No, i click a hyperlink in a page which directs to default.aspx like this /default.aspx?Server_id=45 then in default.aspx i have a request.querystring('server_id') statement, this all works, and i can read the value 45, but i cant insert the request statement into the crystalreportsource control!
Im not great with VB, and so dont really understand what you mean by ur last post Jo, but am i wrong in my method, surely it should be so simple!
Could it be something got to do with the crystalreportsource control. like it doesnt accept asp code in the middle of it??
I am also reviewing this example, and i cant pass a parameter into that either!!!
http://www.codeproject.com/vb/net/CrystalReports_in_VBNET.asp[^]
Aaaaahhhh, please someone help
|
|
|
|
|
hi,
I have a login form. when i login with my user name it should be redirected to another form. in that form i have a table column(not in datagrid) with days monday to sunday in which i have 6 text boxes under each day namely intime, outtime, extratime,nonworktime,leavehrs and total. In that if i enter the values for each textboxes ie.., in hours(user enters it daily-day by day) , all the values should be submitted in the database for the corresponding days and should not be able to modify the values which are entered once. Can anybody pls send me source code for this in c# code behind or pls give me a solution for this.
Regards
Kavi
|
|
|
|
|
Hi Kavi:
The solution is that you should do this by dividing big task into small tasks...first you know how to design GUI? Know how to read data from DB?....And ask the specific questions here
<< >>
|
|
|
|
|
Divide the problem in three parts GUI,Business and database layer
crate one after another First try yourself any problem arrives then ask
|
|
|
|
|
hai,
i want to develope asp.net web project.any tools to design the project specs,Preparing DSD,screen shots.
Thanks and regards
surendra
|
|
|
|
|
Hi..
I am devoloping one site in which i want to code such way that one user can send mail to other user. Is it possibel???
I got 30 mail id from our isp provider can i use it??
How should i use this?? plese give in detail.
(Asp.net and c#)
Thanks in advance...
girish donde
|
|
|
|