|
Hey!
I've got a dialog that I'm calling from javascript (showModalDialog). This dialog has 3 text boxes that get populated with data from a database in my Page_Load - !IsPostBack section of my code. It works fantastically the first time I run the dialog. I change one of the textboxes and click save which writes back to the DB to update that field, and then the window closes.
I open the dialog again, and the textbox which I just changed and saved in the DB (and confirmed that the DB has the new value) still has the original value! I even ran through the page in debug, and it shows the textbox getting assigned the updated value, and yet it still has the old one.
Anyone know what might be wrong? Something this small is enough to make all my other massive changes useless. ARG!!!
Thanks
...
if (!IsPostBack)
try
{
DataSet ds = new DataSet();
ds = programsClass.GetProgramInfo(iProgram);
txtOrder.Text = ds.Tables[0].Rows[0]["id_order"].ToString();
txtHeat.Text = ds.Tables[0].Rows[0]["id_heat"].ToString();
txtPipes.Text = ds.Tables[0].Rows[0]["num_pieces"].ToString();
...
|
|
|
|
|
As you have mentioned that DB is updated correctly, and still you dont see the updated value.
As per your code, you can see 'updated database value' only when page does not post back any data(only first time ). Hence my conclusion is the you are opening the dialog does not RELOAD the page everytime you open using 'showModalDialog'. Your javascript code is expected to RELOAD the page everytime. Does it happend in your javascript code?
Either check your javascript code to make sure it is reloading the Page which is opened using showModalDialog or get the updated database value into dataset irrespective of whether it is postback or not.
Hope it helps you.
Thanks,
Arindam D Tewary
|
|
|
|
|
Ok,
I tried loading the textbox values outside the !IsPostBack section. The problem now is that when I use the dialog the first time, I change my text value and click on my save button. Then it goes through the page_load again, and reloads the DB value for that text box and then saves it, so the DB never gets updated.
How can I force the ShowModalDialog to reload the page each time?
Thanks!
|
|
|
|
|
Can you please post your showDialog code(the code block that you have for opening the page) here ?
Thanks,
Arindam D Tewary
|
|
|
|
|
The code was originally written in Spanish, so I take no responsibility for the variable names. :p
var dlgAncho=900;
var dlgAlto=200;
var vpagina='dlgEditProgram.aspx?parProgram=' + idProgram ;
mDlg=window.showModalDialog (vpagina,null,'dialogHeight:'+dlgAlto+'px;dialogWidth:'+dlgAncho+'px;status=yes');
if(mDlg!=undefined){
document.all['hidOption'].value="REFRESH";
document.all['form1'].submit();
}
|
|
|
|
|
Hi, all,
I have create a gridview in asp.net with C#, there is a column called Project Name which sometimes has long text, now if it's longer then column width, it will wrap to two line, I don't like this, I want to hide the longer part, how can I do it??
The second question is how can I make gridview header column resizable? is it possible if don't use AJAX?
Thanks!
Andraw
|
|
|
|
|
Hi Andraw,
you can use the DataBound event of the Gridview as per the below code:
protected void gvProjects_RowDataBound(object sender, GridViewRowEventArgs e)
{
string projectName = ((DataRowView)e.Row.DataItem)["ProjectName"].ToString();
if (projectName.Length > 200)
{
projectName.Substring(0, 200);
}
}
or you can loop over the list/DataTable (the Datasource) that you are using to bind your GridView and check the length of the project name and Substring it.
Regards,
Jamil
|
|
|
|
|
Hi, Jamil,
Thanks for your reply. If I limited the text length, when I resize the column width, the cut part cannot be displayed, right?
why <itemstyle wrap="false"> doesn't work?
I will try your link in the next reply.
|
|
|
|
|
yes , if you set the length of the text then when resizing the column the hidden part of the text will appear again because it is already rendered.
This is totally related to the pattern of resizing that you are going to use.
Regards,
Jamil
|
|
|
|
|
But if we fixed the text length to 200, even the column is resized, we still cannot see the extra part, am I right?
|
|
|
|
|
|
|
Hi, Jamil,
I try the codes in your link, but it doesn't work for me, I don't know why. I have my gridview decalred as the following:
<asp:gridview id="GridView1" cssclass="mytable" onmouseup="TableResize_OnMouseUp(this);"
="" onmousedown="TableResize_OnMouseDown(this);" onrowcreated="OnRowCreated" allowsorting="true" onsorting="GridView1_Sorting" onrowdatabound="GridView1_RowDataBound" headerstyle-backcolor="PowderBlue" headerstyle-horizontalalign="Center" runat="server" autogeneratecolumns="false" gridlines="None" alternatingrowstyle-backcolor="Cornsilk" cellpadding="2" cellspacing="0" font-size="11px" font-names="Verdana" showfooter="true" border="1">
also my page is web content page, I put the gridview in tag to create scroll bar and fixed the header while scroll, do these features affect the resizing?
Thanks!
|
|
|
|
|
I have a SQL Server stored proc that truns its dataset as xml. When I run the stored proc in SQL Manager, the results are as expected (23 records in this case).
HOWEVER, when I call the web service method that calls this stored proc, the string being returned looks like it's just the last half of the dataset string.
If I take the results that I got in Sql Manager, convert it to a string, and return that instead of the actual queried dataset, it looks fine in the calling program.
Something is happening between the time the stored proc returns the data to the webs ervice, and the time that the web service passes that data onto my application.
SOLUTION ==================
It seems that the reader had broken the returned xml string into two parts, and I wwas not anticipating that. I changed the servicde method to do a while (reader.Read()) , and appended all of the parts into one string and returned that.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
modified on Thursday, April 22, 2010 2:21 PM
|
|
|
|
|
Hello,
I have been using ASP.NET Web services for communicating with my remote Desktop application from ASp.NET for a long time. Now, I am learning Silverlight application. My goal is to retrieve LINQ to SQL objects from ASP.NET to my Silverlight application and save the changes in my data from Silverlight back to ASP.NET driven SQL Server database. Now,. I see, I have many options like,
1. Domain Service,
2. RIA Service,
3. WCF Service,
4. Authentication Domain Service,
5. Web Service
6. ADO.NET Data Service
....
Now, I am lost. Why there are so many services, how can I determine, what service will suit my need. Looks like, all of them can do what I want to do. Please help me to get guided about it.
Regards.
|
|
|
|
|
Hi,
I have to show some data in gridview group wise. I an having 2 sql tables with some data as shown below.
Table 1
--------
Empid Empname
01 abc
02 xyz
03 pqr
Table 2
--------
Assign1 Empid Assignment
01 01 Assign1
02 01 Assign2
03 01 Assign3
04 02 Assign1
05 03 Assign1
above is the table structure.
Now i want to display it in gridview employee name wise as shown below.
Name Assignment
abc Assign1
Assign2
Assign3
xyz Assign1
pqr Assign1
i want to display it in grid view name wise i.e i want to group assignments by employee name and show it in gridview.
i an sql server 2005 as database.
Any suggestion or code snippet or useful link representing above will be useful.
Thanks and regards,
Pranav Dave
|
|
|
|
|
|
|
hello everyone
I would like your assistance please, I would like to fill a dropdowlist according to another in asp.net / c #, of course respecting the n-tier architecture, if somebody who can help me with ideas, some examples or advice of course, thank you
|
|
|
|
|
|
thank you very much for your help, but the tutorial explains it by working with the wizard, I would like to know at coding
|
|
|
|
|
You have to start from somewhere, then we can help. If you're thinking of using n-tier, then consider having a data access layer, a business logic layer and of cos your presentation layer.
Again, you have to start something, then if you run into problems we will help
|
|
|
|
|
You are talking of cascading dropdownlist, just google 'cascading dropdown' and you will get lots of article on the same with *code* that you want!
P.S.: Even code project is enough for it, if you don't prefer google.
|
|
|
|
|
What matters the most when binding data to a control(dropdown in this case) is your datasource,
this will determin how you retrieve data from your datasource to your control, can be a List<>, database, collection.
For instance, i will bind simple data to my dropdown from a ArrayList.
public void FillCustomerNames()
{
ArrayList customerNames = new ArrayList();
customerName.Add("Member123");
customerName.Add("Member1234");
customerName.Add("Member12345");
dropdownlist.DataSource = customerName;
dropdownlist.DataBind();
}
That's it, whenever you call this method from anywhere it will fill your dropdownlist with those values(items)
|
|
|
|
|
thank you for your reply, and if I want to show the result of choice in the dropdownlist in a html table creates at run time of this application
here is the code of creating a htmltable to display data from DB SQL by selecting a dropdownlist:
string chaineCnx = ConfigurationManager.ConnectionStrings["ConnectionString_operateur"].ToString();
HtmlTable tbTableName = new HtmlTable();
HtmlTableRow tbRow = null;
HtmlTableCell tbCelle = null;
tbTableName.ID = "TableName";
tbTableName.Border = 1;
tbTableName.CellSpacing = 1;
using (SqlConnection cnx = new SqlConnection(chaineCnx))
{
cnx.Open();
SqlCommand cmTable = new SqlCommand("select * from operateur, cnx);
SqlDataReader drTable = cmTable.ExecuteReader();
while (drTable.Read())
{
tbRow = new HtmlTableRow();
for (int i = 0; i < drTable.FieldCount; i++)
{
tbCelle = new HtmlTableCell();
tbCelle.Width = "80";
if (drTable[i] != DBNull.Value)
tbCelle.InnerText = drTable[i].ToString();
tbRow.Cells.Add(tbCelle);
}
tbTableName.Rows.Add(tbRow);
}
this.form1.Controls.Add(tbTableName);
}
|
|
|
|
|