|
Hi,
I have a gridview of 5 columns.In that 3 column has radiobutton grouped in each row.
<asp:templatefield sortexpression="Item" headertext="Item">
<headerstyle width="15%" horizontalalign="Center" forecolor="White">
<itemstyle wrap="false" horizontalalign="Left">
<edititemtemplate>
<asp:textbox id="txtEditItem" visible="false" runat="server" text="<%#Databinder.Eval(Container.DataItem,"Item")%>">
<itemtemplate>
<asp:label id="lblItem" runat="server" text="<%#Databinder.Eval(Container.DataItem,"Item")%>">
<asp:templatefield sortexpression="Yes" headertext="Yes">
<headerstyle width="7%" horizontalalign="Center" forecolor="White">
<itemstyle horizontalalign="Center">
<itemtemplate>
<asp:radiobutton id="rbYes" runat="server" groupname="item1" checked="true" enabled="true">
<asp:templatefield sortexpression="No" headertext="No">
<headerstyle width="7%" horizontalalign="Center" forecolor="White">
<itemstyle horizontalalign="Center">
<itemtemplate>
<asp:radiobutton id="rbNo" causesvalidation="true" runat="server" groupname="item1" enabled="true">
<asp:templatefield sortexpression="NA" headertext="N/A">
<headerstyle width="7%" horizontalalign="Center" forecolor="White">
<itemstyle horizontalalign="Center">
<itemtemplate>
<asp:radiobutton id="rbNA" runat="server" groupname="item1" enabled="true">
<asp:templatefield sortexpression="Comments" headertext="Comments">
<headerstyle width="44%" horizontalalign="Center" forecolor="White">
<itemstyle wrap="false" horizontalalign="left">
<edititemtemplate>
<asp:textbox id="txtEditComments" runat="server" text="<%#Databinder.Eval(Container.DataItem,"Comments")%>">
<itemtemplate>
<asp:label id="lblComments" runat="server" text="<%#Databinder.Eval(Container.DataItem,"Comments")%>">
in this Button "rbYes" is checked by default. if i cliked "rbNo" or "rbNA" the other 2 columns must be editable.
Can anyone help me out in this..
expecting ur response..
Kanimozhi.S
|
|
|
|
|
Does this help any?
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1727092&SiteID=1
|
|
|
|
|
HI ALL
CAN ANY ONE HELP ME WITH THIS....
I HAVE A DATAGRIDVIEW IN MY WINDOWS APPLICATION AND I POPULATE IT WITH DATA PROGRAMATICALLY.
BUT NOW I WANT TO PERFORM THE FOLLOWING OPERATIONS DIRECTLY ON MY DATAGRIDVIEW...
1. ADDING A NEW ROW TO DATAGRIDVIEW.
2. EDITING A ROW .
3. UPDATING THE EDITED ROW TO DATABASE.
4. DELETING A PARTICULAR ROW FROM THE DATAGRIDIEW.
ALL THESE OPERATIONS SHOULD REFLECT DIRECTLY IN THE DATABASE.
IF SOMEONE CAN HELP IT WILL BE APPRECIABLE.
THANKS.
|
|
|
|
|
In visual studio you can change the settings of grid view control by checking the edit, new check boxes.
First do that and find how the coding got changed in code behind.
I think based on that you can make the changes for your project.
Even I am new to VB.net, but I think it helps you.
dil
|
|
|
|
|
Hi
Thanks for ur coments i'll try it and let u know.
|
|
|
|
|
I am a beginner at this, so please talk in SIMPLE terms. I'm trying to create a program based off an Access table (actually four) that will control the project numbers, assemblies, product numbers, and product details. I have four listboxes, at the top of the form, that display each of the areas. Each of them has a go button under them. Below that I have some textboxes, that I would ilke to use for manual entry, and a GO button. Below all that I have a picture box, five text boxes, and a multi-line textbox that will contain the description. I'd like to have it where you click on the last go button (after all the information has been entered), the info shows up below. The hard parts will be the listboxes at the top and making the textboxes display the correct information. I need the project numbers in the first one, and so on. I can put the program (or what I have of it) on an FTP site if needbe, but due to the sensitive nature of the database tables I cannot publish them. Thank you for your time.
-----------------------------
If at first you don't succeed, use more duct tape, a bigger hammer, or just don't fail in the first place!
|
|
|
|
|
Hi everyone
I have the folowing code in the Business class in my program, but when i run it says that there's an error in the sql. Can you please help
Public Function AddSale(ByVal dtDate As DateTime, ByVal bookcode As String, ByVal InvoiceNo As String, ByVal qty As Integer, ByVal subtot As Single, ByVal vat As Single, ByVal tot As Single) As String
Dim sql As String
Dim cmd As OleDb.OleDbCommand
Dim result As String = ""
Try
sql = "INSERT INTO SALES (Dates, BookCode, InvoiceNumber, Quantity, SubTotal, VAT, Total) Values ( " + dtDate + " ,'" + bookcode + "','" + InvoiceNo + "', qty , subtot, vat, tot)"
cmd = New OleDb.OleDbCommand(sql, con)
cmd.Parameters.Add(New OleDb.OleDbParameter("@qty", qty))
cmd.Parameters.Add(New OleDb.OleDbParameter("@subtot", subtot))
cmd.Parameters.Add(New OleDb.OleDbParameter("@vat", vat))
cmd.Parameters.Add(New OleDb.OleDbParameter("@tot", tot))
cmd.Parameters.Add(New OleDb.OleDbParameter("@dtDate", dtDate))
If cmd.Connection.State = ConnectionState.Closed Then
cmd.Connection.Open()
End If
cmd.CommandText = sql
cmd.ExecuteNonQuery()
result = "true"
Catch ex As Exception
result = ex.Message.ToString()
End Try
Return result
End Function
|
|
|
|
|
When adding parameters, the parameter names in the SQL must match the parameters that you add: so your SQL should look like this:
sql = "INSERT INTO SALES (Dates, BookCode, InvoiceNumber, Quantity, SubTotal, VAT, Total) Values ( " + dtDate + " ,'" + bookcode + "','" + InvoiceNo + "', @qty , @subtot, @vat, @tot)"
You are also adding the date as a parameter "cmd.Parameters.Add(New OleDb.OleDbParameter("@dtDate", dtDate)) " after you have already embedded it in the SQL. So you may want to change your SQL to look something like this:
sql = "INSERT INTO SALES (Dates, BookCode, InvoiceNumber, Quantity, SubTotal, VAT, Total) Values ( @dtDate ,'" + bookcode + "','" + InvoiceNo + "', @qty , @subtot, @vat, @tot)"
And given that you are using parameters, you may want to add the BookCode as a paramter aswell, for consistency.
Hope this helps
|
|
|
|
|
G'Day,
I'm trying to set the row height for a custom / owner drawn list view control when displaying it in 'Details' view (not Large Icon). I have researched enough to think that I need to handle the WM_MEASUREITEM message that is sent to the parent of my list view. (The MSDN site indicated that the measure item message was sent to the parents wndproc.)
I hope this question isn't to vague for people, but I'm hoping someone can give me some direction in either an easier way of setting the ListView row height, or help me to understand the steps in capturing the correct messages to alter the row height.
I am currrently running VS.Net 2003
Thankyou in advance for any assistance.
bigjokey -(I'm not insinuating anything with my user name, it was a suggested name on hotmail)
|
|
|
|
|
I am not sure if a direct solution exist. You can create an empty imageList and set its height to what you want and add that imageList to the SmallImageList . We had to use this solution in our previous project, we couldn't come up with a way to do this and we never bothered to research further as this fixed it.
|
|
|
|
|
Thankyou T.R. That makes sense, I will give this a try.
|
|
|
|
|
Hi
I have a DataGrid on a Windows form and want to export the data of Datagrids to an Excel worksheet.
I'm beginner to VB.NET programming. I'd appreciate if somebody can help me.
hprasain
|
|
|
|
|
0.Add Excel Object Library 11 Refrence to your project which is a COM
1. Instatiate an Excel application:
dim xlApp as new Excel.Application
2.define an Excel worksheet
dim xlWRK as Excel.Worksheet
3.define an Excel workbook
dim xlWBK as Excel.Workbook
4.Open a workbook in the instantiated application:
xlWBK=xlapp.workbooks.open("YourFile")
5.Get the sheet on the workbook
xlWRK=xlwbk.worksheets(0)
6.Get the value on the worksheet
dim value as string = xlwrk.cells(1,1).value()
Note:Indexes of cells wil begin from 1
Note:Call xlapp.quit when you do not need the application(it may remain in the memory)
Note:You can view the excel application by changing the visible property of xlapp to true(xlapp.visible=true)
A.E.K
|
|
|
|
|
Thanks a lot!
To make your code work well I have to make a change on xlWRK=xlwbk.worksheets(0)
to xlWRK=xlwbk.worksheets(1).
Once more thanks a lot!!
|
|
|
|
|
I am trying to get a contextmenu to show when I right click on a datagrid.
This works fine as long as there is no text selected on the grid I am clicking; however as soon as there is any text selected in the part of the grid I right click - I get the usual undo, cut, copy, paste, delete, select all contextmenu - which I do not want.
I even set a break point in the sub below and I noticed that if any text is selected and the right mouse button is clicked the sub is not entered.
Can someone help me with this please?
Guy
Private Sub onmyDataGridMouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles DataGrid1.MouseDown
Dim LocalMousePosition As Point
If e.Button = MouseButtons.Right Then
LocalMousePosition = DataGrid1.PointToClient(Cursor.Position)
ContextHandler("GridMenu")
DataGrid1.ContextMenu.Show(DataGrid1, New Point(LocalMousePosition.X,
LocalMousePosition.Y))
End If
End Sub
You always pass failure on the way to success.
|
|
|
|
|
your DataGridView may have mouse event for cells.
A.E.K
|
|
|
|
|
Ok Thanks.
The datagrid is a particulaly fiendish control.
The potential for it is enourmous yet Microsoft have made it diffucult to use.
You always pass failure on the way to success.
|
|
|
|
|
I have a string array. I want to run a query that will pull numerous paragraphs from a database.
the query works fine. I usually use string = rs.GetString, and then split the string on Chr(13) into a string array so I can loop through and place each array memeber into a combobox or listbox.
however, in this situation, there is no distinct delimiter to split on.
I was wondering, if I use recordset.GetRows, use that in a loop...if I could then use some property/sub routine within recordset so that I can place each result in a specific element in my array manually using a loop. Right now I have the following:
'all definitions aside'
rs.Open LSQL, cnn
rowCount = rs.GetRows
For i = 0 To i < rowcount
paragraphArray(i) = rs.?????
I want to put basically the first recordset result into paragraphArray(0), second into paragraphArray(1), and so on until the recordset is at the end. I'm not sure of the exact code to use. Any ideas?
|
|
|
|
|
Hi reegan41,
I think you should store all fields value from recordset into string variable.
You can do this by read all fields with For Each Statement.
GoodID
|
|
|
|
|
helllloooo frnds,
can any one tell me regular expression to validate the domain name
that is
www.codeproject.com
plzz help...me
regards,
koolprasad2003
Be a good listener...Because Opprtunity knoughts softly...N-Joy
|
|
|
|
|
Just want to understand......you want a regular expression to see if the domain is a registered domain on the internet?
Tom Wright
tawright915@gmail.com
|
|
|
|
|
hello tom,
i want to validate a text box which should be accept only
"www.codeproject.com" type of string
thankx for your favorable reply..
regards,
koolprasad2003
If the message is useful for U then please Rate This message...
Be a good listener...Because Opprtunity knoughts softly...N-Joy
|
|
|
|
|
the regexp would be:
www.codeproject.com
|
|
|
|
|
thankx for your favorable reply..
regards,
koolprasad2003
Be a good listener...Because Opprtunity knoughts softly...N-Joy
|
|
|
|
|
A regular expression for validating domain names as follows:-
^[a-zA-Z0-9]+([a-zA-Z0-9]\-\.]+)?\.(com|org|net|info|biz|co.uk|org.uk|net.uk|gov|gov.uk)$
But I prefer to use the following function, as I actually checks to see if the domain is hosted :-
Public Function IsWebAddressActive(ByVal URL As String) As Boolean<br />
Try<br />
Dim req As System.Net.HttpWebRequest<br />
Dim res As System.Net.HttpWebResponse<br />
<br />
req = System.Net.HttpWebRequest.Create(URL)<br />
'set the user agent <br />
'some site might brush you off if it is not set (to stop bots and scrapers) <br />
req.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.0.3705)"<br />
<br />
'get response from website<br />
res = req.GetResponse()<br />
res.Close()<br />
Return True<br />
Catch<br />
Return False<br />
End Try<br />
End Function
and to use it, you would call it as follows:-
Dim bIsWebSiteActive as boolean<br />
bIsWebSiteActive = IsWebAddressActive("http://www.codeproject.com")
which, hopefully with return True , or if the website is not online it would return False
Steve Jowett
-------------------------
Sometimes a man who deserves to be looked down upon because he is a fool, is only despised only because he is an 'I.T. Consultant'
|
|
|
|
|