Hi, I'm having trouble retrieving the values from textbox in my aspx page. Please can someone help?
Here's a snippet from the aspx page ...
AutoGenerateColumns="False" DataKeyNames="WebsiteID" HeaderStyle-ForeColor="White" ShowFooter="True" OnRowCommand="GridViewWebsiteList_RowCommand" OnRowDeleting="GridViewWebsiteList_RowDeleting" OnRowEditing="GridViewWebsiteList_RowEditing" OnRowUpdating="GridViewWebsiteList_RowUpdating" OnRowCancelingEdit="GridViewWebsiteList_RowCancelingEdit" onrowdeleted="GridViewWebsiteList_RowDeleted"> CommandName="New" Text="New" /> Text='<%# Bind("WebsiteID") %>'> Text='<%# Bind("WebsiteID") %>'> Text='<%# Bind("WebsiteName") %>'> Text='<%# Bind("WebsiteName") %>'>
|
and here's the code behind snippet.
It's the txtWebsiteName, txtWebsiteURL, txtServerIP text boxes that my code behind does not retrieve the data from.
protected void GridViewWebsiteList_RowUpdating(object sender, GridViewUpdateEventArgs e) {
string theWebsiteID = GridViewWebsiteList.DataKeys[e.RowIndex].Values[0].ToString();
TextBox txtWebsiteName = (TextBox)GridViewWebsiteList.Rows[e.RowIndex].FindControl("txtWebsiteName"); TextBox txtWebsiteURL = (TextBox)GridViewWebsiteList.Rows[e.RowIndex].FindControl("txtWebsiteURL"); TextBox txtServerIP = (TextBox)GridViewWebsiteList.Rows[e.RowIndex].FindControl("txtServerIP");
Update(theWebsiteID, txtWebsiteName.Text, txtWebsiteURL.Text, txtServerIP.Text);
lblMsg.Text = "Updated record for " + txtWebsiteName.Text;
GridViewWebsiteList.EditIndex = -1;
BindGrid(); }
|
Any help would really be appreciated!
Thanks,
Grant
Grant VolkerPosted Mar 15, 2010, 7:29 PM
There was no error thrown. I have successfully implemented what I wanted with inspiration from
http://www.aspdotnetcodes.com/GridView_Insert_Edit_Update_Delete.aspx
Amit ChoudharyPosted Mar 15, 2010, 1:53 AM
I could't see any thing wrong with your code its seems to be working.... well where are you getting problem?? if any error then please post that error here with stack trace may be there is some other reason..