Imanage to insert data from textbox into data table and bind that datatable to datagrid. actually I want following things
I am making an application in which I have to insert data in data table .and bind that datatable to datagrid.
1) but i want to insert this values from datagrid footer or datatable footer how to do that.
2) also i want to update the row of data grid . I am not using database for that . how to update a single row of datagrid from using data table there is no transection with database.
The code i wrote is follow
Dim TB As DataTable
Dim TR1 As Data.DataRow
Dim td1 As DataColumn
Dim TD2 As DataColumn
Dim td As DataColumn
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Me.IsPostBack = False Then
TB = New DataTable
td1 = New DataColumn
td1.ColumnName = "SHAPE"
td1.DataType = GetType(String)
td1.AllowDBNull = False
Sub AddToCart(ByVal sender As System.Object, ByVal e As System.EventArgs)
TB = Session("DiaDetails")
TR1 = TB.NewRow
TR1("Shape") = txtshape.Text
TR1("Size") = txtsize.Text
Datagrid1.DataSource = TB
Session("DiaDetails") = TB
Sub Delete_Item(ByVal s As Object, ByVal e As DataGridCommandEventArgs)
Private Sub Datagrid1_EditCommand(ByVal source As Object, ByVal e As tem.Web.UI.WebControls.DataGridCommandEventArgs) Handles Datagrid1.EditCommand
Datagrid1.EditItemIndex = e.Item.ItemIndex
Private Sub Datagrid1_UpdateCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles Datagrid1.UpdateCommand
Dim strshape As String = CType(Datagrid1.Items(Datagrid1.EditItemIndex).Cells(1).Controls(0), TextBox).Text
Dim strid As String = Datagrid1.Items(Datagrid1.EditItemIndex).Cells(0).Text
Datagrid1.EditItemIndex = -1
in my application, i am using outlook 11.0 to send mail to the recipient whose address stored in excel. i am fetching excel and stored the address in grid view and sending the mail. For me the mail should send to all the recipients but one mail at a time. after sendnig the first mail the next mail should send. i used for loop for this. but very first email id is sending properly thro outlook. but for the next loop it gives error that item moved or deleted. i give the code. please help.
Outlook.Application o = new Outlook.ApplicationClass();
Outlook.MailItem myMail = (Outlook.MailItem)o.CreateItem(Outlook.OlItemType.olMailItem);
for (int i = 0; i < GridView1.Rows.Count; i++)
myMail.Subject = "Check";
myMail.Body = "Its a Demo Mail. Good Afternoon";
myMail.Attachments.Add("C:/New1.txt", Missing.Value, Missing.Value, Missing.Value);
I am using Visual Studio 2003 and SQL Server 2000 to try and develop an E-Commerce website. Amongst others I have a Customers table, Suppliers table and a Roles table in the database. What is the standard procedure regarding storing usernames and passwords? At the moment I have Username and Password columns, as well as a foreign key column to the Roles table, in the Customers table as well as in the Suppliers table.
On my login page I have two radiobuttons so the user can specify whether they are logging in as a Customer or a Supplier. That determines then in which table I go to check the username and password. If the user is a valid user, the following line of code runs:
The problem is that then I do not know how to use the Application_AuthenticateRequest() method in the Global.asax.cs. How would I specify in there which database table to be accessed to retrieve the roles? I tried using session variables, but they were not accepted in the Application_AuthenticateRequest() method.
protectedvoid Application_AuthenticateRequest(Object sender, EventArgs e)
//??? How to specify here which table to access
string roles = Access_Customers.GetCustomerRoles(HttpContext.Current.User.Identity.Name);
HttpContext.Current.User = new GenericPrincipal(HttpContext.Current.User.Identity, roles);
Am I missing the point completely here? Is there a better way of approaching this? Perhaps have all login data (usernames and passwords in one table)?
What is better from a security point of view to use in authentication and authorization: Cookies or Session variables?
If you have defined roles, user and password in database, then why u r using Application_AuthenticateRequest(Object sender, EventArgs e) event of globaal.cs. You can directly access through database by forms submit button.
i want to know how should i return values from jagged arrays
public string fync(Type webtype)
string dimen= new string;
dimen = getDetails(Type Webtype);
//how should i collect values in dimen
public string getDetails(Type webtype)
//suppose ss is jagged array of dimension ss
//ie i have ss = i have something
// ss= i have something else
// ss= i have some third item
I just have one small doubt. I just inserted one button into the itemtempelate of a datalist and without writitng any code i ran the project. i tried the same with repeater and datagrid. but the button inserted was not to be seen in any of the above mentioned controls. Where as when i inserted a button to a form i was able to see that button. can anyone tell me why is it like that.
The DataList control is a data-bound control like Repeater, DataGrid. It means you need to bind a datasource to the control to create the UI, otherwise the control displays nothing. You can read more about how to use these controls in MSDN.
I'm playing by the rules, I have a theme setup with a skin file for all my control style settings.
For some reason as I'm working what appear to be defaults for styles for controls keep creeping back into my aspx page and overriding my .skin file.
I think when I bring up the properties of a component in the visual designer and change something innocuous like enableviewstate it's automatically setting a bunch of default style settings that I had just removed.
Is there any setting or way to prevent visual studio from setting any default style settings for components either existing ones or when putting new ones on the forms?
(or is this just a half implemented feature?)
P.S. And why doesn't it preview the page in the designer with the settings in the skin file (or is this again a half implemented feature?)
I don't have it in front of me but definitely settings for fonts etc.
I'm now wondering if it's only the infragistics components that are doing this. I nearly work with only infragistics components so perhaps it's something that doesn't happen with the "stock" ms components.
I have a very small problem, but could not find the solution.
If the entire web page is reloaded when the user hits the button, then you simply persist the client side data in a hidden field so that it can be posted to the server and you can easily access it. You might only consider using AJAX when you don't want to reload the entire web page, and you surely can find lots of tutorials out there with your friend Google.
Hi, from Italy,
I've a problem with a RegularExpressionValidator.
I want validate a textbox following these condition:
1) length must be beetween 3 and 7 charachters
2) spaces not allowed
3) must contains at least 2 of these special charachters ($,%,&,/,(,),=,£,")
4) must contains only these special charachters ($,%,&,/,(,),=,£,"), numbers, letters (uppercase and lowercase) and no spaces
It's too difficult for me.
In Italy there aren't serious guidelines for RegularExpressions, and i've not find answer to my questions online in other sites.
When I use absolute positioning ( position:absolute; left:376px; top:25px; ) in a html control to position an image-button like this one:
<img src="Images/genericbtn.gif" alt="" border="0" usemap="#Map4" style="position:absolute; left:376px; top:25px; z-index:3; width: 95px; height: 23px;"/>
<area shape="poly" coords="94,0, 93,7, 78,22, 0,21, 1,15, 15,0" href="ShoppingCart.aspx" />
It works fine. It gets positioned where it is supposed to.
However, when I use a web control instead ( because I need a C# OnClick event handler ) like this:
<asp:ImageMap ID="checkout" CssClass="CheckBtn" ImageUrl="~/Images/genericbtn.gif" OnClick="checkout_Click" hotspotmode="PostBack" runat="server">
<asp:PolygonHotSpot Coordinates="94,0, 93,7, 78,22, 0,21, 1,15, 15,0" postbackvalue="Yes" />
And using this CSS code:
It does not obey the “left” absolute coordenate. Instead Visual Studio throw it close to the left window border.
1-Is there a solution for that ?
2- I also notice that when you change the CSS absolute position of a html control in the code, VS not always updates it immediately through compilation. Instead it updates it unpredictably and only when you close and run VS again several times.
The same happens when you replace a image file but keeps its old name. VS does not updates the image.