|
|
what wil be the correspomding vb.net code for this:-
if(!Convert.IsDBNull(TxtBxMp .Value)
{
cmd.Parameters("@no_mp_record").Value = CType(TxtBxMp.Text, Int32);
}
|
|
|
|
|
Well, this is not valid code. It's missing a ), and CType is already nasty VB code, C# does not support it ( I just double checked ).
Replace the ! with Not, replace the {} with then and endif, remove the semicolon, and you're probably there.
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 )
|
|
|
|
|
hi
First of all C# doesnt support CType
VB code
If Not Convert.IsDBNull(TxtBxMp .Value) Then<br />
cmd.Parameters("@no_mp_record").Value = CType(TxtBxMp.Text, Int32)<br />
End If
Best regard
Pathan
---------------------------------------------------
|
|
|
|
|
ya , i also think so. but i had problem which i posted over here in response i got this soln. .
the problem is:
there are textboxes where i am entereing the int type value.here i am using sp to
save the value.if i am giving all the values in the textboxes the its working fine.but if i
am not giving all the values in the textbox means if i left some textbox with giving any value
.then its showing error as:" Message="Conversion from string " to type 'Integer' is not valid.".
where i have written the code as" cmd.Parameters.Add("@no_mp_record", Data.SqlDbType.Int)
cmd.Parameters("@no_mp_record").Value = CType(TxtBxMp.Text, Int32) "
and in the database i have defined its value as null and also in storeprocedure i have done accaordingly.
i have executed the sp seperately n its working.
why i am getting the error. or what will be solution for the error
|
|
|
|
|
TextBox.Text Return String If u pass nothing then it return String.Empty means "" and It can not convert "" to Int.Thats why u r getting this error.
Pass 0 if TextBox.Text=String.Empty Or Pass String Value to SP Instead Of Int.
Best Regard
Pathan
---------------------------------------------------
|
|
|
|
|
hello biswa,
it is better to go to google and type the conversion code u will get the conversion code.OK
byeee
Murali
Murali
|
|
|
|
|
If Not Convert.IsDBNull(TxtBxMp .Value Then<br />
cmd.Parameters("@no_mp_record").Value = CType(TxtBxMp.Text, Int32)<br />
End If<br />
<br />
'----------------------------------------------------------------<br />
' Converted from C# to VB .NET using CSharpToVBConverter(1.2).<br />
' Developed by: Kamal Patel (http://www.KamalPatel.net) <br />
'----------------------------------------------------------------
Powered by: http://www.kamalpatel.net/ConvertCSharp2VB.aspx[^]
|
|
|
|
|
Hey there.
Check out this cool site....it will convert the code for you.
Ive used it and it works well.
http://labs.developerfusion.co.uk
ciao
Dazz
|
|
|
|
|
Dear all,
I am using asp.net, C# , Sql Server 2005.
I am using datalist control and bind it like
<itemtemplate>
<asp:imagemap id="ImageMap3" imageurl="<%# DataBinder.Eval(Container.DataItem,"Photopath1") %>" runat="server">
<%# "Category : " + DataBinder.Eval(Container.DataItem,"Categoryid1") %>
<asp:imagemap id="ImageMap1" imageurl="<%# DataBinder.Eval(Container.DataItem,"Photopath1") %>" runat="server">
<%# "Category : " + DataBinder.Eval(Container.DataItem,"Categoryid2") %>
Here I am binding category and image path field.
Now these are static field I would like to know whether Is it possible to dynamically bind these field. That mean based on dataset filed can I be able to bind all the filed irrespective of its field defined
Thanks
imran khan
|
|
|
|
|
Do you mean to dynamically find the fields and show whatever is there ? The GridView at least has an AutoPopulate property that will just show whatever is in the data source.
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 )
|
|
|
|
|
when you bind the dataset to the datalist control, ItemDataBound Event of the datalist control fires for each item in the datalist. In the Event you can find the control and assign the data item value to the control.
Regards John
|
|
|
|
|
Other than the GridView that Christian has already recommended, I would also take a look at the Repeater Control[^].
It will repeat whatever HTML layout you want to use for each item in a list.
|
|
|
|
|
Hi all,
I'm pretty new to AJAX programming, and just started integrating the Microsoft Ajax toolkit etc. to VS2005. I followed the first sample and built a webpage containing a ScriptManager and an UpdatePanel, in which I've put a textbox and a button, and saw that AJAX worked fine to update this part of the page without the need to refresh the whole page.
But then I replaced my textbox / button controls with a self-made WebControl, which creates an HtmlTable in the CreateChildControls, containing rows and cells, and these cells contains linkbuttons with Events behind. This control was in the ContentTemplate of the UpdatePanel.
But when I click a linkbutton of my WebControl, the whole page gets postback and refreshed ... So my question is :
How can I build an AJAX enabled WebControl so it can behave like the standard textbox / button controls ?
Do you guys know a good tutorial or book about that ?
Thanks !
Stéphane
|
|
|
|
|
It's worth mentioning that you do not need the AJAX toolkit, it's a framework designed to make AJAX happen automagically, but you get far greater control by writing your own code. If you choose to use the toolkit, make sure you always make clear you're using it, as your question is not an AJAX one, but a question on the MS AJAX toolkit.
A linkbutton in general creates a postback, I'm not sure how this relates back to textbox and button controls, or what exactly you're after ? you want the linkbuttons to use AJAX ?
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 )
|
|
|
|
|
Hi !
And thanks for answering me !
I'm sorry for my confusion between AJAX and MS AJAX ... Maybe they should have kept "Atlas" as the Framework name to avoid mistakes ...
In fact I'm not a Javascript fan, and never was ... The MS AJAX seemed to be a good solution for me, as it could give me the ability to use AJAX benefits without wondering about how it is implemented behind ...
My first try was to put in an UpdatePanel, a textbox and a button. In the eventhandler of the button, using C# code in the codebehind file, I put a statement like this :
<br />
protected void btnUpdate_Click(object sender, EventArgs e)<br />
{<br />
txtTest.Text = "This is a test";<br />
}<br />
At runtime, a click on the button generates a PostBack but the page doesn't move, only the textbox gets some text in it.
Then, to ensure a linkbutton can do that, I've added a link button in the same UpdatePanel. Here is the code :
<br />
protected void lkbAnotherTest_Click(object sender, EventArgs e)<br />
{<br />
txtTest.Text = "Link clicked";<br />
}<br />
The same : at runtime, the click on the linkbutton generates a postback but with the "AJAX behaviour", only the textbox got some text in it, the rest of the page didn't move.
But when I put a WebControl self made which is composed of a table with rows and cells themselves composed of many linkbuttons, at runtime, when I click on a linkbutton of my WebControl, the whole page gets refreshed ... I'm then wondering why ! And how I could get it work !
|
|
|
|
|
Hi,
I am working with Asp.net 2.0 (VB.NET)
I am getting a Exception :System.Threading.ThreadAbortException
at
Response.Redirect("Searched.aspx")
I have tried using below all code but I am getting the same exception
Response.Redirect("Searched.aspx", false);
Response.Redirect("Searched.aspx", true);
Response.Redirect("Searched.aspx");
Please help.
|
|
|
|
|
Sounds like you are trying to redirect at the wrong point in the page flow. What event are you trying to call Response.Redirect from?
|
|
|
|
|
|
|
Thanks you very much, Got it done
|
|
|
|
|
I deploy a web application which is running fine on my computer but giving dz error on my web server (host server) . I used C# and MySql as database.
Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: Could not load file or assembly 'MySql.Data, Version=5.0.3.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' or one of its dependencies. The system cannot find the file specified.
Source Error:
Line 20: <compilation debug="true">
Line 21: <assemblies>
Line 22: <add assembly="MySql.Data, Version=5.0.3.0, Culture=neutral, PublicKeyToken=C5687FC88969C44D">
Line 23:
|
|
|
|
|
I ve been able to solve the problem thank so much. I just copiy MySql.Data.dll file to bin folder on the host server and that is it. Thank you so much. I m very grate ful.
|
|
|
|
|
I'm thinking that this isn't possible, but it can't hurt to ask. I'm trying to create a custom server control that takes a generic type, so for example:
public class MyControl<T> : WebControl { ... }
This works fine and I can create the control programmatically in the code behind file like so:
MyControl<Type> MC = new MyControl<Type>()<br />
MyForm.Controls.Add(MC);
I was wondering if there is any way to do that non-programmatically through the visual studio page designer. When I add it to the toolbox it shows up as: MyControl`1 which is the syntax used for a class with one type parameter, but when I try to drag it onto an aspx page it says: Element 'MyControl' is not a known element. If anyone knows how to do this I'd appreciate the info. Thanks.
- Matt
|
|
|
|
|
hi
i want to create asp.net user with code without using CREATEUSER WEBCONTROL.
how i can do this...
thanks
|
|
|
|