|
I have checked all three points you have sent.But still it doesn't work
|
|
|
|
|
Can you please show us the code ?
Cheers !
Abhijit
Codeproject MVP
|
|
|
|
|
I'm sending you the code.In this, when we refresh the page, "gvQA.Rows.Count" shows 0 rows.
Here's code:
protected void Page_Load(object sender, EventArgs e)
{
if (Page.IsPostBack == false)
{
gvQA.DataSource = null;
gvQA.DataBind();
BindQues();
}
}
#region Methods
public void BindQues()
{
try
{
if (Session["BindData"] == null)
{
ds = new DataSet();
ds = objGet.GetData(Request["JT"].ToString());
litMsg.Text = "Online Test";
if (ds != null)
{
if (ds.Tables[0].Rows.Count > 0)
{
gvQA.Visible = true;
gvQA.DataSource = ds;
gvQA.DataBind();
Session["BindData"] = ds;
}
else
{
gvQA.Visible = false;
}
}
}
else
{
ds =(DataSet)Session["BindData"];
gvQA.Visible = true;
gvQA.DataSource = ds;
gvQA.DataBind();
}
}
catch (Exception ex)
{
Response.Write(ex.Message);
}
}
|
|
|
|
|
Hi..
I am working on a web application and about to complete the project.
Now I am planning to execute error handling and logging errors to my sql server database.
I am using framework 3.5.
could you suggest me what could be the best approach to execute error handling.
or you can suggest me the best link available.
thanks,
By:
Hemant Thaker
|
|
|
|
|
1- Exception Handling Block
You can user the Error handling application block provided by Microsoft.
Exception Block[^]
2- ELMAH
In some of my previous projects I have used ELMAH ELMAH[^]
ELMAH is very efficient in exception handling with simple configuration.
WWW, WCF, WWF, WPF, WFC .... WTF
|
|
|
|
|
|
Dear All,
I am looking to add SplitButton Control in my webpage but I dont know what its called in ASP.Net
you can see that in following link http://dadafghanistan.gov.af/rc?sessionid=1269861720874211[^]
you just need to login which doesnt requires username and password and you can add columns to build a report, as you add a column an split button is added which you can do other action on that too.
any ideas what control is that?
Abdul Rahaman Hamidy
Database Developer
Kabul, Afghanistan
|
|
|
|
|
Hi all,
I am having something like I want to access another computer through C#. After accessing this computer, I want to show some notification through notification control.
does any body know anything about it.
I need urgent help.
Thank you.
|
|
|
|
|
BK Komal wrote: I need urgent help.
Don't be rude
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
private void Descriptiontable()
{
DescriptionClass dcss = new DescriptionClass();
dcss.ProjectIDp = Convert.ToInt32(Session["ProjectId"].ToString());
DataSet ds = new DataSet();
dtDesc = dcss.DynamicDataSet().Tables[0];
dtDesc.Columns.Add("DescriptionName1");
dtDesc.Columns.Add("Date1");
dtDesc.Columns.Add("Description1");
int intID = 1;
foreach (DataRow drow in dtDesc.Rows)
{
drow["ProjectID"] = intID++;
drow["DescriptionName1"] = "qwe";
drow["Date1"] = "";
drow["Description1"] = "asdasd";
}
Session["dtDesc"] = dtDesc;
if (dtDesc.Rows.Count == 0)
{
adddescription();
}
else
{
Bindrepeater();
}
}
private void adddescription()
{
dtDesc = (DataTable)Session["dtDesc"];
DataRow descRow = dtDesc.NewRow();
descRow["DescriptionName"] = "";
descRow["Date"] ="";
descRow["Description"] = "";
dtDesc.Rows.Add(descRow);
Session["dtDesc"] = dtDesc;
Bindrepeater();
}
private void Bindrepeater()
{
if (Session["dtDesc"] == null)
{
Descriptiontable();
}
dtDesc = (DataTable)Session["dtDesc"];
DataView dv = dtDesc.DefaultView;
if (dv.Count == 0)
{
adddescription();
}
Rptdescription.DataSource = dv;
Rptdescription.DataBind();
}
adddescription();
This is how im creating dynamic textboxes in repeater...
But how do i store viewstate of those textboxs on btnclick event...
so that values of text boxs may not dissappear on post back....
|
|
|
|
|
Where you are creating dynamic textboxes in this code?
Or you defined static html inside Repeater?
|
|
|
|
|
yes ststic html defined..
<asp:Repeater ID="Rptdescription" OnItemCommand="Rptdescription_ItemCommand" runat="server">
<HeaderTemplate>
</HeaderTemplate>
<ItemTemplate>
<tr style="width:100%">
<td colspan=16>
Description Name/Type & Source <asp:TextBox CssClass="input" ID="TextName" Width="240px" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "DescriptionName") %>'></asp:TextBox>
<!-- <asp:Label ID="TxtName" runat="server" Visible="false" Text='<%# DataBinder.Eval(Container.DataItem, "DescriptionName") %>'></asp:Label>
--></td> <td colspan=8>
<!--<asp:Label ID="TxtDate" runat="server" Visible="false" Text='<%# DataBinder.Eval(Container.DataItem, "Date") %>'></asp:Label>
-->Date <asp:TextBox ID="TextDate" runat="server" Text='<%# string.Format("{0:dd/MM/yyyy}",Eval("Date")) %>'></asp:TextBox>
<cc1:CalendarExtender Format="dd/MM/yyyy" ID="CalendarExtender1" runat="server" TargetControlID="TextDate" PopupButtonID="ImageButton1" >
</cc1:CalendarExtender>
<asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/Images/Calendar_scheduleHS.png" ValidationGroup="false" />
<br /> <asp:RegularExpressionValidator ID="RegularExpressionValidator14" runat="server" ValidationExpression="(0[1-9]|[12][0-9]|3[01])[- /.](0[1-9]|1[012])[- /.](19|20)\d\d" Display="Dynamic" ControlToValidate="TextDate" ErrorMessage="Please Enter in dd/mm/yyyy format"></asp:RegularExpressionValidator>
</td>
</tr>
<tr style="width:100%">
<td colspan=20 >
<!-- <asp:Label ID="TxtDescription" Visible="false" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Description") %>'></asp:Label>
--> <asp:TextBox CssClass="input" ID="TextDescript" TextMode="MultiLine" Columns="70" Rows="5" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Description") %>'></asp:TextBox>
</td>
<td><asp:LinkButton ID="delete" CommandName="Delete" CommandArgument='<%# DataBinder.Eval(Container.DataItem, "id") %>' ValidationGroup="false" runat="server">delete</asp:LinkButton></td>
</tr>
</ItemTemplate>
<FooterTemplate>
</FooterTemplate>
</asp:Repeater>
|
|
|
|
|
Okay.Then before creating new row and binding it to repeater, you need to save the edited data in text boxes to some persisting object.
|
|
|
|
|
iam using asp.net with c#.and sql server
table fields are
customername nvarchar
monitors decimal
printers decimal
scanners decimal
some times customers will take only printers , so at that time the textboxes is empty so while saving and updating it is giving errors
Input string was not in a correct format
please give example which helps me.
|
|
|
|
|
Why don't you trap for that. if your table field does not allow nulls then you cant insert a null.what you can do is to trap for that and have the reserved word that you will use if the textbox is empty.
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
Hi,
What kind og error it is giving can you give details here..
Thanks ,
Amit Patel
|
|
|
|
|
You should set a default value of 0 (zero) for the monitors, scanners and printers fields such that when you go to pass the data to the database all of the items have a valid value (zero should be a valid count for items denoting that whilst they may have 1 scanner, they have no printers or monitors).
me, me, me
"The dinosaurs became extinct because they didn't have a space program. And if we become extinct because we don't have a space program, it'll serve us right!"
Larry Niven
|
|
|
|
|
developerit wrote:
some times customers will take only printers , so at that time the textboxes is empty so while saving and updating it is giving errors
Input string was not in a correct format
Which line of code is causing the error?Can u paste that line of code here?
|
|
|
|
|
printer.computer,scanner lines are giving error
|
|
|
|
|
try this
in your table set default value of printer, scanner.. parameter is 0
or use in code
if(txt_printer=="")
{
printer =0;
}
else
{
printer =txt_printer.Text;
}
same for scanner . & .........
|
|
|
|
|
If you are going to do it like that, do it this way:
int printer = (string.IsNullOrEmpty(txtPrinter.Text) ? 0 : Convert.ToInt32(txtPrinter.Text);
Apply the appropriate conversion to txtPrinter.Text.
me, me, me
"The dinosaurs became extinct because they didn't have a space program. And if we become extinct because we don't have a space program, it'll serve us right!"
Larry Niven
|
|
|
|
|
Dear All,
i have following code
function displayControlName(src,pText)
{
var msg2Display = document.getElementById('spMsg');
msg2Display.innerHTML += '<input type = "button" value="'+src+'" onclick="return displayMsg(src,pText)"/><br>';
return false;
}
function displayMsg(src,pText)
{
alert(src + ' you are here');
return false;
}
I am looking to pass "src" and "pText" javascript variable to a function called "displayMsg", but I have tried different ways to pass the variables from first method "displayControlName" as i have tried
displayMsg(src,pText), displayMsg('+src+','+pText+') and a little more but none worked for me.
any ideas how to pass the variable name src and pText to the javascript function displayMsg from method displayControlName and I am trying to pass it in this statement onclick = "return displayMsg(src,pText)"?
Abdul Rahaman Hamidy
Database Developer
Kabul, Afghanistan
|
|
|
|
|
this will be the correct way
displayMsg(src,pText);
and i see you have done it but the question is that these parameters have you declared them anywhere ? show u the part you tried to execute and show us where you declare the parameters to pass to the function.
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
those variables are as the function args and I am sending only text value to these args
as you see
the function requires two args
function displayControlName(src,pText) and I am only printing that two variables passed to function.
here I am passing var to that function
menuLink.Attributes["onclick"] = "return displayControlName('" + item.Text + "','" + item.Parent.Text + "');";
both item.Text and item.Parent.Text are there but the
onclick="return displayMsg(src,pText);" doesent work.
Abdul Rahaman Hamidy
Database Developer
Kabul, Afghanistan
|
|
|
|
|
Look at Prakash , that is exactly what you need to do. your variables are not recognized, they are treated as string.
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|