|
N a v a n e e t h wrote: Firebug is an excellent tool
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
hi ,
I am doing this from .vb file so how to debug this.
Thanks ,
Amit
|
|
|
|
|
Hello All,
I am using GridView in my application but not its edit feature due to some reason.
I am editing data manually by writting code.
Problem is when i update data, it is updating in database but its not showing immediately in my GridView.
Can anyone tell me how to reflect changes immediately in GridView.
Thanks,
Nagendra.
|
|
|
|
|
u Call the bind method outside postback or after saving call the bind method
|
|
|
|
|
No, i have used inbuilt SqlDataSource with GridView but just for displaying data.
I am doing editing manually, which don't have any connection with SqlDataSource.
|
|
|
|
|
You need to re-bind the gridview after update. If you are binding the gridview on page_load , ensure you are doing IsPostBack check.
|
|
|
|
|
after updating have u loaded the gird?
once show the code
|
|
|
|
|
just call the bind method after the update precess is done.
|
|
|
|
|
I tried this, but it didn't worked.
|
|
|
|
|
This is my code for GridView and DataSource
<asp:GridView ID="GridView1" runat="server" AllowPaging="True" AutoGenerateColumns="False"
DataKeyNames="LocationCode" DataSourceID="SqlDataSource1" OnSelectedIndexChanged="GridView1_SelectedIndexChanged">
<Columns>
<asp:CommandField ShowSelectButton="True" SelectText="Edit" />
<asp:BoundField DataField="LocationCode" HeaderText="Location Code" ReadOnly="True"
SortExpression="LocationCode" />
<asp:BoundField DataField="LocationDesc" HeaderText="Desciption" SortExpression="LocationDesc" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="Data Source=COMP2;Initial Catalog=Inventory;User ID=sa;Password=pes"
ProviderName="System.Data.SqlClient" SelectCommand="SELECT [LocationCode], [LocationDesc] FROM [Location_Master] ORDER BY [LocationCode]">
</asp:SqlDataSource>
I am editing data in database manually by using SqlCommand class ExecuteScalar method like this.......
protected void btnSave_Click(object sender, EventArgs e)
{
//This method will update a record into Location_Master table
try
{
string connectionString = ConfigurationManager.AppSettings["ConnectionString"];
SqlConnection connection = new SqlConnection(connectionString);
connection.Open();
string save = "";
//String for updating a record into table
save = "update Location_Master set LocationDesc='" + txtBoxLocDesc.Text + "',CreatedBy='"+Session["userName"].ToString();
save = save + "',LastUpdateDate='" + System.DateTime.Now + "' where LocationCode='"+txtBoxLocCode.Text+"'";
SqlCommand saveCommand = new SqlCommand(save, connection);
int rowsAffected = saveCommand.ExecuteNonQuery(); //Store the no. of rows added or updated
connection.Close();
}
catch (System.Exception ex)
{
lblMessage.Text = ex.Message;
lblMessage.Visible = true;
}
}
After clicking that Save button, database is updating, but changes are not reflecting to GridView, i have to execute my application again to see changes in GridView.
|
|
|
|
|
SORRY for posting so large post, but i can't help it.
|
|
|
|
|
You have to use ExecuteScalar instead of ExecuteNonQuery .
int rowsAffected =(int) saveCommand.ExecuteScalar();
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
If my post helps you kindly save my time by voting my post.
www.aktualiteti.com
|
|
|
|
|
I don't think this will make much difference, we mostly use ExecuteNonQuery for updation purpose, i am getting my updations fine.
|
|
|
|
|
After updating the data base u need to bind data again with grid view again bind then data will come
gridview1.databind();
I hope this will u out
modified on Tuesday, August 25, 2009 7:29 AM
|
|
|
|
|
After update, call GridView1.DataBind() .
|
|
|
|
|
Hey thnx for all of those suggestions, i have worked it.
I call DataBind method both after making updation and also in Page_Load and it starts working.
I combined most of ur views.
Thanks to all again.
Nagendra.
|
|
|
|
|
Hello all, i have an application and it is giving me the error child node not allowed in web.comfig .
how should i proceed ?
|
|
|
|
|
|
Hi,
How to crete User control Dynamically?
Regards
Jayabharathi
|
|
|
|
|
rjayaabharathi@gmail.com wrote: How to crete User control Dynamically?
how far have you tried.... did you search something in google... a 2 seconds search in codeproject gives me this link...
Dynamic User Control, Ajaxify Your Controls[^]
|
|
|
|
|
hi,
i 'm not asked how to load user control dynamically?...
i have asked "HOw to create user control dynamically"
|
|
|
|
|
I have a datalist with 2 columns of products with a TextBox next to each product so my customer can enter a number in each checkbox (to determine the order sequence when this list of products is printed to the screen). I have a button for my customer to click when she is happy with the sequence chosen for each product and this calls a subroutine within which I need to be able to collect each productID and the number entered into the textbox next to it. This worked perfectly in my old system using Classic ASP and can't understand why it's so difficult to offer the same funtionality in ASP.Net! I have tried various approaches but none of them work in collecting the number entered into the TextBox and the ProdId at the same time. I tried storing the ProductId in the ID of the TextBox in the hope that I could then retrieve both the ProductId and the value of the TextBox for each product when the button is clicked but values of the TextBox ID are values such as 567 or 784 and are set dynamically (these are the productIds). The error I'm getting is as follows:
The ID property of a control can only be set using the ID attribute in the tag and a simple value. Example: <asp:button runat="server" id="Button1">
and the line containing the error is:
<asp:textbox runat="server" id="<%# DataBinder.Eval(Container.DataItem, "Prod_ID")%>" text="<%# DataBinder.Eval(Container.DataItem, "Sequence1")%>">
Any advice would be greatly apreciated.
Thanks, Lorna
|
|
|
|
|
Hi All,
I am using Ajax ModalPopupExtender in my application. The code is given below
<asp:Panel ID="panelJobType" runat="server" CssClass="modalPopup">
<asp:Panel ID="panelJobTypeHead" runat="server" Style="cursor: move; background-color: #DDDDDD;
border: solid 1px Gray; color: Black">
<div>
<p>
Add the Job Type</p>
</div>
</asp:Panel>
<div>
<table>
<tr>
<td width="28" height="17">
</td>
<td align="left" valign="top" class="search" width="168" height="17">
Job Type:
</td>
<td align="left" valign="top" width="291" height="17">
<asp:TextBox ID="txt_Ctitle" runat="server" CssClass="border" size="25" MaxLength="50"></asp:TextBox>
<font class="msg">*</font>
</td>
</tr>
<tr>
<td colspan="3" height="5">
</td>
</tr>
<tr>
<td height="25" colspan="3">
</td>
</tr>
<tr>
<td colspan="3" bgcolor="074264" align="right" valign="bottom" class="heading5" height="25">
<asp:Button ID="btnSubmitJob" CssClass="rpt_btn" runat="server" Text="Save" />
<asp:Button ID="btnCancel" CssClass="rpt_btn" runat="server" Text="Cancel" />
</td>
</tr>
</table>
</div>
</asp:Panel>
<ajaxToolkit:ModalPopupExtender ID="ModalPopupExtender" runat="server" TargetControlID="LinkButton1"
PopupControlID="panelJobType" BackgroundCssClass="modalBackground"
OkControlID="btnSubmitJob" CancelControlID="btnCancel"
DropShadow="true" PopupDragHandleControlID="panelJobTypeHead" />
Now what I want is to generate events from the buttons in the Panel.
For example I want to store the value of textbox into database by clicking on the button.
Is it possible??? and if yes than how.
Thanks in advance.
modified on Tuesday, August 25, 2009 5:47 AM
|
|
|
|
|
Hi All ,
I am loging into the web site after all validation i have to open another page in popup in which user select the hospital name then i have to redirect to index page.
Dim strScript As String
strScript = "<script language=javascript>" & vbCrLf & _
"window.opener.location.reload('index.aspx');window.close();" & _
vbCrLf & "</script>"
If Not ClientScript.IsClientScriptBlockRegistered("RefreshOpener") Then
ClientScript.RegisterStartupScript([GetType], "RefreshOpener", strScript)
Else
'lblError.Text = "Please Enter Valid Brokerage"
'lblError.Visible = True
End If
Thanks ,
This is working fine for IE but not for firefox
Amit
|
|
|
|
|
Amit Patel1985 wrote: This is working fine for IE but not for firefox
Install firebug[^] and debug the JS.
|
|
|
|