VS 2012 - Can Do A Post From GridView?

Jun 4, 2013

I have a gridview on a page where I display a list of items. One of the columns on the gridview is a hyperlink that sends a querystring to another page, which then displays the details of the selected item. It's your basic CRUD operation and it works great except for one thing: The query string has some information in it that I'd rather not be public. Is it possible to have a link or a button or some other sort of column that does a post to the new page instead of a querystring?

View 29 Replies


Similar Messages:

VS 2012 - Update Button In Gridview

Sep 30, 2013

I have a web app and one of the forms has a gridview and also two tables.

Because of this, I have a save button that saves new data; and I also have update buttons that appear each time the user clicks Edit in a row of the gridview.

I would like to see if there's a way to combine my save with my update so that the user only has to click one time to save.

I was looking for the update button link that appears in my gridview via the source code page, but it's no where to be found.

Is there a way to move the update button or not show it? Not sure how to even start using the save to incorporate both.

View 2 Replies

VS 2012 - Freeze Gridview Header And First 2 Columns

Jul 10, 2013

I need to freeze my gridview header and the first two columns. I found a great jquery plugin called tinytbl which does the job but it messes up the inline javascript on my page which causes a few issues.

Any better way to freeze columns? I see alot of examples on the net using css but they use expression which has been deprecated.

View 1 Replies

VS 2012 - Repopulating Cbo2 Based On Selection Of Cbo1 In GridView

Jul 9, 2013

I have an web app I'm developing and it contains a form with a gridview. The grid view has 2 dropdowns...cbo1, and cbo2

The gridview is in Edit mode and when I select something from cbo1, i need to re-populate cbo2.

Here's the source code that shows my grid and dropdowns:

Code:
<asp:GridView id="gridOutdoor" EnableViewState="false" onrowdatabound="gridOutdoor_RowDataBound" onrowediting="gridOutdoor_RowEditing" AutoGenerateColumns="False" runat="server" PageSize="5" CssClass="GridView" BackColor="White" BorderColor="#3366CC" BorderStyle="None" BorderWidth="1px" CellPadding="4" >
<Columns>
<asp:CommandField ShowEditButton="True" />

[Code] ...

Here's the sqlDataSource that's also in the source page:

Code:
<%-- cbo1--%>
<asp:SqlDataSource ID="SqlDataSourceProduct" runat="server" CancelSelectOnNullParameter="false" ConnectionString="<%$ ConnectionStrings:QuoteToolConnectionString %>"
SelectCommand="select distinct cat1 as Product from QuoteItems where accessory=0">
</asp:SqlDataSource>
<%-- cbo2--%>

[Code] ...

As you can see, for sqlDataSourceBodyColor, I have a param and it needs to get the value from the user's selection of cbo1.

In the RowDataBound event, I had set it up to get this value. It works great for the initial load of the page; but when I make a selection from cbo1, the value of cbo1 when debugging, is always what ever was first set when going into edit mode - the bound items.

here's the code for that:

Code:
Protected Sub gridOutdoor_RowDataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs)
If e.Row.RowType = DataControlRowType.DataRow Then
Dim cbo1 As DropDownList = CType(e.Row.FindControl("ddProduct"), DropDownList)
Dim cbo2 As DropDownList = CType(e.Row.FindControl("ddBodyColor"), DropDownList)

[Code] .....

View 1 Replies

VS 2012 - How To Format Table Rows / Cells To Have Same Width As Gridview Cells

Jul 17, 2013

I have a form that contains a asp:Table and it contains 2 rows with 6 columns.

Also on my form is a gridview. It contains one row with 6 columns. (see pic)

I'd like to see if I can format both so that they appear to have the same over-all width and cell width too.

I'd like to know if it's possible to do this in the source view - rather than programmatically.

In the pic, the top is the grid view and underneath is the table.

View 6 Replies

Data Controls :: Add Dynamic Rows In GridView With TextBox And Keep Edited GridView Row Data On Post Back

May 7, 2015

I have 3 textboxes , 1 dropdown , 1 Button and 1 gridview .

Textboxes ID are :ACode , ADesc , ASeq
DropDown ID is :CPhase
Button ID is :AddRowBTN
GridView ID is :PhasesTempGrid

Now whats the story is ?After adding some data into textboxes , when a user clicks ADDRow BTN , that data gets saved into datatable , then that datatable gets binded to gridview and it shows my textboxes data in it .

What i want to achieve ?In my gridview i am use templateField and inside that template field there are textboxes ( Let the users edit the row without clicking any button ) .

Take an example of dummy data and problem persisting in there :for e.g i put some data in textboxes :ACode = "ABCD"ADesc = "EFGH"ASeq = "HIJK"Then i click Add BTN , it saves the data in datatable and show in gridview , now if i do this in gridview :ACode = "Edited ABCD"ADesc = "Edited EFGH too"ASeq = "WoW There"Then i click Add BTN , it removes the edited record in gridview and shows original data which had came earlier from textboxes :ACode = "ABCD"ADesc = "EFGH"ASeq = "HIJK"I don't want that to be done ... Simple is that user can enter data from textboxes , click the btn to submit into grid then he can edit the data like he want ... data must not get flashed , here's my coding i have done so far : 

public void AddNewData()
{
var dt = new DataTable();
if (ViewState["myDatatable"] != null)
{
dt = (DataTable) ViewState["myDatatable"];
}

[CODE]...

here i havent added dropdown combo in gridview but you can do it so that it will save my time (Bind it just the way PhaseDropDown have bind)...

View 1 Replies

Social Networking :: Post Tweets To Twitter Account And Post To FaceBook Wall?

Aug 6, 2012

code to integerate twitter and facebook in my application,

View 1 Replies

VS 2012 - Get ID Of Inserted Row

Sep 5, 2012

How I would get the ID of the row that was inserted using the following? (VS2012 VB.NET)

Code:
Dim connString = ConfigurationManager.ConnectionStrings("DBConnectionString").ToString
Dim conn As New SqlConnection(connString)

[code]....

View 1 Replies

SQL Server :: Post That Have DateCreate 2010-12-01 There Is No Post Deleted?

Dec 20, 2010

I have this SP.When I run it and there is no post that have DateCreate 2010-12-01 there is no post deleted but there is no error catched.

[Code]...

View 4 Replies

C# - Post Value To New Window From Gridview Selected Column?

Jul 27, 2010

I tried to post the selected ID number from source page into a new target page(pop up window) and display more details on that page.

I have googled the varies solutions but seem like they are a bit out of date.
Here are my questions:

What's the best way to post it (session? cookie?) or Page.PreviousPage.FindControl? or add a control into <ItemTemplate>? or Javascript?

I don't want to use a query string since I don't want the user to manually modify it.

What should I write on the target page to grab that value?

protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{
string testID= GridView1.SelectedRow.Cells[3].Text;
// eg. Session["ID"] = testID;
//eg. open new pop up window ("target.aspx");
}

View 2 Replies

VS 2012 - Creating Layout Using CSS

Jun 23, 2014

I need to create below layout using Div's. i should not use table to create this. also i need to do this with css and I have to use % for width and height. Any sample code. on the below image left border is missing. But I want that as well.

View 4 Replies

VS 2012 - String URL Parameters In MVC 4

Jul 10, 2014

I have the following code:

HTML Code:
<html>
<head>
<script type="text/javascript" src="~/Scripts/jquery-2.1.1.min.js"></script>
<script type="text/javascript" src="~/Scripts/jquery.unobtrusive-ajax.min.js"></script>

[Code] .....

This code works fine for populating a div with html from a view. Where I'm having trouble is figuring out how to pass a string parameter to my view, so as to customize what the view returns. Passing a number doesn't seem to be a problem, but I can't get the string right. I need to know:

1. how to format the string in the url - or even if passing the string in url is right.
2. how to structure the route in routeConfig.

View 5 Replies

VS 2012 / Best Way To Produce A Percentage Bar?

Dec 2, 2013

I need to produce a simple graphic which is a simple rectangle (bar) with a variable portion filled in to denote a percentage.

What is the best way to achieve this? I had a look at the .net charting tools but the nearest I could find to what I needed was the barchart which didn't quite seem to meet my needs for a single value.

View 1 Replies

Web Forms :: GridView's CSS Lost After Ajax Post Back?

Feb 24, 2010

I have a css file which is external registered in Master Page which contents the following code :

.Item:hover
{
background-color: #def2fd;
font-weight: bold;
cursor:pointer;
}

The Item is applied for GridViewRow. This GridView is in a UpdatePanel, when I click a button to do a Ajax Post Back the CSS applied for the GridViewRow is useless (IE 6 only).

View 6 Replies

C# - Hold Temporary Information In Gridview Before Post Back?

Mar 28, 2011

I have a Dialog (Modal), where I'll register one (or several) contact.

the contact goes to a gridview, where they may be edited or deleted.

the data in the Gridview, can only be saved in the database at the end of the process.

How can I achieve this?

Modal code

[Code]....

OBS.:

I don't have a good sample of CSharp or html code, 'cuz i don't know how to achieve this. All my code look messy atm (trying a lot of things already) My GridView is an ascx, and the modal is in the same ascx. I belive some temporary table, or something like this will help, but i never did something like it (looks like a shop cart software), and i don't even know how look for it.

EDIT:

i did this code:

CSharp code:

[Code]....

i create one temporary gridview, but the data is empty, i tried pull it from my text in the modal, but i was not able to, i'm i'm not familiar in how i'll get the data from gridview to my database. (i believe this is the easier part, then i not focused at it in the moment)

View 1 Replies

VS 2012 - Not Getting Value From DropdownList On RowUpdating Event

Jul 10, 2013

I have a gridview that has 3 dropdowns. And when I am in edit mode, when updating via the RowUpdating event, I am not getting a value from my 2nd or 3rd drop downlists. Here's the code from RowUpdating:

Code:
Protected Sub gridOutdoor_RowUpdating(ByVal sender As Object, ByVal e As GridViewUpdateEventArgs)
'WHEN DEBBUGING, the text for ddBodyColor.Text is an empty string. I had selected a value prior to this event firing."
Dim ddBodyColor As DropDownList = DirectCast(gridOutdoor.Rows(e.RowIndex).FindControl("ddBodyColor"), DropDownList)
End Sub

Here's the source code for ddBodyColor:

Code:
<EditItemTemplate>
<asp:DropDownList ID="ddBodyColor" runat="server" TabIndex="2" AppendDataBoundItems="true" Enabled="true" DataTextField="bodyColor" DataValueField="bodyColor"><asp:ListItem Text="Select" Value="" /></asp:DropDownList>
</EditItemTemplate>

View 9 Replies

VS 2012 - How To Create Datetime Parameter

May 30, 2013

I have a form and I want to insert the current time at which the user clicks to insert into the table of my db.
When running, I get the following error when trying to insert into my sqldatasource:

"System.FormatException: String was not recognized as a valid DateTime."

What's wrong with my insert parameter?:

<InsertParameters>
<asp:Parameter Name="DateAdded" Type="DateTime" DefaultValue= "<% DateTime.Now %>" />
</InsertParameters>

View 6 Replies

VS 2012 - Get Checkbox Checked Value In DetailsView

Dec 30, 2015

I have created a single checkbox in the DetailsView of my Asp page. I then created VB code behind to set the value =1 if the checkbox is checked and value =0 if checkbox is not checked. I cannot get the code to work. The record will get created in my SQL database, but the checkbox field remains NULL

In SQL table, my field and datatype is: Greenfield, bit, NULL

The beginning code for DetailsView1 is:

Code:
<asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" BackColor="White" BorderColor="White" BorderStyle="None" BorderWidth="1px" CellPadding="3" CellSpacing="2" DataKeyNames="ID" DataSourceID="tblEntryFormDS" style="text-align: left; margin-bottom: 0px;" Font-Bold="False" Font-Names="Arial" Font-Size="Small" DefaultMode="Insert" GridLines="Horizontal" CssClass="auto-style47">
<AlternatingRowStyle BorderStyle="None" />

The code for the checkbox within DetailsView1:

Code:
<asp:CheckBox ID="CheckBox1" runat="server" Text=" Greenfield" AutoPostBack="True" />

And the VB code behind. I originally used OnCheckedChanged but that wasnt working and it was suggested of me to use DetailsView1_ItemInserting instead: (The Dropdownlists in the code are working)

Code:
Protected Sub DetailsView1_ItemInserting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DetailsViewInsertEventArgs) Handles DetailsView1.ItemInserting
Dim DropDownList6 As DropDownList = CType(DetailsView1.FindControl("DropDownList6"), DropDownList)
Dim DropDownlist9 As DropDownList = CType(DetailsView1.FindControl("DropDownList9"), DropDownList)

[Code] ....

View 1 Replies

VS 2012 - Webrequest Authentication 401 Unauthorized

May 1, 2015

I'm trying to connected to a third-party server, that allows API access via XML post/response. I've created just a very simple test page with a button to press.... the button should just go to the URL, log in with basic authentication and then return the response. if I use a browser and go to the URL, I see the XML response. Usuing my app, I'm still getting 401 unauthorized. I've been at this for hours, I've searched the forums and googled extensively, still no luck. Also, this is an internal app to internal server so security is not the highest priority. I'm setting the UN and PWD for authentication in a simple form.

Here's my VB code behind:

Dim request As HttpWebRequest
Dim response As HttpWebResponse = Nothing
Dim reader As StreamReader
Dim result As String
'disables self-signed SSL cert errors

[Code] ....

And the username and password are 100% accurate - as I mentioned above the code (well, implied).

I feel like this SHOULD be pretty easy: Overall request for testing: Submit a web request to a URL, disable the SSL check (self-signed certs used), login with basic UN and PWD I supply, return the response to a textbox.

View 1 Replies

VS 2012 - Class Is Not Returning Object

Feb 11, 2014

I have a class TicketOrder. It's not recognizing my lstSectionNumber (Tickets.TicketForm.lastSectionNumber is inaccessible due to its protection level).

Here is the code for TicketOrder class:

public class TicketOrder
{
public TicketOrder(TicketForm form)
{
this.form = form;
}
//Declare static variables

[Code] .....

This is my code behind:

public partial class TicketForm : System.Web.UI.Page
{
//Declare variables
int myInt;
TicketUser user = new TicketUser();
TicketOrder order;

[Code] .....

View 3 Replies

VS 2012 - Set BGColor Based On SQLDatasources

May 7, 2013

How to set the bgcolor of an asp.net cell from code behind using a value from a sqldatasource?

I have a working sql data source that is used to populate labels in my html form using asp.net.

The background color of the cell depends on a comparison of the actual value versus the target value. If the actual daily value exceeds the limit I would like to change the bgcolor of a cell in the web page. The actual value comes from one datasource and the limit comes from a 2nd data source.

In vb code behind I would like to accomplish the following pseudo code:

If (sqlsource1Total > sqlsource2Limit) Then
bgXCell.BgColor = "#ccff99"
Else
bgXCell.BgColor = "#ff9999"
End If

View 3 Replies

VS 2012 - Get Data In Code-behind From ListView

Jul 16, 2015

how I can get item values in a ListView in code-behind? I’ve searched high and low during the past 2 days and tried various possibilities to no avail. Data binding is being done in code-behind:

Code:
SQLString = "SELECT Field1, Field2, Field3 FROM Table1"
DataTable1 = LoadDataTable(Connection1, "SELECT Field1, Field2, Field3 FROM Table1")
ListView1.DataSource = DataTable1
ListView1.DataBind()
ASP:

[code]....

The aim is that once a user clicks on a particular row in the ListView a pop-up is displayed which in turn reflects all data related to the record. For the purpose of preparing the data for the pop-up I need to determine the unique record identifier.

I have the same code working perfectly in another app, which has to effect that once a user clicks on a particular row in the ListView a new tab is opened which in turn reflects all data related to the record.

View 1 Replies

VS 2012 - How To Handle Ajax Requests In MVC

Jun 24, 2014

This is sort of a continuation of a previous thread: View thread

The requirement I have is to be able to have a popup form that shows detailed data on a facility. This would be available on various pages of the website where the user may want to drill down and see detailed information on a facility. We also want to allow the user to update the data on the facility if so desired. I have the code working to show the popup form and get the html for the popup from a view. Right now I'm setting the values of the input boxes using razor code that accesses the @model object. That's about as far as I've gotten.

Where I'm struggling is:

1. How to tie the data in the inputs back to the view model.
2. How to write the ajax code to write the data back to the server. I tried using a standard form, but that redirects the original page that popped up the form. I want to leave that page alone and just submit the data back to the server and close the popup.

Now my dev lead wants us to use the dojo toolkit for our javascript library. That would be OK if I already knew what I was doing with regard to web development, but I don't - and documentation is just not very good with regard to dojo. I'm still trying to figure out html and mvc, so I thought I'd see if I can get this scheme working with some other javascript library first, and then see about switching it over to dojo.

I've read some about knockout and jquery, but with everything being so new to me it's hard to get all this to gel in my head, and I'm not sure about my design. I've read some about mvc's built in ajax tools, but so far all I'm seeing is stuff related to getting data and displaying it - not about submitting data.

I'd like to be able to send the data back to the server in the same object structure that I extracted it with - something that matches the model. I think this is doable, but I'm not sure - and the 'how' of it is escaping me at this point.

View 20 Replies

VS 2012 / Create A Function For Web Method That Is In DLL?

Jul 6, 2015

I want to create a function that a web method will call - and that function will be in a DLL.

I am assuming that having that function in a DLL is better then leaving it as source since it won't recompile when IIS recycles or whatever schedule that falls under.

Do I need to make this function in a different project (solution) and compile it down to a DLL and then refer to that folder location in the WEB.CONFIG?

And I assume I just put it in the BIN folder in INETPUB - right? Do I need a WEB.CONFIG reference to it as well - in production?

View 9 Replies

VS 2012 - Confirmation Dialog In UpdatePanel

Aug 20, 2014

A user inserts ad details and on button click saves them to database. If the save is successful, a DIV element slides down (becomes visible) allowing the users to add pictures for that ad.

As the users adds the pictures, they are being shown in a Repeater control. When you hover over a picture, a Delete button is displayed and when you click it, a confirmation message pops out asking the users if they really want to delete the picture.

Now this is where the problems begins. The code behind the button click doesn't wait for the user to click YES or NO. It just executes leaving the message displayed.

So to summarize:

- The entire "bottomDIV" element is wrapped inside an UpdatePanel with update mode set to "Conditional".
- Since the Button is inside the Repeater control, I cannot access its Click event. I use Repeaters ItemCommand to check for the correct Command Name.
- The Repeater Control is inside the same UpdatePanel
- The Update Panel has AsyncPostBackTrigger set to Repeater Control.

The HTML:

HTML Code:
<asp:UpdatePanel ID ="bottomUpdate" runat ="server" UpdateMode="Conditional" >
                         <ContentTemplate>
                        <div id ="bottomWraper">
                        <div id ="savePictureWraper" runat ="server" style="float:left; padding-top:3px;" >
                         <asp:TextBox ID ="pictureName" runat ="server" placeholder ="Naziv slike" style="width:181px;">
[Code] ....

The Script (using alertify.js to display the confirmation dialog):

HTML Code:
<script>           
        $("[id*=btnDeletePicture]").on("click", function () {
                alertify.confirm("Confirm?", function (e) {
                    if (e) {
                        alertify.alert("Successful AJAX after OK");
             
[Code] ....

The code behind is simple and all it does it executes the delete statement and then calls the displayPictures sub again. So, why the code behind doesn't wait for the user to select an option in confirmation dialog....

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved